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).

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.

  • $\begingroup$ Yes, the examiner is just a part of greater examiner population & something less important than other fixed effects. That said, is model 'complexity' similar if it is a random effect? ANOVA for model comparison does appear in multiple sources. e.g. stat.ethz.ch/R-manual/R-devel/library/nlme/html/anova.lme.html If there is reason to believe intercept & slope are correlated, e.g. subjects with higher score at baseline improve faster, would one still try fitting slope & intercept independently to check effects of a covariate? Very helpful links. Thanks a lot for your reply! $\endgroup$ – Pradeep Babu Dec 22 '13 at 6:28
  • 1
    $\begingroup$ 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.) $\endgroup$ – usεr11852 Dec 25 '13 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.