Bayes' theorem explained with a medical test example
Bayes' theorem is about updating beliefs with new evidence. The classic example shows why intuition fails.
The scenario
A condition affects 1 in 1,000 people. A test for it is:
- 99% sensitive: it correctly flags 99% of people who have it.
- 95% specific: it correctly clears 95% of people who don't, so 5% get a false positive.
You test positive. What's the chance you have the condition?
Many people guess 95% or 99%. Let's count.
Imagine 100,000 people
- 100 have the condition. The test catches 99 of them.
- 99,900 don't. 5% of them, about 4,995, test positive anyway.
- Total positives: 99 + 4,995 = 5,094.
- True positives: 99.
Chance you actually have it: 99 / 5,094 ≈ about 2%.
What happened?
The condition is rare, so false positives from the huge healthy group swamp the true positives. This is the base rate effect, and ignoring it is called base rate neglect.
The theorem in words
Probability of the hypothesis given the evidence = (probability of the evidence if the hypothesis is true × prior probability of the hypothesis) / overall probability of the evidence.
Practical takeaways
- Screening tests for rare conditions often need confirmatory testing.
- Context matters: if you have symptoms, your prior probability is higher, and a positive result means more.
- Decisions about testing and results should be discussed with a doctor.
Did the 2% answer surprise you? Where else have you seen base rates ignored?
Comments · 4
Imagine 1000 people: 10 have the condition, 9 test positive. Of the 990 healthy ones, about 50 also test positive. So a positive result is wrong most of the time. Natural frequencies make it click.
I code a spam filter example using this. Same logic: a word's presence updates the odds that a message is spam.
So the lower the base rate of the condition, the less a positive test tells you? That seems counterintuitive.
Right, for a rare condition most positives are false alarms. That's why doctors consider the base rate and sometimes repeat the test.