[R] Loop with string variable AND customizable "summary" output

Marc Schwartz marc_schwartz at comcast.net
Mon Jan 29 21:01:03 CET 2007


On Mon, 2007-01-29 at 14:30 -0500, Gabor Grothendieck wrote:
> Note that the nlme solution seems to give the same coefficients
> but appears to use a single error term rather than one error
> term per level of the conditioning variable and that would change various
> other statistics relative to the other solutions should that matter.
> 
> > summary(lmList(uptake ~ conc | Treatment, CO2))
> Call:
>   Model: uptake ~ conc | Treatment
>    Data: CO2
> 
> Coefficients:
>    (Intercept)
>            Estimate Std. Error  t value     Pr(>|t|)
> nonchilled 22.01916    2.46416 8.935769 1.174616e-13
> chilled    16.98142    2.46416 6.891361 1.146556e-09
>    conc
>              Estimate  Std. Error  t value     Pr(>|t|)
> nonchilled 0.01982458 0.004692544 4.224699 6.292679e-05
> chilled    0.01563659 0.004692544 3.332221 1.306259e-03
> 
> Residual standard error: 8.945667 on 80 degrees of freedom

<snip>

Gabor,

Thanks for noting that. There is a solution using 'pool = FALSE':

> summary(lmList(uptake ~ conc | Treatment, CO2, pool = FALSE))
Call:
  Model: uptake ~ conc | Treatment 
   Data: CO2 

Coefficients:
   (Intercept) 
           Estimate Std. Error   t value     Pr(>|t|)
nonchilled 22.01916   2.148475 10.248740 9.463480e-13
chilled    16.98142   2.743761  6.189103 2.562416e-07
   conc 
             Estimate  Std. Error  t value     Pr(>|t|)
nonchilled 0.01982458 0.004091379 4.845452 1.934996e-05
chilled    0.01563659 0.005224992 2.992653 4.721873e-03


I suppose that, while subtle, this could make this approach error prone
for those who (like me in this case) miss it...

Then of course, we get down to the format of the output, etc.

:-)

Thanks Gabor,

Marc



More information about the R-help mailing list