# Help: Translating ordered-logit w/ varying intercepts model into mathematical notation

Hi everyone,

brms code:

Outcome ~ 1 + A + F + mo(E) + mo(H) + P + S + (1 | id) + (1 | wave)


Where Outcome has 5 responses, E has 3, H has 4. Also, I have \approx 1000 individuals and 50 waves.

I have also specified the following priors (if any look fishy, please let me know):

prior(normal(0, 1.5), class = "Intercept")
prior(normal(0, 1), class = "b")
prior(exponential(2), class = "sd")
prior(dirichlet(rep(2, 2)), class = "simo", coef = "moedu1")
prior(dirichlet(rep(2, 3)), class = "simo", coef = "moinc1")


I think that this is almost correct, but I don’t know if I’ve include the varying intercepts properly:

Outcome_{i} \sim \text{Ordered-logit}(\phi_{i}, \kappa)

\phi_{i} = \beta_{A}A_{i} + \beta_{F}F_{i} + \beta_{E} \sum_{n = 1}^{E_{i}}\zeta_{n} + \beta_{H} \sum_{m = 1}^{H_{i}}\zeta_{m} + \beta_{P}P_{i} + \beta_{S}S_{i}

\beta_{A}, \beta_{F}, \beta_{E}, \beta_{H}, \beta_{P}, \beta_{S} \sim \text{Normal}(0, 1)

\zeta_{b} \sim \text{Dirichlet}(\alpha_{E})

\zeta_{m} \sim \text{Dirichlet}(\alpha_{H})

\alpha_{E} = \left \{ 2, 2 \right \}

\alpha_{H} = \left \{ 2, 2, 2 \right \}

\kappa_k = \gamma_{ID\left [ i \right ]} + \tau_{WAVE\left [ i \right ]}

\gamma_{j} \sim \text{Normal}(\bar{\gamma}, \sigma_{\gamma}), \text{for } j = 1..1000

\tau_{j} \sim \text{Normal}(\bar{\tau}, \sigma_{\gamma}), \sigma_{\gamma}), \text{for } j = 1..50

\bar{\gamma}, \bar{\tau} \sim \text{Normal}(0, 1.5)

\sigma_{\gamma}, \sigma_{\tau} \sim \text{Exponential}(2)

Does it help if you look at the Stan code of the model via stancode(<model>)?