# How to specify partially crossed random effect in lme?

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.

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).
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...
• Glad they were of some help. Furthermore: No, be careful; model complexity is definitely not similar. If anything it is an open question (in technical, theoretical as well purely philosophical terms) how many degrees of freedom one random effect should account for. Eg. Should you threat in a $N$ = 10000 sample, a random effects with 3000 levels as conveying the same information as one with 25 levels? Intrinsically I would say "no", though ANOVA would treat them as exactly the same. (I am not saying that my "no" is the correct answer, I am just commenting.) – usεr11852 says Reinstate Monic Dec 25 '13 at 0:48