Bayes' theorem tells you how to update the probability of something (a hypothesis A) after seeing evidence (B): P(A|B) = P(B|A) × P(A) / P(B). Its famous lesson is that how common something is to begin with matters as much as how good the test is. Run your own numbers in the Bayes’ Theorem Calculator; the term is defined in Bayes' Theorem.
The idea in one example
Suppose 1 % of people have a condition, a test detects it 90 % of the time (sensitivity) and wrongly flags 9 % of healthy people (so specificity is 91 %). You test positive. What is the chance you have it?
Count people instead of probabilities
| Out of 10,000 people | Test positive | Test negative | Total |
|---|---|---|---|
| Have the condition | 90 | 10 | 100 |
| Healthy | 891 | 9,009 | 9,900 |
| Total | 981 | 9,019 | 10,000 |
Of the 981 positive results only 90 are real, so the chance is 90 / 981 = 9.17 %, not 90 %. A negative result is 99.89 % likely to be correct.
Updating with a second test
In odds form: prior odds 1 : 99, times the likelihood ratio 0.90 / 0.09 = 10, give posterior odds 10 : 99, which is 9.2 %. A second independent positive test multiplies the odds by 10 again: the chance becomes 50.3 %.
Where people go wrong
- Ignoring the base rate (the base-rate fallacy): quoting the test's accuracy as if it were the chance of being right.
- Mixing up directions: P(positive | sick) is not P(sick | positive).
- Assuming independence: repeated tests by the same method often share errors, so each does not add the full factor of 10.
- Estimates of the prior and the error rates are themselves uncertain; the answer is only as good as they are.