# Priors for hurdle models in brms

**URL:** https://discourse.mc-stan.org/t/priors-for-hurdle-models-in-brms/32501
**Category:** Modeling
**Tags:** priors, brms
**Created:** [August 20, 2023, 7:36pm UTC](https://discourse.mc-stan.org/t/priors-for-hurdle-models-in-brms/32501 "2023-08-20T19:36:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dgerth5](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/dgerth5/32/14200_2.png) [@dgerth5](https://discourse.mc-stan.org/u/dgerth5)
#### Post date: [August 20, 2023, 7:36pm UTC](https://discourse.mc-stan.org/t/priors-for-hurdle-models-in-brms/32501/1 "2023-08-20T19:36:51Z")

</div>

I am running a hurdle model using brms with the following code

```plaintext
# prior est for hurdle
sum(combin2$PA.y == 0) / length(combin$PA.y) # 0's occur 0.78
log(.22 / (1-.22))
# prior est for outcome 
log(mean(subset(combin2, PA.y > 0)$PA.y))

priors <- c(
  prior(normal(0, 1)),
  prior(normal(0, 1), dpar = "hu"), # Priors for regression coefficients
  prior(normal(-1.2, 0.25), class = "Intercept", dpar = "hu"), # Prior for the hurdle intercept
  prior(normal(7, 0.25), class = "Intercept") , # Prior for the outcome intercept
)

fit <- brm(bf(PA.y ~ BB + K + BABIP + ISO + GB + SwStr + wRC + Spd,
              hu ~ BB + K + BABIP + ISO + GB + SwStr + wRC + Spd),
           data = combin2,
           family = hurdle_negbinomial(),
           prior = priors,
           chains = 4,
           iter = 2000)

print(fit)

```

I am getting mostly reasonable coefficients, however the hu\_intercept coefficient is estimated to be 1.31, whereas the prior I set for it was N(-1.2,0.25). The mean of -1.2 was chosen because the PA.y column has 77% 0’s, and log(.23 / (1-.23)) = is -1.2. I guess my question is that I am surprised that when I specify a prior to be fairly tight around -1.2, that the final result is 1.31, and it makes me think that I am specifying something wrong in the brms code.

Thanks!

Data:  
[hurdle1.csv](https://discourse.mc-stan.org/uploads/short-url/gzUodUXZHFYFzWeVz08WOcQkxcY.csv) (359.4 KB)

---

<div class="post-metadata">

### Author: ![dgerth5](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/dgerth5/32/14200_2.png) [@dgerth5](https://discourse.mc-stan.org/u/dgerth5)
#### Post date: [August 20, 2023, 10:49pm UTC](https://discourse.mc-stan.org/t/priors-for-hurdle-models-in-brms/32501/2 "2023-08-20T22:49:39Z")

</div>

Additionally, here is a model where the binary component has no predictors. I thought for sure there would be a negative intercept here, but there was not.

> priors ← c(  
> prior(normal(0, 1)),  
> #prior(logistic(0, 1), dpar = “hu”), # Priors for regression coefficients  
> #prior(logistic(-1.2, 1), class = “Intercept”, dpar = “hu”), # Prior for the hurdle intercept  
> prior(normal(7, 1), class = “Intercept”) # Prior for the outcome intercept  
> )
> 
> fit ← brm(bf(PA.y ~ BB + K + BABIP + ISO + GB + SwStr + wRC + Spd,  
> hu ~ 1),  
> data = combin2,  
> family = hurdle\_negbinomial(),  
> prior = priors,  
> chains = 4,  
> iter = 2000)  
> ’

---

<div class="post-metadata">

### Author: ![jsocolar](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jsocolar/32/2486_2.png) [@jsocolar](https://discourse.mc-stan.org/u/jsocolar)
#### Post date: [August 21, 2023, 3:13pm UTC](https://discourse.mc-stan.org/t/priors-for-hurdle-models-in-brms/32501/3 "2023-08-21T15:13:50Z")

</div>

`hu` is the probability of being a zero, not the probability of clearing the hurdle.
