# Re: [R] Once again: aov vs. lme/lmer

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Sun 15 Oct 2006 - 02:24:27 GMT

I believe the short answer to your question is no: I don't believe it's possible to get the exact same answer from 'lme' or 'lmer' as from 'aov' for your example.

Without a philosophical discussion, I can't tell you why. I almost never use 'aov', because it tests everything using an 'F' test, the particular 'F' is really relevant to what we want to know or not. With 'lme' and 'lmer', I have more confidence that I know what I'm doing and that I'm testing the hypotheses that are likely to be of greatest interest for my problem. The 'aov' algorithm was wonderful half a century ago, and was still the best procedure easily available to most people a quarter century ago. We have better tools available today. In case someone reading this reply wants more information on this, I suggest they start with the discussion of 'Conservative ANOVA tables in lmer' in the R Wiki.

```      Hope this helps.
Spencer Graves

```

Rafael Laboissiere wrote:
> First of all, I apologize for asking a question that has appeared
> recurrently in this mailing list. However, I have googled for it, have
> looked at the mailing list archives, and also looked at Pinheiro & Bates book
> (although not very thoroughly, I must confess), to no avail.
>
> Here is the question: I am trying to obtain with lme or lmer the same exact
> numerical results (p-values) that I obtain with aov. Consider the following
> data:
>
> d <- data.frame (a = factor (rep (c (1, 2), c(10, 10))),
> b = factor (rep (rep (c (1, 2), c(5, 5)),2)),
> s = factor (rep (1 : 5, 4)),
> v = rnorm (20))
>
> Let us say that this comes from a repeated measures experiments where all
> five subjects (factor s) were tested in all combinations of the two fixed
> factors a and b.
>
> With aov, for a model were s, s:a, s:b and s:a:b are random, and a*b
> are fixed terms, I would use:
>
> aov (v ~ a*b + Error (s / (a*b)), data = d)
>
> Is there a way to get the same results using lme or lmer? How should I write
> my "random" argument in lme or the "(...|...)" terms in lmer? Please notice
> that I am not interested in philosophical discussions about whether I am
> trying to do wrong things. I would only like to know whether a given R
> function could be used in place of another R function.
>