Hi,

I have a question about the function lme() in R.

I have a 2*2*3 layout with some missing data (labelled as *). These 3 factors are labelled as A,B,C, the response is Score. The layout is as follows:-

A              B                 C                    Score
1               1                  1                         5
1               1                  2                         *
1               1                  3                         1
1               2                  1                         4
1               2                  2                         4
1               2                  3                         *
2               1                  1                         3
2               1                  2                         *
2               1                  3                         4
2               2                  1                         2
2               2                  2                         *
2               2                  3                         5

Suppose these data are stored in a data frame called "test".

If all these 3 factors are fixed, then I can fit a model without the 3-way interaction as:- fit1<-lm(Score~A*B+A*C+B*C,data=test) If one of these factors, say A, is a random effect variable, then I need to fit a mixed effect model using lme(). I have read the R documention on lme(), but I am still not clear how to specify the random argument. I tried to do:-

fit2<-lme(Score~A*B+A*C+B*C,data=test,random=~A, na.action=na.pass)
but the system give a message as follows:-
Error in getGroups.data.frame(dataMix, groups) : Invalid formula for groups

So how should I specify the arguments?
Thank you very much for your help!

Jiajie

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to