The main idea behind posterior predictive checking is the notion that, if the model fits, then replicated data generated under the model should look similar to observed data.

** Replicating data **

Assume you have a model with unknown parameters . You fit to data and obtain the posterior distribution . Given that

we can simulate sets of replicated datasets from the fitted model by simulating elements from the joint posterior distribution and then for each , we simulate a dataset from the likelihood .

Notice that under simulation-based techniques to approximate posterior distributions, such as MCMC, we already have draws from the posterior distribution, and the only extra work is in simulating from for each draw from the posterior distribution.

** Test quantities and tail probabilities **

We measure the discrepancy between model and data by defining test quantities (or discrepancy measures) to compute aspects of the data we want to check. Then, the posterior predictive p-value (or Bayesian p-value), which is defined as the probability that the replicated data could be more extreme than the observed data, as measured by the test quantity is given by:

In contrast to the classical approach, the test statistic used to compute the Bayesian p-value can depend not only on data , but also on the unknown parameters . Hence, it does not require special methods for dealing with nuisance parameters. Also, a (bayesian) p-value is a posterior probability and can therefore be interpreted directly, although not as Pr(model is true|data).

** Choice of test statistics **

One important point in applied statistics is that one model can be adequate for some purposes and inadequate for others, so it is important to chose test statistics that check relevant characteristics of the model for a given application. One should protect against errors in the model that would lead to bad consequences regarding the objective under study. The choice of appropriate test statistics are therefore highly dependent on the specific problem at hand.

**References:**

[1] Gelman, A., Carlin, J. B., Stern, H. S., and Rubin, D. B. (2003). Bayesian data analysis. CRC press (chapter 6).