Displaying 1 result from an estimated 1 matches for "sqtot".
2012 Jul 13
4
R-squared with Intercept set to 0 (zero) for linear regression in R is incorrect
...Adjusted R-squared: 0.9543
F-statistic: 606.2 on 1 and 28 DF, p-value: < 2.2e-16
Way manual determination was performed. The value returned coincides with
the value from Excel:
#### trying to figure out why the R^2 for R and Excel are so different.
sqerr = (k[,1] - predict(M1))^2
sqtot = (k[,1] - mean(k[,1]) ^2
R2 = 1 - sum(sqerr)/sum(sqtot) ## for 1D get 0.328 same as
excel value
I am very puzzled by this. How does R compute the value for R^2 in this
case? Did i write the lm incorrectly?
Thanks
Pam
PS In case you are interested, the data I am using for hte tw...