Re: [R] wrong calculation of R-squared in summary.lm

2011-03-30 Thread Prof Brian Ripley
This is user error: that fit has class c("mlm", "lm") and you should be calling summary() on it, which will dispatch the mlm method. For multiple-response linear models, there is also summary.manova. On Wed, 30 Mar 2011, Stefan Schlager wrote: Dear all, I just stumbled upon the fact, that wh

[R] wrong calculation of R-squared in summary.lm

2011-03-30 Thread Stefan Schlager
Dear all, I just stumbled upon the fact, that when I perform a regression on multivariate responses, that are not centred, I get a ricilulously high R-squared value. After reading the code of summary.lm, I found a bug in the function summary.lm: mss is calculated by: mss <-sum((f - mean(f))