Main effects in multi-membership models

brms is one of the best ways of fitting multi membership, multi-level models. I have a multi membership, multi-level problem that I’m trying to tackle, but could do with a second opinion on best practice when it comes to including random slopes.

Imagine a case where we want to estimate the following model in brms:

y ~ 1 + x + (1 + mmc(x1, x2, x3) | mm(g1, g2, g3, weights = cbind(w1, w2, w3), scale = F))

Here, we have some outcome, y, that we expect to vary according to x1, x2, x3, but we also expect their effect to vary over the three multi-membership groups (g1, g2, g3), which we in turn assume to be weighted according to weights w1, w2, w3 and for these groups not to be scaled to sum to 1 within each case.

My question is, in this case, how do we include the main effect of x when we in fact have only the variables x1, x2, and x3 in the data?

I have discussed this in the past with @paul.buerkner and his recommendation was to create a new variable, x, that is the mean of x1, x2, x3. But that was in the context of equal weights and scale = T. Am I right in thinking that where the data are not scaled and are weighted, one should compute the weighted average of x1, x2, and x3 to include as the main effect instead?

1 Like

Yes, the xs should be weighted according to the ws.

1 Like

Thanks, Paul!