# Help converting brms notation to "standard" Bayesian mathematical notation

I’m a bit embarrassed to ask for help as it exposes me as a Bayesian charlatan, but I’d rather show weakness than be wrong! I am working on a project that utilizes a Bayesian hierarchical model via brms. I understand the brms notation - as well as the conceptual implications of that notation - but I’m finding that I am struggling to write out by hand the actual Bayesian model being fit. I’ve looked at both prior_summary() and stancode() for help, but would appreciate feedback from a real Bayesian.

My model may seem odd, but I’ve specified it the way I have for theoretical reasons (at least the random effects structure). I chose normal priors for the main effects to encourage shrinkage, but my choices of priors for class “sd” and class “cor” were per the examples in the brms manual. My model code is below.

  comp_ilr_c_pos <- brm(data = train, family = gaussian,
sigma ~ 1 + (1 | slug)),
prior=c(set_prior("normal(0, 10)", class="b"),
set_prior("cauchy(0, 2)", class="sd"),
set_prior("lkj(2)", class="cor")),
warmup=1000, iter=2250, chains=8,


Here is my attempt at writing out a representation of the model. I seem to have lost where the Cauchy prior lives for one of the sd parameters, and I’m not sure whether I’ve correctly represented the random effect structure. Note: i is an index for “slug”, k is an index for “opponent”, and j is an index for the jth observation of slug i.

y_{ij} \sim N(\mu_{ij},\sigma_i)
\mu_{ij}=\beta_0+\beta_1 \cdot x_{1ij}+\beta_2 \cdot x_{2ij} +\beta_{3k} \cdot x_{3ij}+\beta_{4k} \cdot x_{4ij} +\beta_{5k} \cdot x_{5ij} +\beta_{6k} \cdot x_{6ij}
\beta_p \sim N(0,10),\ p=1,2
\beta_{pk}=\beta_{0p}+\delta_k,p=3,..,6,\ k=1,\ldots,30,
\beta_{0p} \sim N(0,10)
\delta_k \sim t(3,\ 0,\ 7.3)
\beta_0 \sim t(3,\ 7.9,\ 7.3)
\sigma_i=\sigma_0+\gamma_i
\sigma_0 \sim t(3,\ 0,\ 2.5)
\gamma_i \sim Cauchy(0,2)

In case it helps, the output from prior_summary(comp_ilr_c_pos) is below. My apologies for the bad copy/paste job.

              prior     class              coef    group resp  dpar nlpar lb ub       source
normal(0, 10)         b                                                           user
normal(0, 10)         b             GS_10                                 (vectorized)
normal(0, 10)         b             MP_10                                 (vectorized)
student_t(3, 7.9, 7.3) Intercept                                                        default
student_t(3, 0, 2.5) Intercept                                 sigma                  default
lkj_corr_cholesky(2)         L                                                           user
lkj_corr_cholesky(2)         L                   opponent                        (vectorized)
cauchy(0, 2)        sd                                              0            user
student_t(3, 0, 7.3)        sd                                 sigma        0         default
cauchy(0, 2)        sd                   opponent                   0    (vectorized)
cauchy(0, 2)        sd            C_adj_opponent                   0    (vectorized)
cauchy(0, 2)        sd           PF_adj opponent                   0    (vectorized)
cauchy(0, 2)        sd            PG_adj opponent                   0    (vectorized)
cauchy(0, 2)        sd             SF_ad opponent                   0    (vectorized)
student_t(3, 0, 7.3)        sd                       slug      sigma        0    (vectorized)
student_t(3, 0, 7.3)        sd         Intercept     slug      sigma        0    (vectorized)


Any help is greatly appreciated!