# Multi-membership covariates: Do we need a population-level term?

• Operating System: macOS 10.14.5
• brms Version: 2.9.2

Hi All,

Imagine a dataset that looks as follows:

id voted duty1 duty2 duty3 rel1 rel2 rel3
1 Yes 1 0 1 Spouse Sibling Friend
2 No 1 1 0 Friend Spouse Sibling
3 Yes 0 1 0 Sibling Sibling Friend
4 No 0 0 1 Spouse Friend Friend

Here, each respondent (`id`) has 3 discussants with whom they talk about politics. `rel1-3` indicates the nature of the relationship the respondent has with the discussant and `duty1-3` indicates whether the discussant thinks that voting is a civic duty.

I want to know to what extent voting (`voted`) is a function of relationship type and whether the discussant thinks voting is a civic duty.

Were it the case that each respondent had only 1 discussant, Iâ€™d fit the following model:

``````voted ~ 1 + duty + (1 + duty | rel)
``````

But the data structure implies a multi-membership model instead.

To this end, I have two requests:

1. How do I extend the formula above to a multi-membership context?
2. The brms documentation implies that I need to sum my `duty` variables, then divide by the number of discussants (e.g. `dta\$duty <- (dta\$duty1 + dta\$duty2 + dta\$duty3)/3` and include this is in the formula. If this is required, how do I generalise this to cases where the respondent has only 1 or 2 discussants?

EDIT: Made point clearer

in the example xc is the population level effect of x, otherwise you assume it to be zero which is very likely invalid. in multimembership models with equally weighted groups, it is simply the average over the respective predictor values (duty in your case).

I would go for

``````voted ~ 1 + duty_mean + (1 + mmc(duty1, duty2, duty2) | mm(rel1, rel2, rel3))
``````

where duty_mean is the variable containing the mean of the duties per observation.

1 Like

Thanks for the quick response, Paul.

Just to clarify, imagine I have a tiny dataset as so:

id voted duty1 duty2 duty3 rel1 rel2 rel3 prt1 prt2 prt3 w1 w2 w3
1 Yes 1 0 1 Spouse Sibling Friend Shared Opposing Opposing 1 1 1
2 No 1 1 0 Friend Spouse Empty Shared Opposing Empty 1 1 0
3 Yes 0 1 0 Sibling Empty Empty Opposing Empty Empty 1 0 0

I have no information that I might use to weight the discussants. As such, I want to assume that all are of equal weight and that each discussant contributes the same amount. I.e. I donâ€™t want the single discussant respondent 3 has to have 3x the contribution of each discussant respondent 1 has above. I believe that I should extend your syntax as follows (is this correct?):

``````voted ~ 1 + duty_mean + (1 + mmc(duty1, duty2, duty2) | mm(rel1, rel2, rel3, weights = cbind(w1, w2, w3), scale = FALSE)
``````

Further, as this is the case, do I still need to average the duty variables? Or should I just sum them instead?

You donâ€™t need to specify the weights if they are equal anyway. I suggest to use the mean not the sum to remain on the same scale.

Noted on using the mean for scale. Thanks.

The issue I have is that some respondents have 1, some 2, and some 3 discussants. As such, some of the relationships are NA, which Iâ€™ve marked as â€śEmptyâ€ť and weighted as 0 so that they donâ€™t get deleted listwise when I run the model. (See the last table, above)

Given that this is the case, I presume I do need to include weights and that I do need to use the `scale` argument. Can you confirm?

I canâ€™t confirm. This empty looks strange to me. See the brms article published in the R journal for an example how to handle this â€śemptyâ€ť case properly without adding an artificial level.

Ok, will do. Thanks again, Paul!