I am new to R and would like your help with lme formula for partially crossed random effect in a random-intercept, random-slope model. In the longitudinal data I have, each subject (barring some dropouts) was tested at 5 different occasions. The standardized tests were administered by 3 different examiners, with 2 of them present at all occasions, and the 3rd one administering tests only on the last two occasions. The subjects were randomly assigned to the examiners.
data <- data.frame(subject=rep(A,5), time=1:5, examiner=c(2,1,2,2,3), covariate=c(1,1.3,0.8,1,0.6), score=c(46,56,60,68,70))
I tested the following models:
>model1 <- lme(score~time*covariate, random=~time|subject, method="REML", na.action=na.omit, data=dat) >model2 <- lme(score~time*covariate, random=list(examiner=~1,subject=~time), method="REML", na.action=na.omit, data=dat) >anova(model1, model2) #gives p<0.05 with better model fit for model2.
I would like to know if
model2 is the correct way to specify the partially
crossed random effect in the data I described.