[R] F distribution from lme()?

Christoph Scherber Christoph.Scherber at agr.uni-goettingen.de
Fri Nov 9 12:33:52 CET 2007


Dear Bill Venables,

Does this mean that in a conventional aov object, the "summary.lm" gives 
the parameter estimates and p-values computed "marginally", while the 
"summary.aov" table by default gives sequential sums of squares?

This question arose recently when a colleague and I were discussing 
differences in the P-values from a model that contained only linear (1 
d.f.) terms.

Thanks a lot for your assistance,
Christoph.



Bill.Venables at csiro.au schrieb:
> Using anova with the default setting generates a sequential analysis of
> variance table.  You can see this by noting that if you change the order
> of terms in the model, it gives you a different result:
> 
>> incub.lme2 <- lme(egg.temp ~ kjday + treat, random = ~1|ind, data =
> incub.df)
>> incub.lme3 <- lme(egg.temp ~ treat + kjday, random = ~1|ind, data =
> incub.df)
>> anova(incub.lme2)
>             numDF denDF   F-value p-value
> (Intercept)     1    11 1176.6677  <.0001
> kjday           1     7    5.7060  0.0483
> treat           1     7    9.6364  0.0172
>> anova(incub.lme3)
>             numDF denDF   F-value p-value
> (Intercept)     1    11 1176.6677  <.0001
> treat           1     7   14.8398  0.0063
> kjday           1     7    0.5026  0.5013
> 
> So this is adressing the question of what the additional contribution of
> each term is if you add them to the model one after the other.  If you
> look at kjday *before* you consider the effect of treat, it looks very
> significant, but if you allow for the effect of treat and then consider
> the additional contribution of kjday, it looks unnecessary.  This is a
> sure sign that treat and kjday (at least) are partially confounded in
> the data, and if you look closely at the data itself you can see this.
> 
> What you were expecting is an anova output which is not additive, but
> considers the contribution of each term separately, with all other terms
> in the model.  This is called a "marginal" anova table, for which you
> can ask:
>  
>> anova(incub.lme3, type = "marginal")
>             numDF denDF   F-value p-value
> (Intercept)     1    11 21.664654  0.0007
> treat           1     7  9.636384  0.0172
> kjday           1     7  0.502597  0.5013
> 
> Notice that dropterm(...) from the MASS library can be used for the same
> kind of table for simpler LM and GLM models.
> 
> Bill Venables.
> 
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Andreas Nord
> Sent: Thursday, 1 November 2007 5:17 PM
> To: r-help at r-project.org
> Subject: [R] F distribution from lme()?
> 
> 
> Dear all,
> 
> Using the data set and code below, I am interested in modelling how egg
> temperature (egg.temp)
> is related to energy expenditure (kjday) and clutch size (treat) in
> incubating birds using the
> lme-function. I wish to generate the F-distribution for my model, and
> have
> tried to do so using
> the anova()-function. However, in the resulting anova-table, the
> parameter
> kjday has gone from
> being highly non-signiicant in the lme-expression, to all of a sudden
> being
> significant at the
> 0.05 level. At the same time, "treat" retains its original p-value. I've
> tried to understand why,
> but can't really figure it out. So, what has happened and why? How to
> best
> interpret it?
> 
> Further, any advice on how to best generate F-distributions from the
> lme-function is most appreciated.
> 
> Many thanks in advance,
> Andreas Nord
> Sweden
> 
> 
>   ind treat egg.temp  kjday
>    79     2 27.33241 42.048
>    42     2 30.73269 41.760
>    10     2 29.54986 38.304
>   206     2 31.78947 45.216
>    23     2 29.69114 40.896
>    24     2 36.48199 46.944
>    45     2 29.76454 44.064
>    29     2 30.56510 42.912
>    78     2 27.71468 43.200
>    79     3 25.88227 45.216
>    42     3 30.95983 44.640
>    10     3 28.13296 45.216
>   206     3 31.77147 45.216
>    23     3 27.50000 42.336
>     5     3 28.16205 51.264
>    24     3 34.69391 48.960
>    45     3 28.79778 46.368
>   368     3 26.18006 45.792
>    29     3 29.75208 45.216
>    78     3 25.28393 43.200
>    44     3 23.32825 44.640
> 
> 
> # lme-model with "individual" as random factor
>> incub.lme2<-lme(egg.temp~kjday+treat,random=~1|ind,data=incub.df)
> 
> Fixed effects: egg.temp ~ kjday + treat
>                 Value Std.Error DF   t-value p-value
> (Intercept) 24.937897  6.662475 11  3.743038  0.0032
> kjday        0.108143  0.152540  7  0.708945  0.5013
> treat3      -1.506605  0.485336  7 -3.104254  0.0172
> 
> 
> #generating an anova table to get the F-distribution
>> anova(incub.lme2)
>             numDF denDF   F-value p-value
> (Intercept)     1    11 1176.6686  <.0001
> kjday           1     7    5.7060  0.0483
> treat           1     7    9.6364  0.0172



More information about the R-help mailing list