请教下用R和Excel做回归的结果为什么相差很大
R的运行过程如下:
Grades<-read.table("D:/R/Train/DataSets/ch1/Ch01PR19.txt")
attach(Grades)
Gradesfit<-lm(V1~V2)
summary(Gradesfit)
输出结果:
Call:
lm(formula = V1 ~ V2)
Residuals:
Min 1Q Median 3Q Max
-2.74004 -0.33827 0.04062 0.44064 1.22737
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.11405 0.32089 6.588 1.3e-09 ***
V2 0.03883 0.01277 3.040 0.00292 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.6231 on 118 degrees of freedom
Multiple R-squared: 0.07262, Adjusted R-squared: 0.06476
F-statistic: 9.24 on 1 and 118 DF, p-value: 0.002917
而使用Excel数据分析板块做回归,结果则是:
| Coefficients | 标准误差 | t Stat | P-value | Lower 95% | Upper 95% | 下限 95.0% | 上限 95.0% |
Intercept | 3.057376 | 0.081957 | 37.30451 | 3.72E-67 | 2.895079 | 3.219674 | 2.895079 | 3.219674 |
X | 0.00061 | 0.00208 | 0.29335 | 0.76976 | -0.0035 | 0.00474 | 0.00352 | 0.00474 |
很明显R的参数估计和Excel的相差很大而且拟合不好。到底是为什么,恳请能指出问题所在,谢谢大家。