Math
Bayes Theorem Calculator
Enter how common the condition is and how the test performs to see what a positive result really implies.
The formula
true positives = prevalence × sensitivity
false positives = (1 − prevalence) × false positive rate
answer = true positives ÷ (true positives + false positives)
Worked example
A condition one person in a thousand has, a test that catches 99% and wrongly flags 1%
- Out of 100,000 people, 100 have it
- 99 of them test positive
- Of the 99,900 who do not have it, 999 test positive anyway
- 99 ÷ (99 + 999) = 9.0% — a positive result is wrong nine times in ten
Where this goes wrong
Reading the test accuracy as your probability
A 99% accurate test does not mean a positive result is 99% likely to be right. When only 1 in 1,000 people has the condition, the 999 false positives among the healthy vastly outnumber the 99 true positives among the sick, and a positive means about a 9% chance. Rarity beats accuracy, and it beats it badly.
Questions
- Why does the rarity of the condition matter so much?
- Because false positives are drawn from the healthy population, and when the condition is rare that population is almost everybody. A 1% error rate applied to 99,900 people produces far more positives than a 99% catch rate applied to 100.
- Does this mean screening tests are useless?
- No — it means a single positive is a reason to test again, not a conclusion. A second independent test applies the same arithmetic to a group that is now 9% affected rather than 0.1%, and the answer changes completely.
- Where else does this show up?
- Anywhere a rare thing is searched for with an imperfect filter: fraud detection, spam filtering, security screening, doping tests. The mathematics does not care what is being tested for.