mmc: Multi-Membership Covariates

Description Usage Arguments Value See Also Examples

View source: R/formula-re.R

Description

Specify covariates that vary over different levels of multi-membership grouping factors thus requiring special treatment. This function is almost solely useful, when called in combination with mm. Outside of multi-membership terms it will behave very much like cbind.

Usage

1

Arguments

...

One or more terms containing covariates corresponding to the grouping levels specified in mm.

Value

A matrix with covariates as columns.

See Also

mm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
# simulate some data
dat <- data.frame(
  y = rnorm(100), x1 = rnorm(100), x2 = rnorm(100),
  g1 = sample(1:10, 100, TRUE), g2 = sample(1:10, 100, TRUE)
)

# multi-membership model with level specific covariate values
dat$xc <- (dat$x1 + dat$x2) / 2 
fit <- brm(y ~ xc + (1 + mmc(x1, x2) | mm(g1, g2)), data = dat)
summary(fit)

## End(Not run)

brms documentation built on Aug. 23, 2021, 5:08 p.m.