Hello,
I am trying to set up the mathematical notation for a multilevel model with stratified intercept that I want to fit with brm. Unfortunately I am very unsure if I am on the right track and find very little reference.
Here is the model and my first attempt:
I would appreciate any help, suggestion or reference.
prior <- c(set_prior("cauchy(0,0.3)", class = "sd"),
set_prior("normal(0,10)", class = "b"),
set_prior("normal(0,10000)", class = "sigma"))
fit <- brm(Y ~ 0 + factor(A) + B + C + (0 + B| A),
data = dat, prior = prior, iter = 4000)
\begin{aligned}
\operatorname{Y}_{ij} &\sim N \left(\mu_{i}, \sigma^2\right) \\
\end{aligned}
\begin{aligned}
E(\operatorname{Y{ij}}) = \beta_{0}(A) + \beta_{1j} (A) + \beta_{2j} (B) +
\beta_{3} (C) + \epsilon_{ij} \\
\end{aligned}
\begin{aligned}
E(Y_{ij}) = \beta_0(A) + (\beta_{1}(A) + \upsilon_{1j}(A)) + (\beta_{2}(B) + \upsilon_{2j}(B)) + \beta_{3}(C) + \epsilon_{ij}
\end{aligned}
\begin{aligned}
E(Y_{ij}) = \beta_0(A) + \beta_{1}(A) + \beta_{2}(B) + \beta_{3}(C) + \upsilon_{1j}(A)+ \upsilon_{2j}(B) + \epsilon_{ij}
\end{aligned}
\begin{aligned}
\upsilon_{1j} \sim N(0, \tau^2_{\upsilon_{1j}}) \\ \upsilon_{2j} \sim N(0, \tau^2_{\upsilon_{2j}})
\end{aligned}
\begin{aligned}
Cov(\sigma^2_{\upsilon_{0j}}, \sigma^2_{\upsilon_{2j}}) = \sigma^2_{\upsilon_{0j}, \upsilon_{2j}}
\end{aligned}
\begin{aligned}
\sigma_{e}&\sim HalfCauchy(0.3) \\ \sigma_{A} &\sim N(0, 10000) \\ \beta &\sim N(0,10)
\end{aligned}
PS: equatiomatic
is unfortunately not yet optimized for this kind of formula.
Thank you in advance!