# mm

From brms v1.10.0
by PaulChristian Buerkner

##### Set up multi-membership grouping terms in brms

Function to set up a multi-membership grouping term in brms. The function does not evaluate its arguments -- it exists purely to help set up a model with grouping terms.

##### Usage

`mm(..., weights = NULL, scale = TRUE)`

##### Arguments

- ...
One or more terms containing grouping factors.

- weights
A matrix specifying the weights of each member. It should have as many columns as grouping terms specified in

`...`

. If`NULL`

(the default), equally weights are used.- scale
Logical; if

`TRUE`

(the default), weights are standardized in order to sum to one per row. If negative weights are specified,`scale`

needs to be set to`FALSE`

.

##### See Also

##### Examples

```
# NOT RUN {
# simulate some data
dat <- data.frame(y = rnorm(100), x = rnorm(100),
g1 = sample(1:10, 100, TRUE),
g2 = sample(1:10, 100, TRUE))
# multi-membership model with two members per group and equal weights
fit1 <- brm(y ~ x + (1|mm(g1, g2)), data = dat)
summary(fit1)
# weight the first member two times for than the second member
dat$w1 <- rep(2, 100)
dat$w2 <- rep(1, 100)
fit2 <- brm(y ~ x + (1|mm(g1, g2, weights = cbind(w1, w2))), data = dat)
summary(fit2)
# }
# NOT RUN {
# }
```

*Documentation reproduced from package brms, version 1.10.0, License: GPL (>= 3)*

### Community examples

Looks like there are no examples yet.