# Posterior Predictive Checks After Sampling

**URL:** <https://discourse.mc-stan.org/t/posterior-predictive-checks-after-sampling/3514>\
**Category:** Modeling\
**Created:** [March 8, 2018, 6:05pm UTC](https://discourse.mc-stan.org/t/posterior-predictive-checks-after-sampling/3514 "2018-03-08T18:05:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stablemarkets](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stablemarkets/32/10316_2.png) [@stablemarkets](https://discourse.mc-stan.org/u/stablemarkets)\
**Post date:** [March 8, 2018, 6:05pm UTC](https://discourse.mc-stan.org/t/posterior-predictive-checks-after-sampling/3514/1 "2018-03-08T18:05:52Z")

</div>

Hi all,

I have a binary outcome observed longitudinally. I specified a logistic model with a random intercept using Stan and got point and interval estimates of my odds ratios of interest.

When I originally ran the sampling, I didn’t write a generated quantities block. But now I want to go back and do some posterior predictive checks. I could write a generated quantities block using the existing \*\_rng functions, but I don’t want to re-do the sampling as it takes a while.

Is there any way I can write an additional Stan file with a generated quantities block and then feed it the posterior samples I already have so it won’t need to re-do the sampling?

Or am I stuck and need to redo the sampling?

Thanks!

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [March 8, 2018, 6:28pm UTC](https://discourse.mc-stan.org/t/posterior-predictive-checks-after-sampling/3514/2 "2018-03-08T18:28:00Z")

</div>

That is mostly implemented but not yet in a released version of Stan. For that model, it shouldn’t be too hard to draw from the posterior predictive distribution on the outside; just draw from a Bernoulli distribution with probability equal to the posterior probability.

---

<div class="post-metadata">

**Author:** ![stablemarkets](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stablemarkets/32/10316_2.png) [@stablemarkets](https://discourse.mc-stan.org/u/stablemarkets)\
**Post date:** [March 8, 2018, 6:47pm UTC](https://discourse.mc-stan.org/t/posterior-predictive-checks-after-sampling/3514/3 "2018-03-08T18:47:43Z")

</div>

Cool. I was hoping I wouldn’t have to resort to R and could instead take advantage of the C++ backend of Stan (I assume it’s faster). But I’ll do it!

Thanks a ton! Looking forward to this feature.

Arman

---

<div class="post-metadata">

**Author:** ![arthur-albuquerque](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/arthur-albuquerque/32/11331_2.png) [@arthur-albuquerque](https://discourse.mc-stan.org/u/arthur-albuquerque)\
**Post date:** [October 23, 2022, 10:11pm UTC](https://discourse.mc-stan.org/t/posterior-predictive-checks-after-sampling/3514/4 "2022-10-23T22:11:28Z")

</div>

Has it been implemented?
