Bayes’ Theorem
Update a probability with new evidence, shown both algebraically and as natural frequencies.
Prior was 1% · negative predictive value 99.99%
| Test positive | Test negative | Total | |
|---|---|---|---|
| Has it | 99 | 1 | 100 |
| Does not | 495 | 9,405 | 9,900 |
| Total | 594 | 9,406 | 10,000 |
Of the 594 who test positive, 99 actually have it — which is the 16.67% above, read straight off the table.
Bayes’ theorem updates a probability when evidence arrives: P(A|B) = P(B|A)·P(A) ÷ P(B). For a disease affecting 1% of people and a test that is 99% sensitive and 95% specific, a positive result means only a 16.7% chance of actually having it.
Why that answer surprises almost everyone
A test that is 99% accurate at detecting a disease feels conclusive. The reason it is not comes down to how many people are in each group. Out of 10,000 people with a 1% prevalence, 100 have the disease and 9,900 do not. The test catches 99 of the 100 — but it also wrongly flags 5% of the 9,900, which is 495 people. So 594 people test positive and only 99 of them are ill: 16.7%.
The false positives outnumber the true positives simply because the healthy group is a hundred times larger. Neglecting that is the base rate fallacy, and it is the single most common error in reading a test result, made by patients and clinicians alike.
Prior, likelihood, posterior
Three quantities do all the work. The prior is what you believed before the evidence — here the prevalence. The likelihood is how probable the evidence would be if the hypothesis were true — the sensitivity. The posterior is the updated belief. The denominator is just the total probability of seeing that evidence at all, whether the hypothesis holds or not, which is what normalises the result into a proper probability.
the denominator expands P(B) into the two ways the evidence can arise
- 1 Write down the prior. A prevalence of 1% means P(disease) = 0.01 before testing.
- 2 Find the two ways the evidence can appear. A positive test arises either from a true positive (99% of the 1%) or a false positive (5% of the 99%).
- 3 Compute the numerator. 0.99 × 0.01 = 0.0099 — the probability of being ill and testing positive.
- 4 Compute the total probability of the evidence. 0.0099 + 0.05 × 0.99 = 0.0099 + 0.0495 = 0.0594.
- 5 Divide. 0.0099 ÷ 0.0594 = 0.1667, so about 16.7%.
The same numbers as a count of people
Out of 10,000 tested at 1% prevalence, 99% sensitivity and 95% specificity.
| Test positive | Test negative | Total | |
|---|---|---|---|
| Has the disease | 99 | 1 | 100 |
| Does not | 495 | 9,405 | 9,900 |
| Total | 594 | 9,406 | 10,000 |
What changes the answer most
Prevalence dominates. The same test applied to a high-risk group — say 20% prevalence rather than 1% — gives a positive predictive value above 80%, because the diseased group is no longer swamped by false positives. That is precisely why screening tests are targeted at populations where the condition is common, and why a positive result in a general screen is normally followed by a second, more specific test rather than acted on directly.
Specificity matters more than sensitivity here, which is counterintuitive. Raising sensitivity from 99% to 100% adds one true positive out of 594. Raising specificity from 95% to 99% cuts false positives from 495 to 99, which lifts the posterior from 16.7% to about 50%. When the condition is rare, the false-positive rate is what the answer hinges on. Note also that a negative result is very informative in this setting: the negative predictive value is above 99.9%, so the test rules out far better than it rules in.