JLC
July 24, 2022, 7:17pm
1
I have fitted a model of some two-alternative forced-choice data where responded chose from a pair of stimuli and three domains (y1, y2, y3).
I began with a brms
model:
fmla_y1 <- bf(Y1 ~ 0 + X1 +
X2 +
X3 +
X4 +
(1 + X1 + X2 + X3 | p | Subject),
center = FALSE)
fmla_y2 <- bf(Y2 ~ 0 + X1 +
X2 +
X3 +
X4 +
(1 + X1 + X2 + X3 | p | Subject),
center = FALSE)
fmla_y3 <- bf(Y3 ~ 0 + X1 +
X2 +
X3 +
X4 +
(1 + X1 + X2 + X3 | p | Subject),
center = FALSE)
MV_Mod <- brm(fmla_y1 + fmla_y2 + fmla_y3 + set_rescor(rescor = FALSE),
family = bernoulli(),
data)
My attempt at the notation of this model is:
\begin{aligned}
\text{Y1}_i & \sim \operatorname{Bernoulli} (p_i) \\
\operatorname{logit} (p_i) & = \alpha^\text{1}_{Subject_i} + \beta_{1} \text{X1}_{i} +
\beta_{2} \text{X2}_{i} + \beta_{3} \text{X3}_{i} + \beta_{4} \text{X4}_{i} \\
\alpha_{Subject}^\text{1} & \sim \operatorname{Normal}(\overline{\alpha}^\text{1}_{Subject},\sigma_{Subject}) \\
\overline{\alpha}^\text{1}_{Subject} & \sim \operatorname{Normal}(0, 1) \\
\beta^\text{1}_{1,2,3,4} & \sim \operatorname{Normal}(0, 1) \\
\sigma_{Subject} & \sim \operatorname{Normal}(0, 1) \\
\text{Y2}_i & \sim \operatorname{Bernoulli} (p_i) \\
\operatorname{logit} (p_i) & = \alpha^\text{2}_{Subject_i} + \beta_{1} \text{X1}_{i} +
\beta_{2} \text{X2}_{i} + \beta_{3} \text{X3}_{i} + \beta_{4} \text{X4}_{i} \\
\alpha_{Subject}^\text{2} & \sim \operatorname{Normal}(\overline{\alpha}^\text{2}_{Subject},\sigma_{Subject}) \\
\overline{\alpha}^\text{2}_{Subject} & \sim \operatorname{Normal}(0, 1) \\
\beta^\text{2}_{1,2,3,4} & \sim \operatorname{Normal}(0, 1) \\
\sigma_{Subject} & \sim \operatorname{Normal}(0, 1) \\
\text{Y3}_i & \sim \operatorname{Bernoulli} (p_i) \\
\operatorname{logit} (p_i) & = \alpha^\text{3}_{Subject_i} + \beta_{1} \text{X1}_{i} +
\beta_{2} \text{X2}_{i} + \beta_{3} \text{X3}_{i} + \beta_{4} \text{X4}_{i} \\
\alpha_{Subject}^\text{3} & \sim \operatorname{Normal}(\overline{\alpha}^\text{3}_{Subject},\sigma_{Subject}) \\
\overline{\alpha}^\text{3}_{Subject} & \sim \operatorname{Normal}(0, 1) \\
\beta^\text{3}_{1,2,3,4} & \sim \operatorname{Normal}(0, 1) \\
\sigma_{Subject} & \sim \operatorname{Normal}(0, 1) \\
\begin{bmatrix} \alpha_{\text{Subject}}^\text{1} \\ \alpha_{\text{Subject}}^\text{2} \\ \alpha_{\text{Subject}}^\text{3} \\ \beta_{2} \\ \beta_{3} \\ \beta_{4} \end{bmatrix} & \sim \operatorname{MVNormal} \begin{pmatrix} \begin{bmatrix} \alpha^\text{1} \\ \alpha^\text{2} \\ \alpha^\text{3} \\ \beta_{2} \\ \beta_{3} \\ \beta_{4} \end{bmatrix}, \mathbf \Sigma \end{pmatrix} \\
\mathbf \Sigma & = \begin{bmatrix} \sigma_{\alpha^\text{1}} & 0 & 0 & 0 & 0 & 0 \\
0 & \sigma_{\alpha^\text{2}} & 0 & 0 & 0 & 0 \\
0 & 0 & \sigma_{\alpha^\text{3}} & 0 & 0 & 0 \\
0 & 0 & 0 & \sigma_{\beta_{2}} & 0 & 0 \\
0 & 0 & 0 & 0 & \sigma_{\beta_{3}} & 0 \\
0 & 0 & 0 & 0 & 0 & \sigma_{\beta_{4}} \\
\end{bmatrix} \mathbf R \begin{bmatrix} \sigma_{\alpha^\text{1}} & 0 & 0 & 0 & 0 & 0 \\
0 & \sigma_{\alpha^\text{2}} & 0 & 0 & 0 & 0 \\
0 & 0 & \sigma_{\alpha^\text{3}} & 0 & 0 & 0 \\
0 & 0 & 0 & \sigma_{\beta_{2}} & 0 & 0 \\
0 & 0 & 0 & 0 & \sigma_{\beta_{3}} & 0 \\
0 & 0 & 0 & 0 & 0 & \sigma_{\beta_{4}} \\ \end{bmatrix} \\
\mathbf{R} &\sim \text{LKJcorr}(1)
\end{aligned}
Any feedback would be greatly appreciated!
JLC
July 24, 2022, 10:35pm
2
I think perhaps this is more accurate?
\begin{aligned}
\text{Y1}_i & \sim \operatorname{Bernoulli} (p_i) \\
\operatorname{logit} (p_i) & = \alpha^\text{1}_{Subject_i} + \beta_{1} \text{X1}_{i} +
\beta_{2} \text{X2}_{i} + \beta_{3} \text{X3}_{i} + \beta_{4} \text{X4}_{i} \\
\alpha_{Subject}^\text{1} & \sim \operatorname{Normal}(\overline{\alpha}^\text{1}_{Subject},\sigma_{Subject}) \\
\overline{\alpha}^\text{1}_{Subject} & \sim \operatorname{Normal}(0, 1) \\
\beta^\text{1}_{1,2,3,4} & \sim \operatorname{Normal}(0, 1) \\
\sigma_{Subject} & \sim \operatorname{Normal}(0, 1) \\
\text{Y2}_i & \sim \operatorname{Bernoulli} (p_i) \\
\operatorname{logit} (p_i) & = \alpha^\text{2}_{Subject_i} + \beta_{1} \text{X1}_{i} +
\beta_{2} \text{X2}_{i} + \beta_{3} \text{X3}_{i} + \beta_{4} \text{X4}_{i} \\
\alpha_{Subject}^\text{2} & \sim \operatorname{Normal}(\overline{\alpha}^\text{2}_{Subject},\sigma_{Subject}) \\
\overline{\alpha}^\text{2}_{Subject} & \sim \operatorname{Normal}(0, 1) \\
\beta^\text{2}_{1,2,3,4} & \sim \operatorname{Normal}(0, 1) \\
\sigma_{Subject} & \sim \operatorname{Normal}(0, 1) \\
\text{Y3}_i & \sim \operatorname{Bernoulli} (p_i) \\
\operatorname{logit} (p_i) & = \alpha^\text{3}_{Subject_i} + \beta_{1} \text{X1}_{i} +
\beta_{2} \text{X2}_{i} + \beta_{3} \text{X3}_{i} + \beta_{4} \text{X4}_{i} \\
\alpha_{Subject}^\text{3} & \sim \operatorname{Normal}(\overline{\alpha}^\text{3}_{Subject},\sigma_{Subject}) \\
\overline{\alpha}^\text{3}_{Subject} & \sim \operatorname{Normal}(0, 1) \\
\beta^\text{3}_{1,2,3,4} & \sim \operatorname{Normal}(0, 1) \\
\sigma_{Subject} & \sim \operatorname{Normal}(0, 1) \\
\begin{bmatrix}
\alpha_{\text{Subject}}^\text{1} \\ \alpha_{\text{Subject}}^\text{2} \\ \alpha_{\text{Subject}}^\text{3} \\ \beta^\text{1}_{2} \\ \beta^\text{1}_{3} \\ \beta^\text{1}_{4} \\
\beta^\text{2}_{2} \\ \beta^\text{2}_{3} \\ \beta^\text{2}_{4} \\
\beta^\text{3}_{2} \\ \beta^\text{3}_{3} \\ \beta^\text{3}_{4}
\end{bmatrix}
& \sim \operatorname{MVNormal} \begin{pmatrix} \begin{bmatrix}
\alpha^\text{1} \\ \alpha^\text{2} \\ \alpha^\text{3} \\
\beta^\text{1}_{2} \\ \beta^\text{1}_{3} \\ \beta^\text{1}_{4} \\
\beta^\text{2}_{2} \\ \beta^\text{2}_{3} \\ \beta^\text{2}_{4} \\
\beta^\text{3}_{2} \\ \beta^\text{3}_{3} \\ \beta^\text{3}_{4}
\end{bmatrix}, \mathbf \Sigma \end{pmatrix} \\
\mathbf \Sigma & = \begin{bmatrix}
\sigma_{\alpha^\text{1}} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & \sigma_{\alpha^\text{2}} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & \sigma_{\alpha^\text{3}} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & \sigma_{\beta^\text{1}_{2}} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & \sigma_{\beta^\text{1}_{3}} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{1}_{4}} & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{2}_{2}} & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{2}_{3}} & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{2}_{4}} & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{3}_{2}} & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{3}_{3}} & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{3}_{4}} \\
\end{bmatrix}
\mathbf R \begin{bmatrix}
\sigma_{\alpha^\text{1}} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & \sigma_{\alpha^\text{2}} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & \sigma_{\alpha^\text{3}} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & \sigma_{\beta^\text{1}_{2}} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & \sigma_{\beta^\text{1}_{3}} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{1}_{4}} & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{2}_{2}} & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{2}_{3}} & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{2}_{4}} & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{3}_{2}} & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{3}_{3}} & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \sigma_{\beta^\text{3}_{4}} \\
\end{bmatrix} \\
\mathbf{R} &\sim \text{LKJcorr}(1)
\end{aligned}
This gets cut off a bit on desktop and almost entirely on mobile. Is there any way I can fix that?
Hello,
One thing that can help folks answer your question here is which part of the model or notation are you looking for feedback on? Is the model behaving well? Throwing errors?
thanks!
JLC
August 19, 2022, 5:39pm
4
The model works well and gives good estimates.
I’m just trying to figure out the notation for publication/dissemination.