How to set priors for discrete factor variables?

How to set priors for discrete factor variables?

Such as: age group, grade, that sorts. Where the number of participants in each group is known and the distribution of all participants to those discrete groups is modelled.

This is not necessarily “continuous” distribution, but “levelled”.

Stan’s gradient-based HMC sampler does not work with discrete unknown parameters. However, models that can be formulated in terms of discrete unknowns generally also admit a marginalized parameterization which Stan can sample (and usually this marginalized parameterization leads to substantially more reliable and faster fitting even in BUGS and other languages that do allow for discrete unknown parameters).

If you are able to post details of your model, we can take a look and see how that might be coded in Stan, and whether there is a way to encode the marginalized form in brms or not.

One ambiguity in your question is that you are asking about setting priors on a discrete parameter in brms, but brms doesn’t allow discrete parameters in the first place. So I suspect that the brms model on which you want to set a prior already is doing something different than what you intend.

1 Like