I want to fit a distributional model with brms along the following lines:
df <- data.frame() # some columns include: value (continuous, zero-mean), afactor (3 levels), bfactor (7 levels), ...
frml <- bf(
value ~ 0 + Intercept,
sigma ~ 0 + Intercept + afactor * bfactor
)
priors <- c(
set_prior("normal(0,0.1)", class = "b", dpar = ""),
set_prior("normal(0,0.1)", class = "b", coef = "Intercept", dpar = ""),
set_prior("normal(0,20)", class = "b", dpar = "sigma", lb = 0),
set_prior("normal(0,40)", class = "b", coef = "Intercept", dpar = "sigma")
)
bfit <- brm(
frml,
data = df,
family = gaussian(),
prior = priors
)
Importantly, I want to set a prior so that sigma is biased to be zero.
The gaussian family in brms uses a log link for sigma. My understanding is that putting this together with my last two priors above results in a sigma whose prior biases sigma to be 1. However, I want the prior on sigma to bias it towards 0.
That is, if the identity link could be used for sigma (which I realize can create issues with negative sigma), I would want to set the priors to be half normal distributions. Alternatively, I’m open to using a log link on sigma while specifying a prior which is the log of a half normal distribution. Any ideas about how to achieve this?
