[R] lm without intercept, false R-squared

peter dalgaard pdalgd at gmail.com
Wed Jun 27 14:50:58 CEST 2012


On Jun 27, 2012, at 13:15 , Uwe Ligges wrote:

> 
> 1 - crossprod(residuals(model)) / crossprod(y - mean(y))

And the reason why that is not used in R:

> y<- rnorm(100,10,1)
> x <- 1:100
> model <- lm(y~x-1)
> 
> 1 - crossprod(residuals(model)) / crossprod(y - mean(y))
          [,1]
[1,] -27.60012


-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list