Specifying priors on nonlinear regression coefficients brms

  • Operating System: Win 10
  • brms Version: 2.4.3

I have a nonlinear model in brm with a parameter eta that is a linear predictor. I’d like to put a shrinkage prior (e.g., horseshoe) on the regression coefficents and a normal prior on the intercept.

In a linear model, I would do this in the following manner:

prior=c(prior(normal(0,2.5),class=“Intercept”,prior(horseshoe(),class=“b”)))

For nonlinear, I hoped it would work the following way:

prior=c(prior(prior(normal(0,2.5),class=“Intercept”,nlpar=“eta”,prior(horseshoe(),class=“b”,nlpar=“eta”)))

But it doesn’t. I know the following works:

prior=c(prior(horseshoe(),nlpar=“eta”))

But it’s not proper to put shrinkage priors on the intercept. I know I can separate out terms in the following manner:

prior=c(prior(normal(0,2.5),coef=“Intercept”,nlpar=“eta”))

But it’s not clear to me how I can vectorize the prior on the remaining parameters associated with eta (specifically so I can use the horseshoe).

Any ideas how I can fix this?

In non-linear models, the intercept is part of class = "b" so you either have to include the intercept in the shrinkage or build some workaround. The code below will work only in the dev version of brms from github:

bform(
  response ~ int + rest
  int ~ 1,   # intercept only
  lf(rest ~ 0 + <my predictors>, cmc = FALSE) 
)

(cmc = FALSE deactivates automatic cell mean coding of factors if the intercept is removed from a formula). You may then set priors in int and rest separately.

1 Like