[R] lme() F-values disagree with aov()

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Aug 14 17:40:14 CEST 2006


"William Simpson" <wsimpson at utsc.utoronto.ca> writes:

> > Your lme statement is OK. To get the usual split-plot anova, your aov
> > statement should be
> >
> > fit2 <- aov(y ~ a*b*c + Error(s), data = d)
> 
> No, this gives wrong F-values. By "wrong" I mean it does not agree with the
> published table.

Well, it's the model that is equivalent to your lme() model....

Thing is that you want to add random effects of s:b and s:c, which are
crossed factors, so somewhat tricky to code with lme() (this sort of
thing is easier in lmer() from the lme4 packages). 

The generic way to handle this in lme() is via something like

           random=list(s=pdBlocked(list(
                     pdIdent(~1),
                     pdIdent(~b-1),
                     pdIdent(~c-1))))

You probably won't get the degrees of freedom right, though. 

 
> Table 12.10-2, page 559:
>                      Number of obs =      32     R-squared     =  0.9920
>                      Root MSE      = .559017     Adj R-squared =  0.9589
> 
>             Source |  Partial SS    df       MS           F     Prob > F
>         -----------+----------------------------------------------------
>              Model |     233.625    25       9.345      29.90     0.0002
>                    |
>                  a |       3.125     1       3.125       2.00     0.2070
>                s|a |       9.375     6      1.5625
>         -----------+----------------------------------------------------
>                  b |      162.00     1      162.00     199.38     0.0000
>                a*b |       6.125     1       6.125       7.54     0.0335
>              b*s|a |       4.875     6       .8125
>         -----------+----------------------------------------------------
>                  c |       24.50     1       24.50      61.89     0.0002
>                a*c |      10.125     1      10.125      25.58     0.0023
>              c*s|a |       2.375     6  .395833333
>         -----------+----------------------------------------------------
>                b*c |        8.00     1        8.00      25.60     0.0023
>              a*b*c |       3.125     1       3.125      10.00     0.0195
>                    |
>           Residual |       1.875     6       .3125
>         -----------+----------------------------------------------------
>              Total |      235.50    31  7.59677419
> 
> Bill
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
> 

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list