What is it about?
A test for a disease is never perfect. Three numbers describe the situation:
- Prevalence : share of people with the disease among those tested, e.g. .
- Sensitivity : share of people with the disease who test positive, e.g. .
- Specificity : share of healthy people who test negative, e.g. .
After a positive result, however, you want to know something else: how likely am I ill, given a positive test? This is the positive predictive value – the “reversed” conditional probability.
It is easiest to think in natural frequencies. Of people, are ill; of them test positive (true positives), tests negative (false negative). Of the healthy people, – that is – still test positive (false positives), test negative (true negatives). So people test positive – and only of them are ill:
With the rounded counts you get almost the same: . For whole numbers without rounding, use people: ill, of them positive; healthy, of them positive; so .
In general this is Bayes’ theorem:
In the reversed tree this value sits directly on the branch “positive → ill”. The reason for the small value: there are so many healthy people that even a small share of false alarms far outnumbers the few true positives. Ignoring the prevalence (the “base rate”) leads to far too high estimates of – the base rate fallacy. The negative predictive value , on the other hand, is very high.
A second test after a positive first test starts with the group of people who tested positive. Their share of people with the disease – the new prevalence – is the predictive value of the first test, . After two positive tests (assumed independent) you get .
The numbers in the examples are simplified and only illustrate the idea; real tests have different values depending on the device, the timing and the group of people.
Try it
- Watch the process: first the people with the disease turn red, then the test shows its result. People with the disease also carry a dot on their body. Then tap “Only those who tested positive”. How many of those who tested positive really have the disease? Load example
- Raise the prevalence slowly to . How does the predictive value change? The link shows the final state with sensitivity and specificity of each. Common disease
- Set the specificity to . What happens to the false positives? Specificity 100 %
- Lower the sensitivity to . Does the predictive value change a lot – and what happens to the false negatives? Sensitivity 50 %
- Switch to the tree and reverse it. Which numbers stay the same, which change? Tree
- Do a second test. How much does the predictive value rise? Second test
Tasks
Task 1: Natural frequencies
Prevalence , sensitivity , specificity . Find the four groups for people and the positive predictive value. Load task
Show solution
Ill : true positives , false negative . Healthy : false positives , true negatives . . Show in simulation
Task 2: Rapid test with low prevalence (simplified)
A rapid test has sensitivity and specificity . The disease is currently rare: . How likely is it that a person who tested positive is ill? Load task
Show solution
Of : ill, of them positive. healthy, of them positive. – only about one in six people who test positive is ill. Show in simulation
Task 3: Mammography screening (simplified example)
Assume that of the women examined have breast cancer, the sensitivity is and the specificity . Calculate with Bayes’ formula. Load task
Show solution
. In natural frequencies: true positives against false positives per women (rounded to and in the simulation). For women: true positives and false positives. Show in simulation
Task 4: Second test
Everyone who tested positive in Task 1 takes a second, independent test of the same kind, which is positive again. How likely is it now that the person is ill? Load task
Show solution
New prevalence . Then . With frequencies: of the people who tested positive, are ill; of them test positive again, and of the healthy people. So . Show in simulation
Task 5: How good does the test have to be?
Prevalence , sensitivity . What specificity is needed at least so that at least half of the people who test positive are ill? Load task
Show solution
We need false positives true positives, i.e. , so and . With you get . Show in simulation
Ideas for the classroom
- Use: conditional probability and Bayes’ theorem (upper secondary). Two-way tables and tree diagrams are covered in more depth in Two-way tables and Venn diagrams, path rules in Multi-stage experiments.
- Start with an estimate: before revealing it, let students guess how likely a person who tested positive is ill – the guesses are often far above .
- Natural frequencies: the icon picture and the tree with counts often make the calculation easier to follow than the formula alone; Bayes’ formula can then be read off the tree.
- For tasks: with “Show results” switched off, counts and predictive values appear as “?”. Prevalence, sensitivity and specificity stay visible.
- Model/simplifications: prevalence, sensitivity and specificity are fixed numbers; for the second test the tests are assumed independent. The counts in the picture are rounded (always summing to ), the percentages are calculated exactly. It is worth discussing with the class that a positive result is followed up by a doctor in practice; the simulation makes no statement about individual real tests.
- Common stumbling blocks:
- Confusing sensitivity with the predictive value (“the test is reliable, so I am likely to be ill”).
- Ignoring the prevalence (base rate).
- Taking the first-stage branches of the reversed tree from the forward tree.
- Mixing up false positives and false negatives.