Posterior Predictive Checks After Sampling

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?


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.

1 Like

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.