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

Bayes' Theorem Formula and Components

Understanding the mathematical structure of Bayes' theorem: prior, likelihood, evidence, and posterior.

Bayes' Theorem Formula and Components

You'll learn how Bayes' theorem mathematically updates beliefs using four key components: prior, likelihood, evidence, and posterior.

The Formula

Bayes' theorem is elegantly expressed as:

P(H|D) = [P(D|H) × P(H)] / P(D)

Where each symbol represents a crucial piece of the puzzle.

The Four Components

Prior: P(H)

Your initial belief about a hypothesis before seeing new data. Think of this as your starting point—what you believe based on historical information, domain knowledge, or previous experiments. In A/B testing context, this might be your belief about conversion rates before running the test.

Likelihood: P(D|H)

The probability of observing your data given the hypothesis is true. This asks: "If my hypothesis were correct, how likely would I be to see this exact data?" This connects your hypothesis to real observations.

Evidence: P(D)

The total probability of observing the data under all possible hypotheses. This acts as a normalizing constant, ensuring your posterior probability is valid (sums to 1). Often the trickiest to calculate, but conceptually it's "how surprising is this data overall?"

Posterior: P(H|D)

Your updated belief after incorporating the new data. This is what you actually care about—what should you believe now? The posterior combines your prior knowledge with fresh evidence.

The Flow

Think of Bayes' theorem as a belief-updating machine: you feed in your prior belief, multiply by how well the data supports your hypothesis (likelihood), normalize by how surprising the data is overall (evidence), and out comes your refined, data-informed belief (posterior).

Key Takeaway: Bayes' theorem mathematically transforms prior beliefs into posterior beliefs by weighing the likelihood of observed data, with each component playing a distinct role in quantifying uncertainty.