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.
Mock data:
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.
Best Answer
This is not a direct answer for
lme
's syntax.I would argue that while in theory a specific
examiner
is part of the greater examiner population and it does make sense to have it as a random effect, you have only 2 (and occasionally 3) replicates. It will most probably be more sensible to use it as fixed effect (possibly as an interaction).Moreover I would not be too fast to jump on ANOVA for model selection. Assuming you do not want to consider issues of cross-validation etc., maybe an information criterion like AIC will be equally easy to apply and probably slightly more coherent.
I think your first model is quite reasonable as it stands. Maybe try a
(0+time|subject)+(1|subject)
random structure so that you will fit independently the slope and the intercept of the model...I scavenged this thread from R-sig-mixed (I had also seen your question there about a fortnight ago) and these two older ones from R-help (thread1, thread2) that might be helpful as they contain some expert opinions on the matter.