[R-sig-ME] Cross-classified multiple membership models

Douglas Bates bates at stat.wisc.edu
Sun Jun 6 15:01:13 CEST 2010

On Thu, Jun 3, 2010 at 2:15 PM, Roberts, Kyle <kyler at mail.smu.edu> wrote:
> Dear All,
> Is it possible to perform a cross-classified multiple membership model with lmer? Here's the data scenario. I have mathematics data for 2500 kids across four measurement occasions. At each occasion, they are in a separate teacher's classroom (cross-classified, not truly nested). However, there are times that the kids are taking more than one math course during that semester (multiple membership; for example, in a remedial math course AND in another math course with their cohort). Here's an example:
> id      time        teacher     score
> 1       1           1005        118
> 1       2           1021        125
> 1       2           1024        125
> 1       3           1151        139
> 1       4           1148        164
> See how at time==2, person 1 is in two separate math courses, but receives the same score for both "rows" of data since the administration of the instrument occurred only once at that time point.

> When I looked through the archive, I found one reference from Doug a year ago that said that he didn't think this was possible yet. However, I thought that maybe someone worked a solution since then.

> http://finzi.psych.upenn.edu/R-sig-mixed-models/2009q1/002080.html

You can fit such a model but not easily in that you would need to
manually intervene between the stages of specifying the model and
fitting the model.

When you specify a model using the formula language the random-effects
terms are specified with respect to grouping factors (student,
instructor, etc.) and the assumption is that each observation is
associated with a unique level of each grouping factor.  That is not
the case here.

The matrix representation of the model does not require that it be
based on such random-effects terms.  It simply requires that the model
matrices can be specified.  This is why in the lme4a package (only on
R-forge) there is a distinction between the S4 class reModule
(random-effects module) and reTrms (random-effects module based on
formula terms).

What would need to be done in this case is to specify the model with
the usual formula for a unique teacher at each exam score then add the
extra teachers to the Z model matrix before fitting the model.

I can provide code to do this if you can give me some sample data.

  The computational methods for estimating the parameters in a
mixed-effects model are more general than the specification of models
using the formula language.

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