[R] Strange R squared, possible error

derek jan.kacaba at gmail.com
Wed Mar 16 22:01:56 CET 2011


It states summary.lm:

r.squared 	R^2, the ‘fraction of variance explained by the model’,

R^2 = 1 - Sum(R[i]^2) / Sum((y[i]- y*)^2),

where y* is the mean of y[i] if there is an intercept and zero otherwise.

Why to use different formula when intercept is set to zero?

I tried to compute R^2 from sk=summary(lm(y~x+0))
t=sum(for(i in 1:10) (sk$residuals[i])^2)) # but it doesn't work 

--
View this message in context: http://r.789695.n4.nabble.com/Strange-R-squared-possible-error-tp3382818p3383023.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list