From adriano at techoffix.org  Thu Jul 22 05:22:51 2004
From: adriano at techoffix.org (adriano@techoffix.org)
Date: Thu Jul 22 05:22:54 2004
Subject: [Rd] Bug: wrong R-squared in lm formula w/o intercept (PR#7127)
Message-ID: <20040722032251.D94A4FC29@slim.kubism.ku.dk>

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)


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