[R] Need help with lmer model specification syntax for nested mixed model

Carabiniero jason at troutnut.com
Sun Oct 31 08:35:03 CET 2010


I haven't been able to fully make sense of the conflicting online information
about whether and how to specify nesting structure for a nested, mixed
model.  I'll describe my experiment and hopefully somebody who knows lme4
well can help.

We're measuring the fluorescence intensity of brain slices from frogs that
have undergone various treatments.  We want to use multcomp to look for
differences between treatments, while accounting for the variance introduced
by the random effects of brain and slice.  There are a few measurements per
slice, several slices per brain, and several brains per treatment.  In the
data file, the numbering for slices starts over from 1 for each brain, and
the numbering for brains starts over from 1 for each treatment.  

In other words:  Treatment is a fixed effect, brain is a random effect
nested in treatment, and slice is a random effect nested in brain.

As I understood the documentation, this is the correct specification:

log(Intensity) ~ Treatment + (1|Brain) + (1|Slice)

However, I don't see how lmer understands the correct nesting structure from
that.  How does it know brain isn't crossed with treatment?

Here are two other things I tried, and each gave different results:

log(Intensity) ~ Treatment + (1|Slice/Brain/Treatment)
log(Intensity) ~ Treatment + (1|Brain/Treatment) + (1|Slice/Brain)

I'm not sure why these things give different results, or which one (if any)
is right.  Can anyone help?

Thanks!
-- 
View this message in context: http://r.789695.n4.nabble.com/Need-help-with-lmer-model-specification-syntax-for-nested-mixed-model-tp3020895p3020895.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list