Skip to content

Need help with lmer model specification syntax for nested mixed model

1 message · Douglas Bates

#
On Sun, Oct 31, 2010 at 2:35 AM, Carabiniero <jason at troutnut.com> wrote:
This is what I call "implicit nesting" in the definition of the
variables.  My general recommendation is to create new variables that
reflect the actual structure of the data, as in

mydata <- within(mydata, {
    ubrain <- factor(Treatment:Brain)
    uslice <- factor(Treatment:Brain:Slice)
}

then define the model in terms of these factors, ubrain and uslice,
that have the desirable property that each distinct brain has a
distinct label.
That will work with ubrain and uslice instead of the implicitly nested
Brain and Slice.
lmer can determine the crossed or nested structure from the data
whenever the data reflect the structure.  Implicitly nested factors
don't reflect the structure of the data and rely on external
information to augment the data given.

The computational methods used in lmer don't depend on whether the
grouping factors for the random effects are nested or not.  However
they do require that the grouping factors are well-defined.
I have taken the liberty of cc:ing the R-SIG-Mixed-Models mailing list
on this reply and suggest that any follow-ups be on that list.