A disease affects 1% of people. A test detects it 99% of the time when it is present, and gives a false positive 5% of the time when it is absent. If a person tests positive, what is the probability that they have the disease?
Probability and statistics, Bayes' rule
Level L2 Elementary. Length Short. Nature Mat Mathematical.
What's being asked
Whether you can apply Bayes' rule with the law of total probability, and avoid ignoring the base rate.
Key idea
Let be “has the disease” and be “tests positive”. Then The small prior dominates, so most positives are false positives.
Steps
- Write down what is given: , and , so .
- Find the total probability of a positive test, adding the ill and the healthy cases: .
- Apply Bayes' rule: .
- Check with counts, which is easier to trust. Out of 10,000 people, 100 are ill and 99 of them test positive. Of the 9,900 healthy people, 495 test positive. So .
- Link it to ML. This is precision when one class is rare: high recall and a low false-positive rate can still give low precision.
Common mistakes
- Answering 99%. That confuses with .
- Leaving the false-positive term out of the denominator, or using .
How long your answer should be
4–5 lines; the table of counts is the safest way to show it.
Last checked on 4 December 2026.
Read this
Previous in Probability and statistics: Using and , how can you show that two random variables can be uncorrelated but not independent?
Next in Probability and statistics: What does the central limit theorem say? If per-example test losses have mean and standard deviation , roughly what is the probability that their average over test examples differs from by more than 2?