# Posterior Predictive Checks

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?

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})