[R] F distribution from lme()?

Bill.Venables at csiro.au Bill.Venables at csiro.au
Thu Nov 1 13:45:49 CET 2007


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
> 
-- 
View this message in context:
http://www.nabble.com/F-distribution-from-lme%28%29--tf4729757.html#a135
24346
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list