Prior Truncation in brms [lb,ub]

Hi there,

Is there an inconsistency or limited application in the brms model priors and other functions??

When defining priors, it is technically allowed to truncate the priors of a model parameter class, e.g. like this

prior <- c(prior(student_t(1, 0, 1), class = b, lb=-4, ub=4))

but also to specify priors for single coefficients in a model:

prior <- c(prior(student_t(1, 0, 1), class = b, coef=IndepVariable))

What is not allowed (as indicated by an error message) is this:

prior <- c(prior(student_t(1, 0, 1.5), class = b, coef=IndepVariable, lb=-4, ub=4))

Why?
Or maybe I should ask: Is it possible to change this in future versions? :)

Here are some reasons for why I think this needs to be possible:

  1. Defining the priors for every parameter properly seems to be a prerequisite of some other functions like hypothesis() or nlf(). And it seems to me, that some hypotheses tests (e.g. hypothesis(model, ā€œIndepVariable==0ā€) cannot be done with truncated priors because of the coding restriction.

  2. in logistic models it is, in some cases, almost meaningless to have samples smaller than -5 or larger than 5 because they are parameters on a log scale. This might be moreover parameter specific in more complex models (e.g. a large +intercept basically excludes large additional effects like +5 on a log-scale).

  3. Negative values of some -specific- parameters in regressions are a priori meaningless (e.g. of ā€˜growth rateā€™ ), but still normally distributed (that is, one can not use gamma distributions), and currently it seems not possible to specify such a priori assumptions without willingly miss-specifying the model.

I currently run a model with such priors, just to see what happensā€¦

prior <- c(prior(student_t(1, 0, 1.5), class = b, lb=-4, ub=4),
           prior(student_t(1, 0, 1.5), class = b, coef=IndepVariable))

Intuitively I guess this will not lead to a truncated prior for IndepVariable

Best, RenƩ

Thatā€™s because brms defines regression coefficients as a single vector, which can only have a common lower and upper boundary (if I am not mistaken). Splitting up these vectors in brms automatically would be a tone of programming work that I donā€™t want to invest since there is an easy workaround using brmsā€™ non-linear syntax.

bform <- bf(
  y ~ a + b, nl = TRUE,
  lf(a ~ <other predictors>, center = TRUE),
  lf(b ~ 0 + IndepVariable, cmc = FALSE)
)
1 Like

Hi Paul,

thank you very much for your reply. Itā€™s great that there is a workaround, but I regret to say, I do not understand it. :) Mostly because, I do not know (where to look at) how this formula-definition relates to a prior definition, or to the implication that some priors are acceptable in brm while others are not, depending on the bf formula I define. (This also seems not to be the right thinking of me because I can use the prior() function (giving me the mentioned error message) without even defining a model.

Edit:
Ahā€¦ no waitā€¦ I got it :)
so my part in this solution would be connecting the above model to the ā€˜dparā€™ prior, right?
(This was not too obvious, never having seen the lf() before ;))

 prior(student(1, 0,1), dpar = IndepVariable, lb = -4, ub = 4))

Best, RenƩ

See https://discourse.mc-stan.org/t/horseshoe-prior-on-subset-of-predictors/8140/8 for a similar problem and corresponding solution.

Thanks again. :) Are there any issues in defining nlpar priors in lf() functions one should know?
Otherwise, I guess this is solved. Thank you.

Not that I am aware of.

Just for the record:
A prior definition (ā€œnormalā€ brm model) like this:

 c(prior(student_t(1, 3, 1.5), class = b, lb=0,ub=5),
   prior(student_t(1, 0, 1), class = b, coef=IndepVariable))

Actually yields a zero-truncated positive prior for IndepVariable with mean=0 (according to prior_samples() ). Have no idea how or why it works this way, but it works :). In other words, the general truncation for class=b is taken over to other more specific priors such as the coef-prior below, without taking overwriting the distribution for the coef-prior.
So this seems nice for cases in which there are no other relevant priors that would be cut-off this way, ā€¦ and the above definition would give the same prior for IndepVariable as:

prior(student_t(1, 0, 1), class = b, coef=IndepVariable, lb=0, ub=5)

If it was allowed to define it this way.

Best, RenƩ