[R] fixed and random effects in lme
Federico Calboli
f.calboli at ucl.ac.uk
Thu Feb 13 20:57:03 CET 2003
Hi All,
I would like to ask a question on fixed and random effecti in lme. I am
fiddlying around Mick Crawley dataset "rats" :
http://www.bio.ic.ac.uk/research/mjcraw/statcomp/data/
The advantage is that most work is already done in Crawley's book (page 361
onwards) so I can check what I am doing.
I am tryg to reproduce the nested analysis on page 368:
model<-aov(Glycogen~Treatment/Rat/Liver + Error(Treatment/Rat/Liver), rats)
using lme.
The code:
model1<- lme(Glycogen~Treatment, random = ~1|Rat/Liver, data=rats)
VarCorr(model1)
Variance StdDev
Rat = pdLogChol(1)
(Intercept) 20.6019981 4.538942
Liver = pdLogChol(1)
(Intercept) 0.0540623 0.232513
Residual 42.4362241 6.514309
Does NOT give me the same variance componets I find in Crawley's book (page
371 onwards).
The code:
model2<- lme(Glycogen~Treatment, random = ~1|Treatment/Rat/Liver, data=rats)
VarCorr(model2)
Variance StdDev
Treatment = pdLogChol(1)
(Intercept) 12.54061 3.541272
Rat = pdLogChol(1)
(Intercept) 36.07900 6.006580
Liver = pdLogChol(1)
(Intercept) 14.17434 3.764883
Residual 21.16227 4.600247
gets me very similar results (I would guess the differences are due to
rounding and the fact I am using R 1.6.2 and Crawley used S+).
My problem is: as *Treatment* is a fixed factor, why should I put it in
both the fixed term side and random terms side of my code to get the right
numbers? I fail to get this at all. Any elucidation would be appreciated.
Regards,
Federico Calboli
=========================
Federico C.F. Calboli
Department of Biology
University College London
Room 327
Darwin Building
Gower Street
London
WClE 6BT
Tel: (+44) 020 7679 4395
Fax (+44) 020 7679 7096
f.calboli at ucl.ac.uk
More information about the R-help
mailing list