Bayes' Theorem
in Diagnostics
Learn how to use prior probability and test accuracy to calculate the true chance a patient has a disease after a positive test result.
Why a Positive Test Doesn't Mean You're Sick
Imagine a disease affects 1 in 1,000 people. A screening test is 99% accurate. You test positive: what's the chance you actually have the disease?
Key Vocabulary
The Four Outcomes of a Test
Sensitivity vs Specificity
Of all sick people, how many test positive? High sensitivity: few false negatives.
Of all healthy people, how many test negative? High specificity: few false positives.
Bayes' Theorem: The Formula
Visualizing with a Probability Tree
PPV vs NPV: Key Distinction
| Positive Predictive Value | Negative Predictive Value | |
|---|---|---|
| Question | If test is \(+\), is patient sick? | If test is \(-\), is patient healthy? |
| Formula | \( \frac{\text{TP}}{\text{TP}+\text{FP}} \) | \( \frac{\text{TN}}{\text{TN}+\text{FN}} \) |
| Depends on | Sensitivity + Prevalence | Specificity + Prevalence |
| As prevalence ↓ | PPV drops sharply | NPV stays high |
How to Apply Bayes' Theorem
Worked Example: Rare Disease Screening
Given: A disease affects 1 in 1,000 people. A test has 99% sensitivity and 99% specificity. A patient tests positive. What is \( P(D\mid +) \)?
Same Problem Using Natural Frequencies
Example 2: Higher Prevalence
Given: A flu test with 95% sensitivity and 90% specificity is used during flu season when 20% of patients have the flu. What is \( P(\text{Flu}\mid +) \)?
Example 3: Two-Step Testing
Scenario: After the first positive (from Example 1), the patient takes a second independent test with the same 99% sensitivity and 99% specificity. The new prior is now 9%.
How Prevalence Shapes PPV
Common Mistakes
Summary of Key Formulas
| Concept | Formula | Meaning |
|---|---|---|
| Bayes' Theorem | \( \frac{P(+\mid D) \cdot P(D)}{P(+)} \) | Update belief after data |
| Sensitivity | \( P(+\mid D) \) | True positive rate |
| Specificity | \( P(-\mid D^c) \) | True negative rate |
| FPR | \( 1 - \text{Specificity} \) | False positive rate |
| PPV | \( P(D\mid +) \) | Chance of disease if \(+\) |
| NPV | \( P(D^c\mid -) \) | Chance of health if \(-\) |
Question 1 of 5
A disease has 5% prevalence. A test has 90% sensitivity and 90% specificity. What is \( P(D\mid +) \)?
Question 2 of 5
Which of the following increases the positive predictive value (PPV) of a test?
Question 3 of 5
A test has 99% sensitivity and 95% specificity. In a population where 2% have the disease, about how many of the positive results are false positives?
Question 4 of 5
A student writes: "The test is 95% accurate, so if I test positive, there's a 95% chance I have the disease." What error is the student making?
Question 5 of 5
After one positive test, a patient's probability of disease rises from 0.1% to 9%. They take the same test again and it's positive. Using Bayes' theorem with the updated prior of 9%, the new \( P(D\mid ++) \) is approximately: