[R-sig-ME] aov() -> lme() conversion difficulty
Ben Bolker
bbolker at gmail.com
Wed Mar 16 21:29:56 CET 2011
[cc'ing back to r-sig-mixed: it's generally a good idea to keep the
list "in the loop"]
On 11-03-16 12:12 PM, Brian Edward wrote:
> Thank you, I am sorry the tables got messed up. It was due to the
> Html->Text conversion.
>
> The hit-score is an integer between 0 and 10, so its not a 0/1 binary
> outcome but a linear score each time (I guess the binomial wont work here)
Binomial will exactly work here.
>
> I know there might not be any big differences in between individuals
> (for this dataset), but each individual in my sample is scored 10 times
> with one eye and 10 times with two eyes used, so I dont think I can do
> the paired t-test. I also noted that the distribution of scores in not
> normally distributed (in the population) but I ignore the fact because I
> have no idea how to do that without a much more complicated model
> (bootstrapping etc.)
Unless there is something non-exchangeable about the individual tests
(e.g. you think the probability of a hit might depend on the sequence of
the test), then I don't see why you can't do the paired t-test: that is,
calculate the differences per individual in the number of two-eye and
one-eye successes and do a t test against a population mean of zero.
The t-test is reasonably robust to non-normality. You could also do a
paired Wilcoxon test (?wilcox.test).
>
> The NumEyesUsed p-value for my lme is 0.3217 and for the equivalent aov
> it is 0.1772. So the actual question is if my conversion was totally wrong:
>
> i.e
>
> anova(lme(Hits~NumEyesUsed, random=~1|PersonID/NumEyesUsed,data=y))
> <totally different>
Hits ~ b_i + eps_person + eps_(person:numeyes) + eps_resid
where the first term is the fixed effect of number of eyes,
the second is the among-subject effect, the third is the
among-tests-within-subject effect, and the the fourth is residual variation
(I'm still not sure if you're using total number of hits per person/eye
combination as your data (0-10), or whether you're using success on a
particular trial (0/1). If the latter, you're violating normality
pretty badly. If the former, then the third and fourth terms above are
completely confounded [as I suggested based on your zero residual error].)
> summary(aov(Hits~NumEyesUsed+Error(PersonID/NumEyesUsed),data=y))
>
> in the lme model you suggest:
>
> random=~NumEyesUsed|PersonID
>
This is actually a slightly more complicated model, because it allows
for different variances in the success with one vs two eyes.
> the p-Value I obtain is: 0.0788
>
> How would you convert your random lme term back into the normal aov formula?
>
> The idea to express/convert the lme -> aov formula in this fashion I
> found on:
>
> http://blog.gribblelab.org/2009/03/09/repeated-measures-anova-using-r/
>
> Thanks again,
>
> Brian
>
>> Date: Wed, 16 Mar 2011 11:44:00 -0400
>> From: bbolker at gmail.com
>> To: b.edward at live.com
>> CC: r-sig-mixed-models at r-project.org
>> Subject: Re: [R-sig-ME] aov() -> lme() conversion difficulty
>>
>> 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:
>> >
>> >
>> >>
>>
>> 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
>>
>>
>>
More information about the R-sig-mixed-models
mailing list