[R-sig-ME] Don't understand this variance components output

Ben Bolker bbolker at gmail.com
Fri Jan 31 23:12:30 CET 2014


On 14-01-29 10:02 AM, Stuart Luppescu wrote:
> On Tue, 2014-01-28 at 23:23 -0500, Ben Bolker wrote:
>> just use (1|tid.f/obsorder.f), drop (1|tid.f) -- it's redundant.
>>
>>   I don't know if it's a FAQ or not, but I feel like I've answered
>> this
>> one before (maybe off-list though) ... the problem is that you've got
>> both (1|tid.f) (variation in intercepts among 'tid.f' levels) and
>> (1|tid.f/obsorder.f) (variation among obsorder.f nested within tid.f).
>> In particular, tid.f/obsorder.f expands to tid.f + tid.f:obsorder.f
>> (i.e., tid.f and obsorder.f nested within tid.f),
> 
> 
> 
> Ben, thanks very much for the help. If this is tl then dr.
> 
> I'm still confused by how to specify interactions, especially when I
> have both nested and crossed factors. I read Doug Bates's book but this
> is not clear. 
> 
> I have teachers crossed by components, and observations nested within
> teachers. Do I specify the nesting/crossing structure in the model
> statement or in the factor identifiers? That is, for observations nested
> within teachers, do I need observation identifiers that look like
> "Teacher1Observation1", "Teacher1Observation2", etc.? What I have now is
> just 1, 2, 3, 4, ... for teacher and 1, 2, 3, 4, ... for observation. I
> believe I tried the former but when I included an
> observation-by-component interaction, I got a message saying the number
> of levels has to be less than the number of cases.
> 
> Thanks again.

  [cc'ing back to r-sig-mixed-models]

>From http://glmm.wikidot.com/faq:

Whether you explicitly specify a random effect as nested or not depends
(in part) on the way the levels of the random effects are coded. If the
'lower-level' random effect is coded with unique levels, then the two
syntaxes (1|a/b) (or (1|a+a:b)) and (1|a)+(1|b) are equivalent. If the
lower-level random effect has the same labels within each larger group
(e.g. blocks 1, 2, 3, 4 within sites A, B, and C) then the explicit
nesting (1|a/b) is required. It seems to be considered best practice to
code the nested level uniquely (e.g. A1, A2, …, B1, B2, …) so that
confusion between nested and crossed effects is less likely.

   ... but note this is NOT the same as (1|a) + (1|a/b) , which is what
you were trying to do in your model.  lme4 processes each random effect
term independently, so it can't "see" that the variation in intercept
across 'a' groupings is repeated twice, once from the (1|a) term and
once from the (1|a/b) term (which is exactly equivalent to (1|a+a:b)).

 If you try to do (1|a*b), which corresponds to (1|a+b+a:b), it sounds
like you're specifying an overparameterized model with your design -- if
elements of 'b' aren't repeated across levels of 'a' then you don't have
enough information to fit the model.

This is also discussed at
https://stat.ethz.ch/pipermail/r-sig-mixed-models/2007q4/000422.html

  hope that helps.

  Ben Bolker



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