Algorithm Search⌘K

Definitioncore

Posterior predictive distribution

Also called predictive distribution.

The distribution of a new observation given the data, the model density averaged over the posterior of the parameters.

The posterior predictive distribution is the law of a new observation YY given the observed data xx. It averages the model density f(y∣θ)f(y \mid \theta) over the posterior of θ\theta: p(y∣x)=∫f(y∣θ) π(dθ∣x)p(y \mid x) = \int f(y \mid \theta)\, \pi(d\theta \mid x). It carries two kinds of uncertainty, the scatter of YY around its mean and the uncertainty about θ\theta, so it is wider than the plug-in law f(y∣θ^)f(y \mid \hat\theta). It is how a Bayesian predicts, and it is the reference law for posterior predictive checks of a model.

Definition

Let X=(X1,…,Xn)X = (X_1, \ldots, X_n) and a future YY be conditionally independent given θ\theta, with Xi∣θX_i \mid \theta having density f(x∣θ)f(x \mid \theta) and Y∣θY \mid \theta having density g(y∣θ)g(y \mid \theta) (often g=fg = f). Let π(dθ∣x)\pi(d\theta \mid x) be the posterior from a prior π\pi, as in Bayesian inference.

  • The posterior predictive distribution of YY has density
p(y∣x)=∫Θg(y∣θ) π(dθ∣x).p(y \mid x) = \int_\Theta g(y \mid \theta)\, \pi(d\theta \mid x).

It is the conditional law of YY given X=xX = x under the joint law of (θ,X,Y)(\theta, X, Y).

  • The prior predictive distribution is m(y)=∫g(y∣θ) π(dθ)m(y) = \int g(y \mid \theta)\, \pi(d\theta), the same average before any data. At the observed data it is the marginal likelihood.
  • A draw from p(y∣x)p(y \mid x) is a draw θ∗\theta^* from the posterior followed by a draw Y∗Y^* from g(⋅∣θ∗)g(\cdot \mid \theta^*).

When YY depends on xx also through the model, as for the next value of a time series, replace g(y∣θ)g(y \mid \theta) by g(y∣θ,x)g(y \mid \theta, x).

Mean and variance. Let μ(θ)=E[Y∣θ]\mu(\theta) = E[Y \mid \theta] and σ2(θ)=Var(Y∣θ)\sigma^2(\theta) = \mathrm{Var}(Y \mid \theta). By the tower rules of conditional expectation,

E[Y∣x]=E[μ(θ)∣x],Var(Y∣x)=E[σ2(θ)∣x]+Var(μ(θ)∣x).E[Y \mid x] = E[\mu(\theta) \mid x], \qquad \mathrm{Var}(Y \mid x) = E[\sigma^2(\theta) \mid x] + \mathrm{Var}(\mu(\theta) \mid x).

The first term of the variance is the noise of a new observation; the second is the uncertainty about θ\theta. A plug-in law keeps only the first. The second term shrinks as nn grows, at rate 1/n1/n in regular models, and the first does not.

Chain rule. The joint prior predictive density of x1,…,xnx_1, \ldots, x_n factors as m(x1,…,xn)=∏i=1np(xi∣x1,…,xi−1)m(x_1, \ldots, x_n) = \prod_{i=1}^n p(x_i \mid x_1, \ldots, x_{i-1}), a product of one-step posterior predictive densities. This is a way to compute the marginal likelihood, and it is the base of prequential (one-step-ahead) model evaluation.

Calibration over the prior. Let θ\theta be drawn from the proper prior π\pi, then XX and YY from the model. If C(x)C(x) is a set with P(Y∈C(x)∣x)=1−αP(Y \in C(x) \mid x) = 1 - \alpha under the posterior predictive, then P(Y∈C(X))=1−αP(Y \in C(X)) = 1 - \alpha under the joint law, by the same Fubini argument as for a credible interval. At a fixed θ\theta there is no such guarantee; that statement belongs to a frequentist prediction interval.

Examples and non-examples

Beta-binomial. With n=10n = 10 trials, x=3x = 3 successes and the uniform prior, the posterior is Beta(a,b)(a, b) with a=4a = 4, b=8b = 8 (a conjugate prior). For Y∣p∼Y \mid p \sim Binomial(m,p)(m, p),

P(Y=k∣x)=(mk)B(a+k,b+m−k)B(a,b),k=0,…,m,P(Y = k \mid x) = \binom{m}{k} \frac{B(a + k, b + m - k)}{B(a, b)}, \qquad k = 0, \ldots, m,

where BB is the beta function. For m=5m = 5 the probabilities of k=0,…,5k = 0, \ldots, 5 are 33/18233/182, 55/18255/182, 25/9125/91, 15/9115/91, 5/785/78 and 1/781/78, that is 0.1813, 0.3022, 0.2747, 0.1648, 0.0641 and 0.0128. Expanding pa−1+k(1−p)b−1+m−kp^{a-1+k}(1 - p)^{b-1+m-k} as a polynomial and integrating term by term gives the same six fractions exactly. The mean is ma/(a+b)=5/3ma/(a + b) = 5/3 and the variance is

m ab (a+b+m)(a+b)2(a+b+1)=170117=1.4530.\frac{m\, a b\, (a + b + m)}{(a + b)^2 (a + b + 1)} = \frac{170}{117} = 1.4530.

The binomial law with pp fixed at the posterior mean 1/31/3 has variance 10/910/9; the ratio is (a+b+m)/(a+b+1)=17/13(a + b + m)/(a + b + 1) = 17/13, the factor that the uncertainty about pp adds. The plug-in law Binomial(5,0.3)(5, 0.3) at the MLE gives 0.1681, 0.3602, 0.3087, 0.1323, 0.0284 and 0.0024, with variance 1.051.05. It gives 5 successes in 5 about one fifth of the predictive probability.

The next trial. For m=1m = 1 the predictive probability of a success is E[p∣x]=(x+1)/(n+2)=4/12=1/3E[p \mid x] = (x + 1)/(n + 2) = 4/12 = 1/3, Laplace's rule of succession.

Normal with known variance. With Xi∣μX_i \mid \mu iid N(μ,σ2)N(\mu, \sigma^2), σ=0.5\sigma = 0.5, data 9.8, 10.4, 10.1, 9.6, 10.6 and the prior μ∼N(9,0.42)\mu \sim N(9, 0.4^2), the posterior is N(μn,τn2)N(\mu_n, \tau_n^2) with μn=9.8381\mu_n = 9.8381 and τn=0.1952\tau_n = 0.1952. The posterior predictive of a new YY is N(μn,σ2+τn2)N(\mu_n, \sigma^2 + \tau_n^2), with standard deviation 0.53675, and its 95% interval is [8.7861,10.8901][8.7861, 10.8901]. The plug-in law N(μn,σ2)N(\mu_n, \sigma^2) gives [8.8581,10.8181][8.8581, 10.8181], which is too narrow.

Calibration, measured. Draw μ\mu from the prior N(9,0.42)N(9, 0.4^2), then five observations and one new YY, r=20000r = 20000 times with seed 1. The 95% posterior predictive interval contained YY in 0.95245 of the runs; the exact value is 0.95 by the calibration result, and the Monte Carlo standard error is 0.0015. The interval xˉ±1.959964 σ\bar x \pm 1.959964\,\sigma contained YY in 0.93025 of the runs. Its exact coverage at every fixed μ\mu is 2Φ(1.959964/1+1/5)−1=0.92642\Phi(1.959964/\sqrt{1 + 1/5}) - 1 = 0.9264, because Y−Xˉ∼N(0,σ2(1+1/n))Y - \bar X \sim N(0, \sigma^2(1 + 1/n)).

Normal with unknown variance. With the improper prior density 1/σ1/\sigma on (μ,σ)(\mu, \sigma) (see improper prior), the posterior predictive of YY is xˉ+s1+1/n  tn−1\bar x + s\sqrt{1 + 1/n}\; t_{n-1}, where s2s^2 uses divisor n−1n - 1. For the data 2.1, 3.4, 2.9, 3.8, xˉ=3.05\bar x = 3.05, s=0.73258s = 0.73258 and t(3,0.975)=3.18245t_{(3, 0.975)} = 3.18245, so the 95% interval is [0.4434,5.6566][0.4434, 5.6566]. These are the numbers of the exact normal prediction interval, with a different meaning: a posterior probability, not a coverage at every fixed (μ,σ)(\mu, \sigma).

Non-example: the plug-in law. f(y∣θ^)f(y \mid \hat\theta) treats the estimate as the truth. It is not a posterior predictive distribution, and its intervals are too narrow, most of all for small nn and for tail events.

Non-example: the posterior of the mean. In the normal example the 95% credible interval for μ\mu is [9.4555,10.2206][9.4555, 10.2206]. It describes μ\mu, not a new observation, and it shrinks to a point as nn grows; the predictive interval does not.

Non-example: the prior predictive. m(y)m(y) ignores the data. It is useful for checking what a prior implies before the data come in, and its value at the data is the marginal likelihood, but it is not a prediction from the data.

  • Prediction interval. The frequentist interval for a new observation, with coverage at every fixed parameter value.
  • Posterior predictive check. Compares the data with replicated data drawn from the posterior predictive to find misfit.
  • Marginal likelihood. The prior predictive density at the data; the chain rule writes it as a product of posterior predictive densities.
  • De Finetti's theorem. For an exchangeable sequence, the predictive law of the next value given the past is the posterior predictive of a mixture model.
  • Bayesian linear regression and Gaussian process regression. Their posterior predictive laws are a Student t and a normal law in closed form.
  • Conformal prediction. Prediction sets with finite-sample marginal coverage under exchangeability alone, with no prior.

References

  1. Andrew Gelman, John B. Carlin, Hal S. Stern, David B. Dunson, Aki Vehtari and Donald B. Rubin, Bayesian Data Analysis, 3rd edition, CRC Press, 2013, Chapter 1 (prior and posterior predictive distributions), Chapter 2 (the binomial and normal examples) and Chapter 6 (predictive checks)
  2. Christopher M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006, Section 2.1.1 (the predictive probability of the next trial under a beta prior) and Section 3.3.2 (the predictive distribution of Bayesian linear regression)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/Z7WPWJ/text.yaml