Course contentsShow
← Data Science
Lesson 1545 of 2,14538. Bayesian Data AnalysisFree lesson

Calculating the Posterior Distribution

How Bayes' theorem combines prior and likelihood to produce the posterior distribution over parameters.

Calculating the Posterior Distribution

You'll learn how Bayes' theorem mathematically combines your prior beliefs with new data to produce an updated probability distribution over parameter values.

The Core Idea

You've already learned the three components of Bayesian inference: the prior, the likelihood, and the posterior. Now we bring them together. Calculating the posterior distribution means applying Bayes' theorem to compute exactly how probable each parameter value is, given both your starting assumptions and the observed data.

The formula you've seen before becomes practical here:

Posterior = (Likelihood × Prior) / Evidence

Or in notation: P(θ|data) = [P(data|θ) × P(θ)] / P(data)

How It Works in Practice

  1. Start with your prior P(θ) — your belief about parameter θ before seeing data
  2. Multiply by the likelihood P(data|θ) — how probable the observed data is for each possible θ value
  3. Normalize by the evidence P(data) — a scaling constant that ensures probabilities sum to 1

The evidence (marginal likelihood) can be tricky because it requires integrating over all possible parameter values. Often, we work with the unnormalized posterior (prior × likelihood) and normalize it afterward.

An Analogy

Think of it like adjusting a weather forecast. Your prior is the climatological average (what usually happens this time of year). The likelihood is what today's radar and satellite data suggest. The posterior is your updated forecast that weighs both history and current conditions—it's neither purely based on "typical weather" nor purely reactive to today's data.

Key Takeaway: Calculating the posterior distribution applies Bayes' theorem to combine prior knowledge and data-driven likelihood into a single, updated probability distribution over parameters—the foundation of all Bayesian inference.