9.3 Bayes' Theorem
Section 9.2 showed that the direction of a condition matters. asks how likely evidence is when hypothesis is true, whereas asks how plausible the hypothesis is after the evidence appears. These two probabilities are not generally equal.
That distinction appears whenever we diagnose a cause from an observation:
- a medical condition may cause a positive test;
- a faulty machine may produce a defective item;
- an email source may produce certain words;
- a hidden game strategy may produce a visible move.
Bayes' theorem converts probability in the first direction into probability in the second direction.
Hypotheses, evidence, and four useful names
An hypothesis is an event representing a possible hidden explanation. Let mean “the person has the condition.” Let mean “the test result is positive.”
Four quantities play different roles:
- is the prior probability, the probability of before observing .
- is the likelihood, the probability of the observed evidence under .
- is the evidence probability, the overall probability that occurs.
- is the posterior probability, the updated probability of after observing .
These names describe positions in an update; they are not four new probability rules.
Deriving Bayes' theorem from one intersection
The multiplication rule computes the same intersection in two orders:
and
Set the right sides equal and divide by , assuming :
This is Bayes' theorem. Its structure is worth reading in words:
The numerator is , the probability mass belonging to both the hypothesis and the evidence. Dividing by all evidence mass restricts attention to cases where the evidence occurred.
Finding the missing denominator
Often is not given directly. Suppose exactly one of two hypotheses must hold: or its complement . The evidence can arrive through either route:
The two pieces are mutually exclusive, so their probabilities add. Applying the multiplication rule to each gives the law of total probability:
Substitute this expression into Bayes' theorem:
Every term now describes one of the two routes that can produce the evidence.
A screening example: why the base rate matters
Assume the following facts:
- of a population has a condition, so ;
- among people with the condition, the test is positive of the time, so ;
- among people without the condition, the test is negative of the time.
The last statement is called specificity. To use Bayes' formula, we need the false-positive probability:
We could substitute decimals directly. A population table makes the denominator easier to see. Imagine people:
| Group | Population | Positive | Negative |
|---|---|---|---|
| Has condition | |||
| No condition | |||
| Total |
Among the positive results, only are true positives. Therefore,
So the posterior probability is about , not . The test's sensitivity is , not . The low prior rate creates a large group without the condition, and even a false-positive rate produces many positive results in that group. This is the base-rate effect.
Tune prevalence, sensitivity, and specificity for a virtual population. The population splits into true positives, false positives, false negatives, and true negatives, so the posterior is visible as a selected part of all positive results rather than as an unexplained formula output.
More than two hypotheses
The hidden cause may have several possibilities. Events form a partition of when they are mutually exclusive and together cover the entire sample space:
The union notation says that at least one of the hypotheses occurs; mutual exclusion says that no two occur together.
The evidence probability is the sum of all possible evidence routes:
The symbol means to add one term for every index from through . For a particular hypothesis , Bayes' theorem becomes
Example: locating a defective machine
Three machines make all components in a factory:
| Hypothesis | Share of output | Defect probability |
|---|---|---|
| : machine 1 | ||
| : machine 2 | ||
| : machine 3 |
Let be the evidence “the selected component is defective.” First calculate the joint contribution of every route:
Then add those contributions:
Finally, normalize machine 3's contribution by the total defective mass:
Machine 3 produces only of all components, yet it is responsible for about of defective components because its defect rate is higher.
Sequential evidence means repeated updating
After one update, the posterior can become the prior for the next piece of evidence. Suppose is observed first and then . The update follows this pipeline:
To perform the second step, we need the probability of after accounting for under each hypothesis. If a model states that and are conditionally independent given , then their joint likelihood factors:
Conditionally independent means independent inside the restricted world where is assumed. This is an additional model assumption, not something Bayes' theorem guarantees. If the clues influence one another even after fixing the hypothesis, multiplying their separate likelihoods would count the evidence incorrectly.
Investigate three suspects by selecting clues in any order. Each clue redistributes posterior probability bars. The case board exposes the prior, each likelihood multiplier, and the normalization step—and allows contradictory-looking evidence to undo an earlier lead.
A disciplined Bayes workflow
1. Define the hypothesis events and the evidence event. 2. Check that the hypotheses form a partition. 3. Record every prior and likelihood in the correct direction. 4. Multiply to obtain the joint contributions . 5. Add all contributions to obtain . 6. Divide the target contribution by the total evidence probability. 7. Check that all posterior probabilities are between and and sum to .
Bayes' theorem updates probabilities of events. Section 9.4 introduces a different tool: a random variable will attach a numerical value to each outcome, allowing us to describe distributions and long-run average values.