I know there’s two previous posts on a similar subject, but there were not helpful to me.

I’m trying to run a model with a categorical family. My original outcome has only two responses (healthy, or has a certain disease). I’m trying to calculate the risk of having the disease, based on various numerical factors, and the nominal variable of sex (male and female). My hope was to run the regression and then extract odds ratios. I was wanting to set subjective priors, but I always get the error message that the priors I have set do not correspond to any within the model. When I consult prior_summary() or get_priors(), I get the exact same names as I have in my set_prior() code.

I’ve produced a repex for you with the iris data. My operating system is Mac OS 14.1.1, with brms version 2.20.4.

irismodel <- brm(data=iris,family=categorical("logit",refcat = "virginica"),Species~1+Sepal.Width+Sepal.Length, prior=set_prior("normal(0,1)",class="b",coef="Sepal.Width"),sample_prior=TRUE)
Error: The following priors do not correspond to any model parameter:
b_Sepal.Width ~ normal(0,1)
Function 'get_prior' might be helpful to you.

My guess is that I’m missing some theoretical background knowledge to help me understand my problem. If anyone could point me in the correct direction for further reading and/or help me with a piece of code to solve my problem, I would be ever so grateful.

With the categorical family, each outcome category (except for the reference level) gets its own set of coefficients. So Sepal.Width in the model formula actually results in two different coefficients in the model, each with its own prior. set_prior uses the dpar (“distributional parameter”) argument to specify these separate predictors. In your example, the prior would be set as follows:

For binary and ordinal logistic models the R rmsb package’s blrm function provides a way to specify priors on a set of user-specified contrasts, and these priors on contrasts are automatically propagated by Stan back to the original model coefficients. This provides a natural and flexible way to specify priors without the user needing to be aware of the model’s parameterization (choice of reference cell, for example). Examples are here.