[R-sig-ME] [R] lme nesting/interaction advice

christian forkstam christian at forkstam.se
Mon May 12 15:51:05 CEST 2008



Federico Calboli wrote:
>> Maybe you are looking for something similar to:
>>
>> set.seed(78987)
>> a = rep(1:3,each=120)
>> b = rep(1:3,3, each=40)
>> c = rep(1:10,9,each=4)
>> y = rnorm(360,0,10)
>> x = cbind(a,b,c,y)
>> colnames(x) = c("a", "b", "c", "y")
>> x = as.data.frame(x)
>>
>> lme = lme(y ~ factor(a)*factor(b)*factor(c)-1, x, ~factor(c))
>> anova(lme)
>
> With the very same model you're using I get:
>
> > lme.mod = lme(y ~ selection * males * month-1, random = ~month, 
> testdat)
> Error in getGroups.data.frame(dataMix, groups) :
>   Invalid formula for groups
> > lme.mod = lme(y ~ selection * males * (month-1), random = ~month, 
> testdat)
> Error in getGroups.data.frame(dataMix, groups) :
>   Invalid formula for groups

Try

lme = lme(y ~ factor(a)*factor(b)*factor(c)-1, x, ~1|factor(c))

Good luck,
Christian

-- 
christian forkstam____________________________________________
|________|_NETHERLANDS________________________________________|
|   work | max planck institute, PO box 310, 6500AH nijmegen  |
|        | f.c. donders centre, PO box 9101, 6500HB nijmegen  |
|________|_SWEDEN_____________________________________________|
| mobile | +46 (0)73 0242643                                  |
|___work | mrcenter, N8, karolinska hospital, 17176 stockholm |




More information about the R-sig-mixed-models mailing list