# Posterior predictive distribution

{{ safesubst:#invoke:Unsubst||$N=Refimprove |date=__DATE__ |$B=
{{#invoke:Message box|ambox}}
}}
In statistics, and especially Bayesian statistics, the **posterior predictive distribution** is the distribution of unobserved observations (prediction) conditional on the observed data.^{[1]} Described as the distribution that a new i.i.d. data point would have, given a set of *N* existing i.i.d. observations . In a frequentist context, this might be derived by computing the maximum likelihood estimate (or some other estimate) of the parameter(s) given the observed data, and then plugging them into the distribution function of the new observations.

However, the concept of posterior predictive distribution is normally used in a Bayesian context, where it makes use of the entire posterior distribution of the parameter(s) given the observed data to yield a probability distribution over an interval rather than simply a point estimate. Specifically, it is computed by marginalising over the parameters, using the posterior distribution:

where represents the parameter(s) and the hyperparameter(s). Any of may be vectors (or equivalently, may stand for multiple parameters).

Note that this is equivalent to the expected value of the distribution of the new data point, when the expectation is taken over the posterior distribution, i.e.:

(To get an intuition for this, keep in mind that expected value is a type of average. The predictive probability of seeing a particular value of a new observation will vary depending on the parameters of the distribution of the observation. In this case, we don't know the exact value of the parameters, but we have a posterior distribution over them, that specifies what we believe the parameters to be, given the data we've already seen. Logically, then, to get "the" predictive probability, we should average all of the various predictive probabilities over the different possible parameter values, weighting them according to how strongly we believe in them. This is exactly what this expected value does. Compare this to the approach in frequentist statistics, where a single estimate of the parameters, e.g. a maximum likelihood estimate, would be computed, and this value plugged in. This is equivalent to averaging over a posterior distribution with no variance, i.e. where we are completely certain of the parameter having a single value. The result is weighted too strongly towards the mode of the posterior, and takes no account of other possible values, unlike in the Bayesian approach.)

## Prior vs. posterior predictive distribution

The **prior predictive distribution**, in a Bayesian context, is the distribution of a data point marginalized over its prior distribution. That is, if and , then the prior predictive distribution is the corresponding distribution , where

Note that this is similar to the posterior predictive distribution except that the marginalization (or equivalently, expectation) is taken with respect to the prior distribution instead of the posterior distribution.

Furthermore, if the prior distribution is a conjugate prior, then the posterior predictive distribution will belong to the same family of distributions as the prior predictive distribution. This is easy to see. If the prior distribution is conjugate, then

i.e. the posterior distribution also belongs to but simply with a different parameter instead of the original parameter Then,

Hence, the posterior predictive distribution follows the same distribution *H* as the prior predictive distribution, but with the posterior values of the hyperparameters substituted for the prior ones.

The prior predictive distribution is in the form of a compound distribution, and in fact is often used to *define* a compound distribution, because of the lack of any complicating factors such as the dependence on the data and the issue of conjugacy. For example, the Student's t-distribution can be *defined* as the prior predictive distribution of a normal distribution with known mean *μ* but unknown variance *σ _{x}^{2}*, with a conjugate prior scaled-inverse-chi-squared distribution placed on

*σ*, with hyperparameters

_{x}^{2}*ν*and

*σ*. The resulting compound distribution is indeed a non-standardized Student's t-distribution, and follows one of the two most common parameterizations of this distribution. Then, the corresponding posterior predictive distribution would again be Student's t, with the updated hyperparameters that appear in the posterior distribution also directly appearing in the posterior predictive distribution.

^{2}Note in some cases that the appropriate compound distribution is defined using a different parameterization than the one that would be most natural for the predictive distributions in the current problem at hand. Often this results because the prior distribution used to define the compound distribution is different from the one used in the current problem. For example, as indicated above, the Student's t-distribution was defined in terms of a scaled-inverse-chi-squared distribution placed on the variance. However, it is more common to use an inverse gamma distribution as the conjugate prior in this situation. The two are in fact equivalent except for parameterization; hence, the Student's t-distribution can still be used for either predictive distribution, but the hyperparameters must be reparameterized before being plugged in.

## In exponential families

Most, but not all, common families of distributions belong to the exponential family of distributions. Exponential families have a large number of useful properties. One of which is that all members have conjugate prior distributions — whereas very few other distributions have conjugate priors.

### Prior predictive distribution in exponential families

Another useful property is that the probability density function of the compound distribution corresponding to the prior predictive distribution of an exponential family distribution marginalized over its conjugate prior distribution can be determined analytically. Assume that is a member of the exponential family with parameter that is parametrized according to the natural parameter , and is distributed as

while is the appropriate conjugate prior, distributed as

Then the prior predictive distribution (the result of compounding with ) is

The last line follows from the previous one by recognizing that the function inside the integral is the density function of a random variable distributed as , excluding the normalizing function . Hence the result of the integration will be the reciprocal of the normalizing function.

The above result is independent of choice of parametrization of , as none of , and appears. (Note that is a function of the parameter and hence will assume different forms depending on choice of parametrization.) For standard choices of and , it is often easier to work directly with the usual parameters rather than rewrite in terms of the natural parameters.

Note also that the reason the integral is tractable is that it involves computing the normalization constant of a density defined by the product of a prior distribution and a likelihood. When the two are conjugate, the product is a posterior distribution, and by assumption, the normalization constant of this distribution is known. As shown above, the density function of the compound distribution follows a particular form, consisting of the product of the function that forms part of the density function for , with the quotient of two forms of the normalization "constant" for , one derived from a prior distribution and the other from a posterior distribution. The beta-binomial distribution is a good example of how this process works.

Despite the analytical tractability of such distributions, they are in themselves usually not members of the exponential family. For example, the three-parameter Student's t distribution, beta-binomial distribution and Dirichlet-multinomial distribution are all predictive distributions of exponential-family distributions (the normal distribution, binomial distribution and multinomial distributions, respectively), but none are members of the exponential family. This can be seen above due to the presence of functional dependence on . In an exponential-family distribution, it must be possible to separate the entire density function into multiplicative factors of three types: (1) factors containing only variables, (2) factors containing only parameters, and (3) factors whose logarithm factorizes between variables and parameters. The presence of makes this impossible unless the "normalizing" function either ignores the corresponding argument entirely or uses it only in the exponent of an expression.

### Posterior predictive distribution in exponential families

As noted above, when a conjugate prior is being used, the posterior predictive distribution belongs to the same family as the prior predictive distribution, and is determined simply by plugging the updated hyperparameters for the posterior distribution of the parameter(s) into the formula for the prior predictive distribution. Using the general form of the posterior update equations for exponential-family distributions (see the appropriate section in the exponential family article), we can write out an explicit formula for the posterior predictive distribution:

where

This shows that the posterior predictive distribution of a series of observations, in the case where the observations follow an exponential family with the appropriate conjugate prior, has the same probability density as the compound distribution, with parameters as specified above.

Note in particular that the observations themselves enter only in the form
This is termed the *sufficient statistic* of the observations, because it tells us everything we need to know about the observations in order to compute a posterior or posterior predictive distribution based on them (or, for that matter, anything else based on the likelihood of the observations, such as the marginal likelihood).

### Joint predictive distribution, marginal likelihood

It is also possible to consider the result of compounding a joint distribution over a fixed number of independent identically distributed samples with a prior distribution over a shared parameter. In a Bayesian setting, this comes up in various contexts: computing the prior or posterior predictive distribution of multiple new observations, and computing the marginal likelihood of observed data (the denominator in Bayes' law). When the distribution of the samples is from the exponential family and the prior distribution is conjugate, the resulting compound distribution will be tractable and follow a similar form to the expression above. It is easy to show, in fact, that the joint compound distribution of a set for observations is

This result and the above result for a single compound distribution extend trivially to the case of a distribution over a vector-valued observation, such as a multivariate Gaussian distribution.

## Relation to Gibbs sampling

Note also that collapsing out a node in a collapsed Gibbs sampler is equivalent to compounding. As a result, when a set of independent identically distributed (i.i.d.) nodes all depend on the same prior node, and that node is collapsed out, the resulting conditional probability of one node given the others as well as the parents of the collapsed-out node (but not conditioning on any other nodes, e.g. any child nodes) is the same as the posterior predictive distribution of all the remaining i.i.d. nodes (or more correctly, formerly i.i.d. nodes, since collapsing introduces dependencies among the nodes). That is, it is generally possible to implement collapsing out of a node simply by attaching all parents of the node directly to all children, and replacing the former conditional probability distribution associated with each child with the corresponding posterior predictive distribution for the child conditioned on its parents and the other formerly i.i.d. nodes that were also children of the removed node. For an example, for more specific discussion and for some cautions about certain tricky issues, see the Dirichlet-multinomial distribution article.