# [R-sig-ME] aov() -> lme() conversion difficulty

Ben Bolker bbolker at gmail.com
Wed Mar 16 16:44:00 CET 2011

```On 11-03-16 10:41 AM, Brian Edward wrote:
>
> according to a couple of PDFs and webpages in came up with this aov() <- lme() conversion:
>
>
>> anova(lme(Hits~NumEyesUsed, random=~1|PersonID/NumEyesUsed,data=y))

I think you want

random = ~NumEyesUsed|PersonID
>
>                      numDF denDF  F-value p-value
>        (Intercept)     1    36     56.06667  <.0001
>        NumEyesUsed     1     1     3.26667  0.3217

Your table got mangled.  Was it supposed to look like this?
If so, then it's clear from the denominator DF that something is wrong ...

>
>
>> summary(aov(Hits~NumEyesUsed+Error(PersonID/NumEyesUsed),data=y))

Error: PersonID
>           Df     Sum Sq    Mean Sq F value Pr(>F)Residuals  1 1.7514e-33 1.7514e-33

Also note that your residual errors are essentially zero, which means
you don't have any variation left after you have included experimental
blocks -- some are aliased with the residual error.

> Error: PersonID:NumEyesUsed
>            Df Sum Sq Mean Sq F value Pr(>F)
> NumEyesUsed 1    4.9     4.9   12.25 0.1772
> Residuals   1    0.4     0.4
> Error: Within          Df Sum Sq Mean Sq F value Pr(>F)
> Residuals 36   56.6  1.5722
>
> In this study each person is allowed try ten times with one eye and then ten times with two eyes to score hits.
> The question is if there is a difference in hits between using one or two eyes.
>
> I get different p-values in my aov() <- lme() conversion, which one answers the question more closely?

What are your actual response variables?  Number of successes out of
10 tries?  In that case I might suggest

lmer(cbind(Hits,10-Hits)~NumEyesUsed+(NumEyesUsed|PersonID),
family=binomial, data= ...)

although that will make it hard for you get p-values.

For that matter, since you have only two treatment levels, what's
wrong with a paired t-test ... ???

Ben Bolker

```