Here is an example with dummy data:
N <- 15
dat <- data.frame(
y1 = rbinom(N, 10, 0.3), y2 = rbinom(N, 10, 0.5),
y3 = rbinom(N, 10, 0.7), x = rnorm(N)
)
dat$size <- with(dat, y1 + y2 + y3)
dat$y <- with(dat, cbind(y1, y2, y3))
prior <- prior(normal(0, 10), "b", dpar = muy2) +
prior(cauchy(0, 1), "Intercept") +
prior(normal(0, 2), "Intercept", dpar = muy3)
fit <- brm(bf(y | trials(size) ~ 1, muy2 ~ x), data = dat,
family = multinomial(), prior = prior)
You may also bind y1
to y3
together within the formula as long as you avoid using cbind
which is (currently still) reseverd form multivariate models.