# Interpretation of priors on nonlinear parameters

**URL:** <https://discourse.mc-stan.org/t/interpretation-of-priors-on-nonlinear-parameters/8893>\
**Category:** brms\
**Created:** [May 21, 2019, 7:37am UTC](https://discourse.mc-stan.org/t/interpretation-of-priors-on-nonlinear-parameters/8893 "2019-05-21T07:37:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Koalha](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/koalha/32/4849_2.png) [@Koalha](https://discourse.mc-stan.org/u/Koalha)\
**Post date:** [May 21, 2019, 7:37am UTC](https://discourse.mc-stan.org/t/interpretation-of-priors-on-nonlinear-parameters/8893/1 "2019-05-21T07:37:09Z")

</div>

- Operating System: Ubuntu 18.04
- brms Version: 2.8.0

In linear brms models, priors are set on “an intercept that results when internally centering all population-level predictors around zero to improve sampling efficiency”.(set\_prior() documentation).

From what I’ve read, nonlinear models in brms work pretty differently from linear models. For example, the intercepts of nonlinear models are of class “b” instead of class “Intercept”. Say I have this simple nonlinear model:

## Mock data

dd \<- data.frame(x=1:100, y = 1:100 + rnorm(100,0,1), z = rnorm(100,10,1), g = sample(1:10,100, replace = TRUE))

## Group-level intercepts

dd$y \<- dd$y + dd$g

nlform \<- bf(y~x,  
x~(1|g) + z,  
nl = TRUE)

prior \<- c(  
prior(“normal(0,10)”, class = “b”, coef = “z”, nlpar = “x”),  
prior(“normal(0,10)”, class = “b”, coef = “Intercept”, nlpar = “x”)  
)

nlmod \<- brm(nlform, prior = prior, data = dd, sample\_prior = TRUE)

Am I setting the prior in the intercept of x in the centered or non-centered parametrization? In other words, is the prior set for when z = 0 or z ~= 10?

---

<div class="post-metadata">

**Author:** ![paul.buerkner](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/paul.buerkner/32/3303_2.png) [@paul.buerkner](https://discourse.mc-stan.org/u/paul.buerkner)\
**Post date:** [May 21, 2019, 7:55am UTC](https://discourse.mc-stan.org/t/interpretation-of-priors-on-nonlinear-parameters/8893/2 "2019-05-21T07:55:56Z")

</div>

When using the non-linear syntax of brms as in your example, there will be no automatic centering of predictors of non-linear parameters. In the github version of brms you may activate centering by replacing `x~(1|g) + z` by `lf(x~(1|g) + z, center = TRUE)`.

---

<div class="post-metadata">

**Author:** ![Koalha](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/koalha/32/4849_2.png) [@Koalha](https://discourse.mc-stan.org/u/Koalha)\
**Post date:** [May 21, 2019, 8:10am UTC](https://discourse.mc-stan.org/t/interpretation-of-priors-on-nonlinear-parameters/8893/3 "2019-05-21T08:10:16Z")

</div>

Thank you! I now see that this information was available in the documentation of brmsformula and the argument center, I just didn’t find it.
