Bayes' Formula: Reversing the Order of Conditioning
Conditional probability answers ; Bayes' formula (Proposition 11.2) answers the reverse question -- the probability of a cause given an observed effect. Assembled from the definition of conditional probability (Definition 11.1) and the law of total probability (Proposition 11.1), it updates a prior belief into a posterior once evidence arrives (Remark 11.2). The centerpiece is the medical-test / base-rate problem (Example 11.6), where a highly accurate test for a rare disease returns a surprisingly low posterior -- the base-rate fallacy that routinely fools intuition.
Before you start — give these a try
Attempting first primes your brain for the lesson — even if you miss. Nothing is graded or saved; it's just a warm-up.
A company runs two production lines. Line A makes of the units and has a defect rate; line B makes the other and has a defect rate. A unit is pulled from the warehouse and found to be defective. Find , to three decimal places.
In the medical-test setting, the prior probability of disease is , and a positive result gives the posterior (Example 11.6). Compared with the prior, the posterior is:
What you’ll be able to do
- State Proposition 11.2 (Bayes' Formula): for , , and use it to reverse the order of conditioning.
- Derive Bayes' formula from Definition 11.1 (conditional probability, via the multiplication rule) together with Proposition 11.1 (the law of total probability), which expands the denominator into .
- Distinguish the prior from the posterior (Remark 11.2), and explain how observing updates belief depending on how diagnostic is.
- Solve the medical-test base-rate problem (Example 11.6) from a test's sensitivity , its false-positive rate (specificity ), and the prevalence .
- Recognize the base-rate fallacy -- why high sensitivity does not make a positive result a near-certainty for a rare condition -- and decide whether a posterior is larger or smaller than its prior.
In your course
· MATH2015 · Linear Algebra & Probability- Proposition 11.2Bayes' FormulaFor , .
- Remark 11.2Prior and posterior probabilityis the prior (belief before evidence); is the posterior (belief after observing ).
- Example 11.6Medical test (base-rate problem)Sensitivity , false-positive rate , prevalence give .
- Example 11.5Two urns -- reversing conditioning, so a red ball is more likely from urn II.
- Proposition 11.1Law of Total ProbabilityFor a partition , ; two-event form .
- Definition 11.1Conditional Probabilityfor ; multiplication rule .
Reversing the order of conditioning
Conditional probability (Definition 11.1) gives : the chance of an effect once the cause is known. Frequently we observe the effect and want the cause, . Example 11.5 makes this concrete. Urn I holds green and red ball; urn II holds red and yellow balls. We pick an urn at random and draw a ball; given that it is red, which urn did it come from? The forward probabilities and are immediate, but the reverse is what we actually want. Rewrite it as and expand with the law of total probability. The answer says the red ball more likely came from urn II -- precisely because urn II is richer in red balls. Bayes' formula is the machine that performs this reversal in general.
Bayes' formula and where it comes from
Proposition 11.2 packages the reversal. Whenever , The derivation is two moves. First, the definition of conditional probability (Definition 11.1) used twice: and , so the numerator is . Second, the law of total probability (Proposition 11.1) splits the denominator across the partition : . So the scary-looking denominator is just written in computable pieces. Everything required -- the two likelihoods and the prior -- is exactly the data a forward model already supplies.
Prior and posterior (Remark 11.2)
Remark 11.2 names the two ends of the computation. The prior probability is our belief before seeing evidence; the posterior probability is that belief updated after observing . Bayes' formula is the engine that turns one into the other. Whether evidence raises or lowers belief depends on how diagnostic is: if is more likely under than under (that is, ) the posterior exceeds the prior; if it is less likely, the posterior drops; and in the knife-edge case the evidence is irrelevant and the posterior equals the prior -- which is exactly independence of and . The size of the shift, however, is still anchored by the prior, and that is the heart of the next idea.
The base-rate problem and the base-rate fallacy
The most famous use of Bayes is screening for a rare condition (Example 11.6). A test is described by its sensitivity (true-positive rate), its false-positive rate (so its specificity is ), and the disease's prevalence , which plays the role of the prior. Intuition whispers that a -sensitive test coming back positive means about a chance of disease. Bayes says otherwise. When the disease is rare, the enormous healthy population generates many false positives that swamp the few true positives, so the posterior can sit far below . Reading the sensitivity as the answer -- ignoring the prior -- is the base-rate fallacy. The fix never changes: put the prevalence in the numerator and inside the total-probability denominator, and let the arithmetic correct the intuition.
For events with , the conditional probability of given is . Clearing the denominator gives the multiplication rule .
If is a partition of the sample space with every , then for any event , . In particular, for a single event with , .
Let . Then
In Bayes' formula, is the prior probability (belief before the evidence) and is the posterior probability (belief updated after observing ).
Worked examples
Two urns (Example 11.5). Urn I contains green and red ball; urn II contains red and yellow balls. An urn is chosen at random (each with probability ) and one ball is drawn from it. Given that the drawn ball is red, find the probability it came from urn I.
- 1
Name the events. Let (so ) and . The priors are .
- 2
Read off the forward (likelihood) probabilities. Urn I has red of balls, so . Urn II has red of balls, so .
- 3
Expand the denominator with the law of total probability (Proposition 11.1):
- 4
Apply Bayes' formula (Proposition 11.2):
- 5
Interpret. Since , the red ball more likely came from urn II, consistent with urn II holding more red balls. The prior was revised down to the posterior .
Medical test -- the base-rate problem (Example 11.6). A test for a disease has sensitivity (positive on of people who have the disease) and a false-positive rate of (positive on of people who do not). The disease's prevalence is of the population. A randomly chosen person tests positive. What is the probability they actually have the disease?
Spam filter. A filter has learned that the word free appears in of spam emails and in of legitimate (ham) emails. Suppose of all incoming email is spam. An email arrives containing the word free. Find the probability the email is spam, and identify the prior and the posterior.