When a 99% Accurate Test Is Usually Wrong
Suppose a test catches 99% of the people who have a condition and wrongly flags only 1% of the people who do not. You take it and it comes back positive. Most people read that as a 99% chance of being sick. The grid below tests 10,000 people at once so you can watch why that reading fails when the condition is rare.
You tested positive. The chance you actually have it: 33%
Real intrusions are rare next to the flood of benign traffic, so even a detector with a tiny false-alarm rate fills the queue with false positives, which is a big part of why security dashboards drown in alerts.
Hover over a dot to see one person's result.
Psychologists call the mistake base rate neglect. A test's accuracy and the chance that a positive result is correct are two different numbers, and people reliably substitute the first for the second. The second one also depends on how common the condition is before you ever run the test, which is the base rate.
When the condition is rare, nearly everyone tested is healthy, so even a 1% error rate on that huge healthy pile can produce more false alarms than there are sick people in total. A positive result is then more likely to be noise than signal, no matter how good the test looks on paper. The cure is to count both piles, which is all Bayes' rule does.
The rule, written out
P(sick given positive) = P(positive given sick) × P(sick) ÷ P(positive).
The denominator counts every way a positive can happen, sick or not: P(positive) = P(positive given sick) × P(sick) + P(positive given healthy) × P(healthy).
In the sliders' terms: P(sick given positive) = sensitivity × prevalence ÷ (sensitivity × prevalence + (1 − specificity) × (1 − prevalence)). Medicine calls this the positive predictive value. The grid version is simpler: count the filled blue dots, count the filled red dots, and divide blue by blue plus red.