[Rd] lm() (PR#1059)

kjetil halvorsen kjetilh@umsanet.edu.bo
Thu, 16 Aug 2001 13:42:08 -0400


Hola!

This is not an error. If the r-squared is small, the formula 
defining "adjusted r-square" can give negative values, correctly.

Kjetil Halvorsen.

JDiaz-Saiz@uh.edu wrote:
> 
> Full_Name: Joaquin Diaz-Saiz
> Version: 1.3.0
> OS: Windows
> Submission from: (NULL) (129.7.120.106)
> 
> The lm() function applied to a particular data set produces a negative value for
> the adjusted R-square. See the output below.
> 
> =======================================================
> R : Copyright 2001, The R Development Core Team
> Version 1.3.0  (2001-06-22)
> 
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type `license()' or `licence()' for distribution details.
> 
> R is a collaborative project with many contributors.
> Type `contributors()' for more information.
> 
> Type `demo()' for some demos, `help()' for on-line help, or
> `help.start()' for a HTML browser interface to help.
> Type `q()' to quit R.
> 
> [Previously saved workspace restored]
> 
> > w<-read.table("accres.txt")
> > w
>    V1 V2
> 1   9  1
> 2   3  1
> 3   8  1
> 4   7  1
> 5  12  1
> 6   4  0
> 7  13  0
> 8  10  0
> 9   9  0
> 10  9  0
> 11  6  0
> > x<-w$V1
> > t<-w$V2
> > x
>  [1]  9  3  8  7 12  4 13 10  9  9  6
> > t
>  [1] 1 1 1 1 1 0 0 0 0 0 0
> > out<-lm(x~t)
> > summary(out)
> 
> Call:
> lm(formula = x ~ t)
> 
> Residuals:
>    Min     1Q Median     3Q    Max
>  -4.80  -1.65   0.50   1.35   4.50
> 
> Coefficients:
>             Estimate Std. Error t value Pr(>|t|)
> (Intercept)    8.500      1.307   6.502 0.000111 ***
> t             -0.700      1.939  -0.361 0.726443
> ---
> Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
> 
> Residual standard error: 3.202 on 9 degrees of freedom
> Multiple R-Squared: 0.01427,    Adjusted R-squared: -0.09525
> F-statistic: 0.1303 on 1 and 9 DF,  p-value: 0.7264
> 
> >
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._