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. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.