Looks good to me.
Yeah. There are two intercept terms there. One corresponding to the population intercept and then the group level intercepts. sd(Intercept) is the one corresponding to the standard deviation of the group level intercepts.
This doesn’t really help with the sd(Intercept) question, but when I have questions with brms models I like to just generate the code and look at what is happening.
So something like:
library(tidyverse)
library(brms)
data = tibble(subject = c(1, 1, 1, 2, 2, 2, 3, 3, 3),
y = exp(rnorm(9)),
b1 = rnorm(9),
b2 = rnorm(9),
b3 = rnorm(9))
make_stancode(y ~ b1 + b2 + b3 + (1|subject),
data = data,
family = 'lognormal')
The model bit with the priors taken out is:
model {
// initialize linear predictor term
vector[N] mu = Intercept + Xc * b;
for (n in 1:N) {
// add more terms to the linear predictor
mu[n] += r_1_1[J_1[n]] * Z_1_1[n];
}
// priors including all constants
...
// likelihood including all constants
if (!prior_only) {
target += lognormal_lpdf(Y | mu, sigma);
}
}
From that you can try to break down if the formula you gave brms is getting you the model you expect.