#数据的量纲对估计的影响
x1<-seq(1,5,length=30)
y1<-2+3*x1+rnorm(30,0,2) #真实的数据生成过程 系数为2和3
lm.1<-lm(y1~x1)
summary(lm.1)
Call:
lm(formula = y1 ~ x1)
Residuals:
Min 1Q Median 3Q Max
-3.5420 -0.8117 0.3164 0.9730 3.1581
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.6337 0.8470 1.929 0.064 .
x1 3.1586 0.2623 12.040 1.38e-12 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.715 on 28 degrees of freedom
Multiple R-squared: 0.8381, Adjusted R-squared: 0.8323
F-statistic: 145 on 1 and 28 DF, p-value: 1.376e-12
x2<-10*x1 #同时放大十倍
y2<-10*y1
lm.2<-lm(y2~x2)
summary(lm.2)
Call:
lm(formula = y2 ~ x2)
Residuals:
Min 1Q Median 3Q Max
-35.420 -8.117 3.164 9.730 31.581
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 16.3375 8.4701 1.929 0.064 .
x2 3.1586 0.2623 12.040 1.38e-12 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 17.15 on 28 degrees of freedom
Multiple R-squared: 0.8381, Adjusted R-squared: 0.8323
F-statistic: 145 on 1 and 28 DF, p-value: 1.376e-12
x3<-x2 #x放大十倍
y3<-y1
lm.3<-lm(y3~x3)
summary(lm.3)
Call:
lm(formula = y3 ~ x3)
Residuals:
Min 1Q Median 3Q Max
-3.5420 -0.8117 0.3164 0.9730 3.1581
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.63375 0.84701 1.929 0.064 .
x3 0.31586 0.02623 12.040 1.38e-12 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.715 on 28 degrees of freedom
Multiple R-squared: 0.8381, Adjusted R-squared: 0.8323
F-statistic: 145 on 1 and 28 DF, p-value: 1.376e-12