Multivariate mixed models in brms

May I ask you a question on how to fit multivariate multilevel models with brms? Since this is my first time working with multivariate mixed models, the question might be a little silly.

So, I want to estimate the two equations:

model {

but I also want to allow correlations between all random effects (not only between random effects associated with x1 and x2 or x3 and x4, but also those between (x1,x3), (x1,x4), (x2,x3) and (x2,x4)). I haven’t found how to implement this using brm.

I’ve tried to do this:

model {
fit1<-brm(mvbf(bf1,bf2), data=.., family=..., iter=...)

but this is clearly not what I want. Could you please help me with this?

Assume that I want to estimate the following univariate mixed model:
y= \begin{cases} \epsilon, \text{ with probability }\delta\\ -1+x_1+x_2+(-1+x_1+x_2|Id), \text{ otherwise} \end{cases}
i.e., with probability \delta y is only defined by an error term \epsilon; with probability 1-\delta we have a standard linear model:

model {

How this can be implemented using brms?
Moreover, I want to allow \delta varies among groups:

model {

Thanks a lot!

1 Like

Sorry for not getting to you earlier, your question is relevant and well written.

If I understand your question 1 correctly, a partial solution would be to use this syntax:

y1 ~ ... (-1 + x1 + x2 | q | Id)
y2 ~ ... (-1 + x3 + x4 | q | Id)

The q is an arbitrary string that indicates that the two terms share a correlation structure (i.e. it doesn’t matter what you put between the pipes, just that it is the same in both cases).

For question 2 - this looks like a mixture model which are supported by brms and you can put different predictors for both components and for the mixing probability. Check out the docs for more details, but feel free toask clarifying questions here if you have trouble using it.

Best of luck with your model!