brms: Mixed Model Extensions
Just with mixed models, we already start to see what brms brings to the table
- additional distributions: ordinal, zero-inflated, beta and many more
- Correlated residuals, Additive mixed models, non-linear with known form, heterogeneous variance components, correlated random effects across multivariate outcomes, and more
# auto regressive residual structure
model <- brm(Reaction ~ Days + (1 + Days|Subject),
data = sleepstudy,
correlation = cor_ar(~Days))
# multi-membership models
model <- brm(DV ~ x + (1|mm(group_1, group_2)),
data = sleepstudy)
# smooth terms
model <- brm(Reaction ~ s(Days) + (1 + Days|Subject),
data = sleepstudy)
# use gaussian process instead
model <- brm(Reaction ~ gp(Days) + (1 + Days|Subject),
data = sleepstudy)
# multivarate outcome; q is an arbitrarily named identifier connecting random
# effects.
f1 = bf(DV_1 ~ x + 1|q|group)
f2 = bf(DV_2 ~ x + 1|q|group)
f = f1 + f2
model <- brm(f, data = mydata)