[R] Random effects in LME
Robert Tanton
tanton at teknet.net.au
Mon Jul 7 14:54:33 CEST 2003
I have a model which has 3 levels (Year some indexes calculated (i); State
(j); and Year for which data were available (k)).
I want a random effect for the Year the Indexes are calculated within State
(i,j). I normally use MLWin, and its simple; I specify the three levels;
then introduce a constant, and in the drop down box for the constant, I have
3 check boxes; I click on j (State); and voila, a random effect u(ij). Note
this is the only random effect I want.
I haven't found how to do this in R. I have tried:
mlcgc1 <- lme(Factors ~ 1, data=cgc, random=~1+1+0|YOA/State/YOR)
but this introduces a random effect for all levels; I have tried
mlcgc2 <- lme(Factors ~ 1,data=cgc,random = list(YOA=~1,State=~1))
but this gives me a 2 level model. So I tried:
mlcgc3 <- lme(Factors ~ 1,data=cgc,random = list(YOA=~1,State=~1,YOR=~0))
but this still gives me random effects for all 3 levels.
Any ideas?
Thanks.
Robert Tanton.
More information about the R-help
mailing list