[R-sig-ME] Detecting duplicate random effects

Jeroen Ooms jeroenooms at gmail.com
Wed Aug 19 21:08:07 CEST 2009

I was running into a problem in parsing lme4 output, and it turned out
that it was my own mistake (of course :) However, I think it was a
mistate that could have been detected. I accidentally inserted a
duplicate random effect term into the model. For example a user could

(fm2 <- lmer(Reaction ~ Days + (1|Subject) + (Days|Subject), sleepstudy))

This does not result in an error, lme4 will fit twice a random
intercept for the Subject group. I cannot think of a situation in
which this would be useful. Would it be an idea to throw an error in
this situation? It can easily be detected by inspecting ranef(fm2),
and noticing the (intercept) term exists twice in the $Subject group.

More information about the R-sig-mixed-models mailing list