Bayes' theorem and diagnostic tests
Bayes' theorem reverses a conditional probability, combining a base rate with the accuracy of evidence — essential for interpreting screening results.
- Prior probability (base rate) of A.
- Likelihood of the evidence B if A is true.
- Posterior probability of A after seeing B.
- Sensitivity, P(test + | condition).
- Specificity, P(test − | no condition).
- Prevalence (base rate) in the tested population.
- Positive likelihood ratio: how much a positive result multiplies the odds.
When to use
- Interpreting a positive or negative test, alarm, fraud flag or classifier output.
- Any "probability of the cause given the effect" question.
How to interpret
The posterior depends on both the accuracy and the base rate. For a rare condition, even an accurate test produces many false positives, so the PPV can be low. Natural frequencies (out of 10 000 people) make the calculation transparent.
Common mistakes
- Base-rate fallacy: reading sensitivity (or specificity) as the probability of having the condition after a positive result.
- Using a prevalence from a different population (a clinic's patients vs the general public).
- Forgetting that PPV and NPV change with prevalence while sensitivity and specificity do not.
Example
Sensitivity 0.90, specificity 0.95, prevalence 2%. Of 10 000 people, 200 have the condition: 180 test positive. Of 9 800 without it, 490 test positive. PPV = 180/670 = 0.269 — about 27% of positives truly have the condition. NPV = 9 310/9 330 = 0.998. .