[Rd] Bug: wrong R-squared in lm formula w/o intercept (PR#7127)

From: <adriano_at_techoffix.org>
Date: Thu 22 Jul 2004 - 13:22:51 EST


Full_Name: Adriano Azevedo Filho
Version: 1.9.1
OS: Windows, Linux
Submission from: (NULL) (200.171.246.212)

R-squared and Adjusted R-squared appear to be wrong when the formula in lm() is specified without intercept. Problem present in both Windows and Linux 1.9.1 version. Also in the 1.8.1 version for Windows (other versions not checked).
Possible example which reproduces the problem: x<-1:10
y<-c(2,4,3,4,6,9,10,12,15,13)
summary(lm(y~x)) # with intercept, result is OK #Residual standard error: 1.329 on 8 degrees of freedom #Multiple R-Squared: 0.9262, Adjusted R-squared: 0.917 summary(lm(y~x-1)) # without intercept,

#Residual standard error: 1.26 on 9 degrees of freedom
#Multiple R-Squared: 0.9821,     Adjusted R-squared: 0.9802

#>>>> Not possible to have a R-squared larger in the restricted
#>>>> model (forced without intercept)


R-devel@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel Received on Thu Jul 22 13:27:26 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 08:59:12 EST