Three-level multiple membership models in brms

I have been examining the relationship between teachers’ attitudes and students’ grades using multiple membership models to account for classes cotaught by two teachers. The models look something like this:

grades ~ teacher_attitude + controls + (1 | mm(teacher1ID, teacher2ID, weights = cbind(w1, w2))

I’ve just learned from the school that teachers are grouped into teams that meet daily. Each team has its own norms and culture that may make teacher attitudes and/or grades more similar within teacher teams, so this seems important to account for in the model. Is it possible to nest a multiple membership grouping term in another level in brms? (Both teachers in cotaught classes are always in the same team.) I tried:

grades ~ ... + (1 | team/mm(teacher1ID, teacher2ID, weights = cbind(w1, w2))

but received the following error:

Error: Illegal grouping term 'team:mm(teacher1ID, teacher2ID, weights = cbind(w1, w2))'. It may contain only variable names combined by the symbol ':'

Is there another way to do this?


You could simply use (1 | team) + (1 | mm(teacher1ID, teacher2ID, weights = cbind(w1, w2)). This is equivalent to what you tried as long as the teacher IDs are unique across teams, that is, as long as no two differents teachers have the same ID.

Thank you!