Contrast coding for categorical outcome variable


assume you have a categorical model with an outcome variable y with three categories cat1, cat2, and cat3.
If you fit a categorical model in brms, you get back the coefficients for the intercepts and the input variables for every category (but the first one which is used as the reference category), that is: “mucat2_Intercept, mucat3_Intercept” and the same for each input variable of your model.

Is it possible to get coefficients directly for every category (category vs all others)?
Changing the contrasts option in R to “contr.sum” should not help in this case, right?
If I encode the outcome variable manually with one-hot encoding, do I have to use a multinomial fit instead of a categorical?

  • Operating System: Linux
  • brms Version: 2.9.0

Hi Anna!

The full set of regression coefficients is generally not identified in a Categorical/Multinomial regression. The usual way to handle this is to set one set of coefficients to zero, which brms does. You can also apply a sum-to-zero constraint or soft constrain the regression coefficients, as discussed in the Stan user’s guide. I’m not sure that this is possible in brms, but you could build your own model based on whatever brms::make_stancode gives you.

You might want to look into marginal effects, but I think there is no easy way to do this in brms yet, though I could be wrong (haven’t looked).

The Categorical and Multinomial distributions are the same in this case, just as the Bernoulli and Binomial distributions in the 1-dimensional case with N=1.