[R] lme: how to compare random effects in two subsets of data
Laurent Fanchon
lfanchon at vet-alfort.fr
Tue Apr 25 17:00:25 CEST 2006
Dear R-gurus,
I have an interpretation problem regarding lme models.
I am currently working on dog locomotion, particularly on some variation
factors.
I try to figure out which limb out of 2 generated more dispersed data.
I record a value called Peak, around 20 times for each limb with a record.
I repeat the records during a single day, and on several days.
I tried to build two models, one for each limb :
Dog.Left <- lme (fixed=Peak~1, data=Loco,
subset=Limb=="Left",random=~1|Dog/Day/Record)
Dog.Right <- lme (fixed=Peak~1, data=Loco,
subset=Limb=="Right",random=~1|Dog/Day/Record)
This allows to determine the variance attributable to each factor.
Record represents the within-day variation, Day represents the
between-day variation.
This gives the following results :
VarCorr (Dog.Left)
Variance StdDev
Dog = pdLogChol(1)
(Intercept) 564.55587 23.760384
Day = pdLogChol(1)
(Intercept) 54.63027 7.391229
Record = pdLogChol(1)
(Intercept) 23.29377 4.826362
Residual 27.46464 5.240672
VarCorr(Dog.Right)
Variance StdDev
Dog = pdLogChol(1)
(Intercept) 552.11246 23.497074
Day = pdLogChol(1)
(Intercept) 70.72088 8.409571
Record = pdLogChol(1)
(Intercept) 21.94594 4.684649
Residual 29.68476 5.448373
This shows that the variance might be different for each limb.
For example, the variance attributable to Day might be higher for the
Right limb.
This is the first part of my interpretation, and I hope to be right.
What do you think??
Then, the question is : are these differences statistically significant.
I am not sure of how to investigate this question.
I tried to compare several models :
model1<- lme (fixed=Peak~Limb, data=Loco,
random=list(Dog=~Limb,Day=~Limb,Record=~Limb)) this is the more
complicated model
model2<-lme (fixed=Peak~Limb, data=Loco,
random=list(Dog=~Limb,Day=~Limb,Record=~1))
anova (model1,model2) showed no difference
model3<-lme (fixed=Peak~Limb, data=Loco,
random=list(Dog=~Limb,Day=~1,Record=~1))
anova (model2,model3) showed a significant difference <0.0001
model2 seems to be the best model.
Does it means the difference of variance between the two limb is
significant for between-day variation and is unsignificant for
within-day variation??
Finally VarCorr (model2) gives :
Variance StdDev Corr
Dog = pdLogChol(Limb)
(Intercept) 567.553021 23.823371 (Intr)
LimbRight 7.249064 2.692409 -0.166
Day = pdLogChol(Limb)
(Intercept) 53.888346 7.340868 (Intr)
LimbRight 4.863394 2.205310 0.363
Record = pdLogChol(1)
(Intercept) 22.418031 4.734768
Residual 28.740451 5.361012
I am not sure to understand this issue.
The global variance attributable to Day is roughly 53.88 (random effect
on the intercept). And the differences between the two limbs might be
increased according to a variance of 4.86 (random effect on the slope).
Is that right?
But does this also make it possible to determine which limb had the
highest variance? I guess if I change the order of the Limb factor
(Right<Left) I will get the same results with LimbLeft. How to determine
the limb with the highest variance?
Do I have to refer to the first two models (Variance attributable to Day
was a little higher for the Right) ?
Any help will be very appreciated,
Laurent Fanchon
Ecole Nationale Vétérinaire d'Alfort
National Vet School of Alfort (France)
More information about the R-help
mailing list