[R-sig-ME] Detecting duplicate random effects

Douglas Bates bates at stat.wisc.edu
Fri Aug 21 15:40:53 CEST 2009


On Wed, Aug 19, 2009 at 2:08 PM, Jeroen Ooms<jeroenooms at gmail.com> wrote:
> 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
> try:
>
> (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.

I can see the desirability of doing this but "easily" may be a bit of
an overstatement here.  It would definitely add a lot of code to the
functions that parse the random effects terms and generate the model
matrices, etc.  I can add it to the list of feature requests but I
doubt I will get to it soon.

> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>




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