Setting priors for categorical models

  • Operating system: macOS Catalina 10.15.4
  • brms version: 2.12.0

Dear Stan community:

I am trying to fit a categorical model using brms, which is quite intuitive and useful for my question. However, I get stuck when trying to specify the priors for the model. I assume the model works by fitting multiple binomial models (one for each comparison with the reference category), so my intuition would be that setting a similar prior as one for a binomial model would work. However, I haven’t been able to find any literature to support this or tutorials/example code anywhere.

Thank you in advance!

Welcome to the community!

I would run the model with sample_priors="only" and then check how the combination of all priors and the likelihood looks like using pp_check(myModel, type="hist"). That way you will be able to see how the priors look like on the outcome scale. I always find it quite hard to reason about priors and, hence, opt for plotting as much as possible. If you get your priors for your model (maybe you need to add the data also),

p <- get_prior(y~x+z, family=categorical, sample_priors="only")

you can then set priors, e.g.,

p$prior[1] <- "normal(0,5)"

and then rerun the sampling (where you only sample from the priors). Don’t forget to include prior = p in the brm call.

1 Like

That is a great suggestion! Thank you for your help! :)

1 Like