Compute Disease Test Probability with Bayes' Theorem
Statistics & ExperimentsModel answerLast updated
Given a rare disease prevalence and known test accuracy rates, calculate the probability that a positive test result actually indicates disease.
Background
A public health team has developed a rapid diagnostic test for a rare condition. Before rolling it out widely, a medical statistician needs to advise on how to interpret a positive test result for an individual patient.
Given Information
- The condition affects 1% of the general population (prevalence = 0.01).
- The test has a sensitivity of 90%: if a person has the condition, the test is positive 90% of the time.
- The test has a specificity of 95%: if a person does not have the condition, the test is negative 95% of the time.
Question
A randomly selected person from the general population takes the test and receives a positive result.
What is the probability that this person actually has the condition?
Show your reasoning step by step. Then explain what this result means practically, and identify any common mistakes candidates make when approaching this type of problem.
Hints
Hint 1
Write out what you know in terms of P(Disease), P(+ | Disease), and P(+ | No Disease) before doing any arithmetic.
Hint 2
Use the law of total probability to compute P(+) — the overall probability of a positive test — by considering both the diseased and non-diseased populations separately.
Hint 3
Remember: sensitivity tells you the true-positive rate, and 1 − specificity tells you the false-positive rate. Make sure you use 1 − specificity, not specificity itself, in the denominator.
Model answer
Easy Try it yourself first — then compare your approach, complexity and edge cases.
Step 1 — Define the Events and Known Probabilities
Let:
- D = person has the condition
- + = test result is positive
From the problem statement:
| Quantity | Symbol | Value |
|---|---|---|
| Prevalence | P(D) | 0.01 |
| No disease | P(D̄) | 0.99 |
| Sensitivity (true positive rate) | P(+ | D) | 0.90 |
| False positive rate | P(+ | D̄) | 1 − 0.95 = 0.05 |
A very common mistake is plugging in specificity (0.95) directly as P(+ | D̄). Specificity is the true negative rate, so the false positive rate is its complement.
Step 2 — Apply the Law of Total Probability to Find P(+)
Before applying Bayes, compute the overall probability that any random person tests positive:
P(+) = P(+ | D) · P(D) + P(+ | D̄) · P(D̄)
= 0.90 × 0.01 + 0.05 × 0.99
= 0.009 + 0.0495
= 0.0585
Interpretation: about 5.85% of the entire population will test positive. Most of these positives come from the large pool of healthy people who trigger a false alarm, not from the small pool of truly sick people.
Step 3 — Apply Bayes' Theorem
P(D | +) = P(+ | D) · P(D) / P(+)
= (0.90 × 0.01) / 0.0585
= 0.009 / 0.0585
≈ 0.154
The probability that a person who tests positive actually has the condition is approximately 15.4%.
Step 4 — Intuition via a Concrete Population
Imagining 10,000 people makes the numbers tangible:
| Group | Count | Test Positive |
|---|---|---|
| Has condition (1%) | 100 | 90 (90% sensitivity) |
| No condition (99%) | 9,900 | 495 (5% false positive) |
| Total | 10,000 | 585 |
Of the 585 positive results, only 90 truly have the condition:
90 / 585 ≈ 15.4%
Same answer, zero algebra needed — a great sanity check to mention in an interview.
Practical Interpretation
Despite the test appearing "accurate" (90% sensitivity, 95% specificity), a positive result is wrong about 85% of the time when the disease is rare. This is the base rate neglect problem: even a good test produces mostly false positives when prevalence is very low.
This matters in practice:
- A single positive should trigger a confirmatory test, not immediate treatment.
- If the test were used only on a high-risk subgroup (say, prevalence 20%), the positive predictive value would jump to ~82% — a much more actionable number.
- Screening programs for rare diseases need very high specificity (>99%) or two-stage testing to be clinically useful.
Common Mistakes
- Confusing specificity with P(+ | D̄). Specificity is P(− | D̄). The false positive rate is 1 − specificity.
- Ignoring the base rate entirely and answering "90%" — this treats sensitivity as if it were the answer to the question asked.
- Forgetting the denominator. Candidates sometimes compute only the numerator (0.009) and stop, or divide by P(D) instead of P(+).
- Rounding too early. Rounding 0.0585 to 0.06 shifts the final answer from ~15.4% to ~15%, a small but noticeable error in a precise context.