I think you’ll find the function get_prior()
really useful here.
When you are just estimating one number for sigma, you can set class="sigma"
. But when you are estimating how this changes in a distributional regression framework, things change. You instead have an Intercept and beta parameters just like modelling the mean, and you have to specify which parameter your priors are for using the dpar =
argument.
Look at this example with the built-in iris
dataset
# Loading iris data and
data(iris)
contrasts(iris$Species) <- contr.sum(3)
# Specifiying distributional model formula
mf <- bf(Sepal.Length ~ Species,
sigma ~ Species)
# Checking which priors can be set
# Checking which priors can be set
get_prior(mf,
data = iris,
skew_normal())
prior class coef group resp dpar nlpar lb ub source
(flat) b default
(flat) b Species1 (vectorized)
(flat) b Species2 (vectorized)
student_t(3, 5.8, 2.5) Intercept default
(flat) b sigma default
(flat) b Species1 sigma (vectorized)
(flat) b Species2 sigma (vectorized)
student_t(3, 0, 2.5) Intercept sigma default
Now, you don’t need to set priors on all of these, these are just the options available. I also point out that the default for the skew_normal
family is to have sigma
on the log scale. You can change this if you wish by having skew_normal(link_sigma="identity")
.
Also, it’s a good thing to know that class = "Intercept"
is not setting a prior on the Intercept as it is generally interpreted, but instead on the centered design matrix. This may or may not be important depending on how balanced your data is. This is in the documentation, but instead I learned it very publicly here: