# Prior predictive simulation gives unreasonable results for lognormal() brms model

**URL:** <https://discourse.mc-stan.org/t/prior-predictive-simulation-gives-unreasonable-results-for-lognormal-brms-model/16914>\
**Category:** brms\
**Created:** [July 23, 2020, 8:44am UTC](https://discourse.mc-stan.org/t/prior-predictive-simulation-gives-unreasonable-results-for-lognormal-brms-model/16914 "2020-07-23T08:44:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![di4oi4](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@di4oi4](https://discourse.mc-stan.org/u/di4oi4)\
**Post date:** [July 23, 2020, 8:44am UTC](https://discourse.mc-stan.org/t/prior-predictive-simulation-gives-unreasonable-results-for-lognormal-brms-model/16914/1 "2020-07-23T08:44:53Z")

</div>

I am struggling to set reasonable weak priors for my lognormal brms model. I read that prior predictive simulation is a good way to play with different prior values and define reasonable ones for publishing.

Model

```
model = brm(bf(received_treatment_hours ~ treatment_method + offer + ( 1 | region)), data = data_no_zeros, family = lognormal(), cores = 3, chains = 3, sample_prior = "only", prior = prior)

```

_Prior knowledge about the outcome variable is that it ranges from 1-130 hours and 98% of patients has this value under 30 hours. Thus, weakly prior should exclude differences over 50 hours or something. I also know that my priors are on log() scale._

Model default priors using get\_prior() argument

```
## prior class coef group resp dpar nlpar bound
## 1 b                                               
## 2 b offer                             
## 3 b treatment_methodB                             
## 4 b treatment_methodC                             
## 5 b treatment_methodD                             
## 6 b treatment_methodE                             
## 7 b treatment_methodF                             
## 8 student_t(3, 2, 10) Intercept                                               
## 9 student_t(3, 0, 10) sd                                               
## 10 sd region                      
## 11 sd Intercept region                      
## 12 student_t(3, 0, 10) sigma

```

I tried different values for class b prior, finishing with very low value

```
prior = c(
prior(student_t(3, 0, 0.01), class = b),
prior(student_t(3, 0, 10), class= sd),
prior(student_t(3, 8, 10), class = Intercept))

```

But the result still looks unreasonable, including extremely wide CIs.

```
plot(conditional_effects(model, method = "predict"), points = TRUE, ask = FALSE)

```

 ![1](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/4/4a49f0297022f6a30cca5521b431d041acbad706.png)

 ![2](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/3/3246ea8fe618ddbca2e3bf37201fb674cd22092e.png)

**What am I doing wrong? How to get prior predictive simulation plots with reasonable CI widths?**

Data and Rmd file: [https://www.dropbox.com/sh/2kwpmxip99hvkes/AAAn90mmKmiPdUzJrF2zUE0sa?dl=0](https://www.dropbox.com/sh/2kwpmxip99hvkes/AAAn90mmKmiPdUzJrF2zUE0sa?dl=0)

---

<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:** [July 23, 2020, 8:48am UTC](https://discourse.mc-stan.org/t/prior-predictive-simulation-gives-unreasonable-results-for-lognormal-brms-model/16914/2 "2020-07-23T08:48:39Z")

</div>

Using independent priors it is almost impossible to get reasonable prior predictive checks for models specifying the predictor term on the log-scale due to the resulting exponentiation. We are actively working on developing joint priors for such models so that you actually get reasonable priors and prior predictive checks in the end but this will take some more time.

---

<div class="post-metadata">

**Author:** ![di4oi4](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@di4oi4](https://discourse.mc-stan.org/u/di4oi4)\
**Post date:** [July 23, 2020, 8:52am UTC](https://discourse.mc-stan.org/t/prior-predictive-simulation-gives-unreasonable-results-for-lognormal-brms-model/16914/3 "2020-07-23T08:52:57Z")

</div>

Thank you! Would it be OK to use brms defaults for publishing? Model comparisons using loo() argument clearly preferred lognormal() model. Also, it had the best fit using pp\_check() argument.

---

<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:** [July 23, 2020, 8:57am UTC](https://discourse.mc-stan.org/t/prior-predictive-simulation-gives-unreasonable-results-for-lognormal-brms-model/16914/4 "2020-07-23T08:57:30Z")

</div>

I cannot tell you what is ok for publishing your data and analysis but is should be fine to go with default priors if the posterior and posterior predictive look sensible.

---

<div class="post-metadata">

**Author:** ![martinmodrak](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/martinmodrak/32/133_2.png) [@martinmodrak](https://discourse.mc-stan.org/u/martinmodrak)\
**Post date:** [July 25, 2020, 1:42pm UTC](https://discourse.mc-stan.org/t/prior-predictive-simulation-gives-unreasonable-results-for-lognormal-brms-model/16914/5 "2020-07-25T13:42:26Z")

</div>

Also, it is IMHO often reasonable to fit the model with a set of different priors and see how the inferences change. If they do not, no need to worry about prior choice.
