[R] anova(lme object)

Prof Brian Ripley
Thu, 21 Aug 2003 17:19:32 -0000

On Thu, 21 Aug 2003, Mahbub Latif wrote:

> Hi,
>
> I use lme to fit models like
>
> R> res1 <- lme(y~A+B, data=mydata, random=~1|subject)
> R> res2 <- lme(y~B+A, data=mydata, random=~1|subject)
>
> (only difference between these two models are the
> sequence in which the indep variables are written in
> formula)
>
> where y is continuous and A, B, and subject are
> factors. To get ANOVA table I used
>
> R> anova(res1)
> R> anova(res2)
>
> and found ANOVA tables corresponding to these two
> models are different. Is there any way I can get
> similar ANOVA tables from lme objects of this type?

Those are *sequential* anova tables, so should be different.
Read the help page ?anova.lme to find the answer to your question.
Hint: argument `type' may help.

--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595