# Posterior Predictive Checks

**URL:** <https://discourse.pymc.io/t/posterior-predictive-checks/3293>\
**Category:** Questions\
**Created:** [May 19, 2019, 10:25am UTC](https://discourse.pymc.io/t/posterior-predictive-checks/3293 "2019-05-19T10:25:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Deora](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/rahul_deora/32/1866_2.png) [@Rahul\_Deora](https://discourse.pymc.io/u/Rahul_Deora)\
**Post date:** [May 19, 2019, 10:25am UTC](https://discourse.pymc.io/t/posterior-predictive-checks/3293/1 "2019-05-19T10:25:02Z")

</div>

In [https://docs.pymc.io/notebooks/posterior\_predictive.html](https://docs.pymc.io/notebooks/posterior_predictive.html)

> This function will randomly draw 500 samples of parameters from the trace. Then, for each sample, it will draw 100 random numbers from a normal distribution specified by the values of `mu` and `std` in that sample.
> 
> ppc = pm.sample\_posterior\_predictive(trace, samples=500, model=model)
> 
> Now, `ppc` contains 500 generated data sets (containing 100 samples each), each using a different parameter setting from the posterior:

Why does it sample 100 if the samples are already in the trace? And what does " specified by the values of `mu` and `std` in that sample" mean? Is it the input values?

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [May 19, 2019, 2:40pm UTC](https://discourse.pymc.io/t/posterior-predictive-checks/3293/2 "2019-05-19T14:40:20Z")

</div>

there are two kinds of samples here - posterior samples which are representation of your posterior distribution; and prediction conditioned on the posterior samples. The first one is:  
\pi(\theta\_{posterior}) = \pi(\theta \mid y, \theta\_{prior}), and the second one is \pi(\hat{y} \mid \theta\_{posterior})
