R-alpha: R 0.14 : summary(lm(...)) dies 'terribly'

Martin Maechler (maechler@stat.math.ethz.ch)
Mon, 2 Dec 96 10:45:45 +0100


Date: Mon, 2 Dec 96 10:45:45 +0100
Message-Id: <9612020945.AA07009@>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: R-testers@stat.math.ethz.ch
Subject: R-alpha: R 0.14 :  summary(lm(...))  dies 'terribly'

E.g., try the first few lines in   $RHOME/demos/models/lm+glm

They work fine in 0.13

Unfortunately, I'm too busy to really  diagnose  + fix + test + patch ...

But even in 0.13 (+ some patches that were posted by Tom Lumley & ??) :

> ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
> trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
> group <- gl(2,10,20,labels=c("Ctl","Trt"))

> group
 [1] Ctl Ctl Ctl Ctl Ctl Ctl Ctl Ctl Ctl Ctl Trt Trt Trt Trt Trt Trt Trt Trt Trt
[20] Trt

> weight <- c(ctl,trt)
> anova(lm(weight~group))

Analysis of Variance Table

          Df  Sum Sq  Mean Sq      F  Pr(>F)
group      1  0.6882   0.6882  1.419   0.249
Residual  18  8.7292   0.4850               

> summary(lm(weight~group-1))

Call:
lm(formula = weight ~ group - 1)

Residuals:
    Min      1Q  Median      3Q     Max 
-1.0710 -0.4937  0.0685  0.2462  1.3690 

Coefficients:
         Estimate Std.Error t Value  Pr(>|t|)
groupCtl    5.032    0.2202   22.85 9.548e-15
groupTrt    4.661    0.2202   21.17 3.619e-14

Residual standard error: 0.6964 on 18 degrees of freedom
Multiple R-Squared: 0.9818,  Adjusted R-squared: 0.9798 
F-statistic: 970.1 on 1 and 18 degrees of freedom,  p-value: 0 

> summary(lm(weight~group)) ##-- added by M.Maechler ----

Call:
lm(formula = weight ~ group)

Residuals:
    Min      1Q  Median      3Q     Max 
-1.0710 -0.4937  0.0685  0.2462  1.3690 

Coefficients:
            Estimate Std.Error t Value  Pr(>|t|)
(Intercept)    5.032    0.2202  22.850 9.548e-15
groupTrt      -0.371    0.3114  -1.191 2.490e-01

Residual standard error: 0.6964 on 18 degrees of freedom
Multiple R-Squared: 0.07308,  Adjusted R-squared: -0.02991 
F-statistic: 1.419 on 1 and 18 degrees of freedom,  p-value: 0.249 

-------------
Look at the last 2 lines! -- something seems terrbly wrong  (R2.adj < 0 !)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-