Question1.
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 {
y1~-1+x1+x2+(-1+x1+x2|Id)
y2~-1+x3+x4+(-1+x3+x4|Id)
}
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 {
bf1<-bf(y1~-1+x1+x2+(-1+x1+x2|Id))
bf2<-bf(y2~-1+x3+x4+(-1+x3+x4|Id))
mvbf(bf1,bf2),
fit1<-brm(mvbf(bf1,bf2), data=.., family=..., iter=...)
}
but this is clearly not what I want. Could you please help me with this?
Question2.
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 {
y~-1+x1+x2+(-1+x1+x2|Id)
}
How this can be implemented using brms?
Moreover, I want to allow \delta varies among groups:
model {
$\delta$~1+(1|Id)
}
Thanks a lot!