Hi,
I have a repeated measures data set where 5 animals are each tested on 5
sound durations and within each duration they are tested on 5 different
sound intensities (sound levels). The same 5 sound levels are used at
each duration.
The data are at:
www.physiol.ox.ac.uk/~raac/ablated_level_dur.csv
abl.lev <- read.csv("ablated_level_dur.csv", header=T)
xyplot(prop.cor~level|duration,groups=animal,
type="l",data=abl.lev)
I can analyse this in aov, correctly I think, but I can't quite get the
same numbers to come out of a mixed-effects model with lme. I think I'm
confused about specifying the random effects; or maybe I've done it
right but lme just isn't going to return the same values. Can anyone
help save my Thesis?
Many thanks,
Rob
Here it all is:
A.
I can do the within-subjects analysis in R using aov and I have an error
stratum for each main effect and interaction. Perhaps there is a simpler
way of specifying the error term and perhaps I want to do duration/level
rather then duration*level, but for now it's ok. The design is balanced.
animal and duration are factors. level is a continuous variable.
abl.lev.aov1 <-
aov(prop.cor ~ duration*level +Error(animal/duration+animal/level+
animal/duration/level), data=abl.lev)
I get these results back:
summary(abl.lev.aov1)
Error: animal
Df Sum Sq Mean Sq F value Pr(>F)
Residuals 4 0.298673 0.074668
Error: animal:duration
Df Sum Sq Mean Sq F value Pr(>F)
duration 4 1.24461 0.31115 74.244 4.008e-10 ***
Residuals 16 0.06705 0.00419
Error: animal:level
Df Sum Sq Mean Sq F value Pr(>F)
level 1 0.148720 0.148720 15.764 0.01653 *
Residuals 4 0.037737 0.009434
Error: animal:duration:level
Df Sum Sq Mean Sq F value Pr(>F)
duration:level 4 0.031771 0.007943 3.9961 0.0196 *
Residuals 16 0.031803 0.001988
QUESTION: I want to repeat this analysis using a mixed-effects model
with lme. I can get some of the way towards doing it but I'm stuck:
B.
If I run:
abl.lev.lm0 <- lme(prop.cor ~ duration*level,
random= ~level|animal/duration, data=abl.lev)
Then I get the same F-values for level and duration:level as the ANOVA
above. However, the duration:level p-value is different and the F value for
duration is different.
anova(abl.lev.lm0)
numDF denDF F-value p-value
(Intercept) 1 95 180.50491 <.0001
duration 4 16 70.77279 <.0001
level 1 95 15.76395 0.0001
duration:level 4 95 3.99606 0.0049
If I run:
abl.lev.lm1 <- lme(prop.cor ~ duration*level,
random= ~1|animal/duration/level, data=abl.lev)
The my duration F-value is ok but the level and interaction F-values are
shot. Does anyone know what I'm doing wrong. Shouldn't I be able to get
the same numbers from lme as I got from aov?
Finally, why is "denDF" 16 for duration but 95 for everything else.
Should level be 1 and 4?
anova(abl.lev.lm1)
numDF denDF F-value p-value
(Intercept) 1 95 151.92370 <.0001
duration 4 16 74.24458 <.0001
level 1 95 102.30594 <.0001
duration:level 4 95 5.46398 5e-04
--
Rob Campbell - Research Student
- in search of a Thesis
Autistic Bacteriophage Research Group
www.autisticBacteriophage.notlong.com
Oxford
~ www.robertcampbell.co.uk ~
*
|