# How to set priors for every level in a categorical variable (no reference level )

I have a variable “empirical” and it has two category levels, TRUE and FALSE. When put into the brms model, I only need to set prior and will get coeff for “empiricalTRUE” since “empiricalFALSE” is deemed the reference level.

How can I treat them as two parallel levels? Like I can set priors for empiricalTRUE and empiricalFALSE.

I aim to set same priors. I just don’t want to assume the empiricalTRUE has a bigger variability than empiricalFALSE.

Can you explain what you are trying to do? I don’t quite understand how a category can have a variance unless you are referring to a parameter that describes that category.

Additionally, the variability (variance?) of one category will directly affect the variability of the other (they are equal), so it seems safe to say that you aren’t assuming the variability of one is greater than the other.

Yes, but that does not have to be true for the (prior on the) coefficients on those categories.

In this specific case,

Let’s say you estimate a model of the form

y = \alpha_0 + \alpha_1 TRUE.
with priors \alpha_0 \sim \textrm{normal}(0,1) and \alpha_1 \sim \textrm{normal}(0,1)

The implied prior for the average in the FALSE category is \textrm{normal}(0,1) and the implied prior for the TRUE category is \textrm{normal}(0,\sqrt{1^2 + 1^2}).

The way to solve this problem is to either use a model y = \alpha_{[i]} with two categories or to parametrise TRUE as a new variable which is -.5 for FALSE and .5 for TRUE.

1 Like

Hi Stijn,

Thank you for your reply. I was wondering if I create a new variable why it would be -0.5 and 0.5 for the two categories.
My current approach is this: I have two categorical variables in my predictors, let’s say they are empirical (TRUE/FALSE) and status (alive/dead).
I remove the intercept by adding 0 to the model and then create a new variable status_alive to have alive as 1 and dead as 0, likewise status_dead to have dead as 1 and alive as 0.
Now my model of response ~ 0 + empirical + status_alive + status_dead would have coeff: empiricalFALSE, empiricalTRUE , status_alive, status_dead, which is what I want.
What do you think

Angel

That seems right to me. Your solution is equivalent to my first proposed solution if I understand it correctly.

The -.5 and .5 solution is just one option. You just want the numbers to add up to 0. .5 is convenient because the coefficient than reflects the difference between the two groups.