Statistics Quest

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.

P(A∣B)=P(B∣A) P(A)P(B∣A) P(A)+P(B∣Ac) P(Ac)P(A \given B) = \frac{P(B \given A)\,P(A)}{P(B \given A)\,P(A) + P(B \given A^c)\,P(A^c)}
Bayes' theorem (two hypotheses).
P(A)P(A)
Prior probability (base rate) of A.
P(B∣A)P(B \given A)
Likelihood of the evidence B if A is true.
P(A∣B)P(A \given B)
Posterior probability of A after seeing B.
PPV=se πse π+(1−sp)(1−π),NPV=sp (1−π)sp (1−π)+(1−se) π\text{PPV} = \frac{se\,\pi}{se\,\pi + (1 - sp)(1 - \pi)}, \qquad \text{NPV} = \frac{sp\,(1 - \pi)}{sp\,(1-\pi) + (1 - se)\,\pi}
Predictive values of a diagnostic test.
sese
Sensitivity, P(test + | condition).
spsp
Specificity, P(test − | no condition).
π\pi
Prevalence (base rate) in the tested population.
posterior odds=prior odds×LR,LR+=se1−sp\text{posterior odds} = \text{prior odds} \times LR, \qquad LR_{+} = \frac{se}{1 - sp}
Odds form with the likelihood ratio.
LR+LR_{+}
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. LR+=18LR_+ = 18.