On page 165 of Mixed-Effects Models in S and S-Plus by Pinheiro and Bates there is an example of using lme() in the nlme package to fit a model with crossed random factors. The example assumes though that the data is grouped. Is it possible to use lme() to fit crossed random factors when the data is not grouped?

E.g., y <- rnorm(12); a=gl(4,1,12); b=gl(3,4,12). Can I fit an additive model like y~a+b but with a and b random?

Everything I've tried gives an error:

> lme(y~1,random=~1|(a+b))
Error in switch(mode(object), name = , numeric = , call = object, character = as.name(object), :
[[ cannot be of mode (
> lme(y~1,random=~a+b)
Error in getGroups.data.frame(dataMix, groups) :
Invalid formula for groups


Thanks
Gordon

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to