The Mechanics of Belief Updating
Bayes' theorem is a direct consequence of the definition of conditional probability. If $A$ and $B$ are events with $P(B) > 0$:
In a statistical inference context, replace $A$ with $\theta$ (a parameter or hypothesis) and $B$ with $\mathcal{D}$ (observed data):
Each term has a name and a role:
- Prior <!--MATHBLOCK14-->: your distribution over <!--MATHBLOCK15--> before seeing data. Encodes domain knowledge, physical constraints, or deliberate ignorance.
- Likelihood <!--MATHBLOCK16-->: the probability of the observed data as a function of <!--MATHBLOCK17-->. This is identical to the likelihood used in maximum likelihood estimation (MLE).
- Posterior <!--MATHBLOCK18-->: your updated distribution over <!--MATHBLOCK19--> after observing data. This is the inferential target.
- Marginal likelihood (evidence) <!--MATHBLOCK20-->: a normalizing constant ensuring the posterior integrates to one. It is crucial for model comparison but irrelevant for single-model inference, so we often write the unnormalized form:
A Worked Medical Example
Consider a disease that affects 1% of the population. A diagnostic test has 90% sensitivity (true positive rate) and 95% specificity (true negative rate). You test positive. What is the probability you have the disease?
Let $D$ = "has disease", $T^+$ = "tests positive".
Despite a highly accurate test, a positive result only raises your probability from 1% to about 15%. This result — often called the base rate fallacy when ignored — is the canonical demonstration of why prior information matters profoundly. Frequentist hypothesis testing has no direct mechanism to incorporate this base rate.
# Bayesian updating for the medical screening example
prior_disease = 0.01
sensitivity = 0.90 # P(T+ | D)
specificity = 0.95 # P(T- | not D)
false_positive_rate = 1 - specificity
# P(T+)
p_positive = sensitivity * prior_disease + false_positive_rate * (1 - prior_disease)
# Posterior via Bayes
posterior = (sensitivity * prior_disease) / p_positive
print(f"Prior P(disease) : {prior_disease:.3f}")
print(f"P(T+) : {p_positive:.4f}")
print(f"Posterior P(D | T+) : {posterior:.3f}")Frequentist vs. Bayesian: The Core Distinction
The philosophical divide comes down to the interpretation of probability itself.
A frequentist defines probability as the limiting relative frequency of outcomes over infinitely many independent repetitions of an experiment. Parameters are fixed constants — asking for "the probability that $\mu = 5$" is meaningless because $\mu$ either is or is not 5. Inference is about constructing procedures (estimators, tests, confidence intervals) with guaranteed long-run properties.
A Bayesian defines probability as a measure of rational belief or uncertainty, applicable to any proposition including parameter values. Probabilities are personal in the sense that they encode a rational agent's state of knowledge given available information. Inference is about coherently updating beliefs via Bayes' theorem.
In practice, the differences surface in:
- Interval estimation: A 95% frequentist confidence interval is a random interval with the property that 95% of all such intervals constructed from repeated samples would contain the true parameter. A single interval either contains the parameter or it does not — no probability attaches to the individual interval. A 95% Bayesian credible interval directly states that, given the data and prior, there is a 95% posterior probability the parameter lies in that interval. The Bayesian statement is what most users mistakenly believe about confidence intervals.
- Sample size and stopping rules: Bayesian inference is valid regardless of when you stop collecting data. Frequentist <!--MATHBLOCK25-->-values are distorted by optional stopping, which creates practical problems in sequential experiments.
- Incorporating prior knowledge: Bayesian priors provide a formal channel for domain expertise. Frequentist methods have no analogous mechanism (though regularization methods like ridge regression have implicit Bayesian interpretations).