Statistical Modeling and Generalization

Bayesian Predictive Distributions

Bayesian predictive distributions as averaging future predictions over parameter uncertainty.

Lesson
21

Goal

Understand the Bayesian shift from estimating a single unknown parameter to predicting future observations by averaging over many plausible parameter values.

The core idea is:

A Bayesian does not usually say “this one parameter value is the truth.” A Bayesian says “these parameter values are plausible, with different weights, so predictions should average across them.”

Motivation

The previous Bayesian lessons focused on updating beliefs about an unknown parameter:

That answers a parameter question:

Given the data, what do I believe about θ now?

Machine learning usually needs the next question:

Given the data, what do I expect to observe next?

Those are not the same question. A single parameter estimate can be useful, but it throws away uncertainty. Bayesian prediction keeps that uncertainty alive long enough to influence the forecast.

Prerequisites

Notation / Symbol Table

SymbolPlain-English nameMeaning
θparameterThe unknown model parameter or hypothesis.
DdataThe observations we have already seen.
P(θ)priorBeliefs about θ before seeing the data.
`P(Dθ)`likelihood
`P(θD)`posterior
x_nextnext observationThe future value we want to predict.
`P(x_nextθ)`one-model prediction
`P(x_nextD)`posterior predictive

The posterior predictive distribution is

P(xnextD)=P(xnextθ)P(θD)dθ.P(x_{\text{next}} \mid D) = \int P(x_{\text{next}} \mid \theta) P(\theta \mid D)\, d\theta.

Read that as:

For each possible parameter value, ask what it predicts, then average those predictions using the posterior weights.

Core Ideas

Prediction Is Not The Same As Estimation

A frequentist plug-in prediction often looks like this:

P(xnext)=P(xnextθ^),P(x_{\text{next}}) = P(x_{\text{next}} \mid \hat{\theta}),

where θ̂ is a single estimate such as the MLE or MAP estimate.

That can work well when uncertainty is tiny. But if many parameter values are still plausible, choosing one of them pretends the uncertainty disappeared.

Bayesian prediction keeps the full posterior:

P(θD),P(\theta \mid D),

then uses it to build a prediction.

The Posterior Predictive Is Model Averaging

Each possible θ acts like a small model. Some models get high posterior weight. Others get low weight.

The posterior predictive combines them:

P(xnextD)=P(xnextθ)P(θD)dθ.P(x_{\text{next}} \mid D) = \int P(x_{\text{next}} \mid \theta) P(\theta \mid D)\, d\theta.

This is often called model averaging. Instead of saying “Model B barely beat Model A, so ignore A,” we say “both are plausible, so both should influence the prediction.”

Why Uncertainty Matters

Suppose the posterior has two strong peaks. Then the “middle” parameter value may not actually be the most plausible one.

That means choosing one representative parameter can be misleading. Averaging predictions is usually safer than pretending a single point estimate captures the whole story.

This becomes especially important when:

A Helpful Geometric Analogy

There is a useful analogy to weighted combinations from linear algebra.

When you write a vector as a weighted combination of basis vectors, the weights tell you how much each direction contributes. A posterior does something structurally similar: it forms a weighted combination of hypotheses.

That analogy is helpful, but it has limits. Probability distributions are not ordinary vectors. The weights must stay nonnegative and sum to one. So the cleaner mental model is:

A posterior is a convex combination of hypotheses, and the posterior predictive is the corresponding weighted average of their predictions.

What Happens When The Posterior Gets Narrow

If the posterior becomes sharply concentrated around one value, then Bayesian prediction starts to look like plug-in prediction.

Formally, if almost all posterior mass is near θ = 0.75, then

P(xnextD)P(x_{\text{next}} \mid D)

becomes very close to

P(xnextθ=0.75).P(x_{\text{next}} \mid \theta = 0.75).

So Bayesian and classical predictions often look similar when the data is abundant and uncertainty is small.

Worked Example

Example 1: Weather Models

Suppose three forecasting models are still plausible after seeing the available data:

ModelPosterior weightPredicted temperature
A0.570°F
B0.375°F
C0.280°F

A winner-take-all prediction would choose Model A and predict 70°F.

A posterior predictive average gives

0.5(70)+0.3(75)+0.2(80)=73.5.0.5(70) + 0.3(75) + 0.2(80) = 73.5.

The point is not that 73.5 must be the exact truth. The point is that the prediction remembers uncertainty instead of deleting it.

Example 2: Predicting The Next Coin Flip

Suppose the posterior over the coin-bias parameter θ is:

θPosterior probability
0.30.2
0.50.5
0.70.3

For a Bernoulli model, each hypothesis predicts

P(Hθ)=θ.P(H \mid \theta) = \theta.

So the posterior predictive probability of heads is

P(HnextD)=0.2(0.3)+0.5(0.5)+0.3(0.7).P(H_{\text{next}} \mid D) = 0.2(0.3) + 0.5(0.5) + 0.3(0.7).

Compute it:

0.06+0.25+0.21=0.52.0.06 + 0.25 + 0.21 = 0.52.

So the next-flip prediction is

P(HnextD)=0.52.P(H_{\text{next}} \mid D) = 0.52.

We never had to declare one single value of θ to be the whole story.

Why This Shows Up In ML

Machine learning systems often care about more than a best-fit parameter vector. They care about prediction under uncertainty.

Posterior predictive reasoning shows up when you:

Even outside fully Bayesian pipelines, the intuition survives. Ensembles, bagging, and model averaging all echo the same lesson:

Combining several plausible predictors is often better than trusting a single brittle winner.

Exercises

  1. Why does using only the MAP estimate lose information compared with using the full posterior?
  2. Suppose the posterior over a coin bias is 0.1 on θ = 0.2, 0.2 on θ = 0.4, 0.4 on θ = 0.6, and 0.3 on θ = 0.8. What is the posterior predictive probability of heads?
  3. If the posterior becomes extremely narrow around θ = 0.75, why should Bayesian, MAP, and MLE-based predictions begin to look similar?
  4. In what sense is a posterior like a weighted combination of hypotheses, and where does that analogy stop being exact?

Implementation Exercise

Write a TypeScript helper that computes a discrete posterior predictive distribution from a list of weighted hypotheses.

Use a shape like:

type HypothesisPrediction = {
  posteriorWeight: number;
  prediction: number;
};

Start with a Bernoulli example, where each hypothesis predicts the probability of heads. Then extend it so a hypothesis can return a small discrete probability table for outcomes like sunny, cloudy, and rainy.

The useful habit here is not just summing numbers. It is naming the pieces clearly:

Reflection Questions