Learn · Bayes Theorem
Bayes' theorem & the base-rate fallacy
You take a test for a rare disease. It is 90% accurate and you test positive. How worried should you be? Most people say "about 90%". The real answer is often under 10% — because when a condition is rare, the flood of false positives dwarfs the true ones. Move the sliders and watch Bayes' theorem do the arithmetic. The maths is real; the scenario is illustrative.
Set the scenario
Share of the population who actually have the disease (0.1%–50%).
P(positive test | disease) — how often a sick person tests positive.
P(negative test | no disease) — how often a healthy person tests negative.
The verdict
The arithmetic behind it
Bayes' theorem turns the test's accuracy into the answer you actually want:
P(disease | +) = (sens × prev) ÷ [ sens × prev + (1 − spec) × (1 − prev) ]
1,000 people, one test
Every bar below is 1,000 people, sorted by the truth and by their test result. Notice how, at a low base rate, the gold false-positive block towers over the cyan true-positive one.
(sick, test +)
(healthy, test +)
(sick, test −)
(healthy, test −)
Prior, likelihood, posterior
The prior (base rate)
Before any test, your best guess is simply the prevalence. If 1 in 100 people have the disease, your starting probability is 1% — the prior. This is the number the fallacy ignores.
The likelihood (the test)
Sensitivity and specificity describe how the test behaves for sick and healthy people. They are the likelihood — evidence that nudges the prior up or down, but never replaces it.
The posterior (the answer)
Combining prior and likelihood gives the posterior: your updated belief given the result. That posterior — not the test's accuracy — is what should actually worry (or reassure) you.
Why the base rate dominates
With a rare condition, the healthy group is enormous compared with the sick group. Even a small false-positive rate applied to that huge healthy group produces a large false-positive count — often far more than the true positives from the tiny sick group. So most positive results come from healthy people. Raise the prevalence slider and watch the posterior climb: as the disease becomes common, a positive test really does mean what you'd intuitively expect.
Where this bites in the real world
Medical screening
Population-wide screening for rare cancers yields many false alarms per true case — which is why a positive screen is followed by confirmatory tests, not immediate treatment.
Fraud & fincrime alerts
Fraud is rare, so a "highly accurate" alert model still buries analysts in false positives. The base rate is exactly why alert triage and tuning matter — a theme we return to across this playground.
Spam & anomaly detection
When the flagged class is uncommon, precision suffers even with a strong classifier. Reporting accuracy alone hides this; you need the posterior to judge whether a flag is trustworthy.
The honest caveat: this model assumes a single, fixed test with independent, well-calibrated sensitivity and specificity, and a known prevalence. Real tests correlate with each other, drift over time, and are applied to sub-populations whose base rates differ from the headline figure — which is why clinicians repeat tests and data teams monitor models continuously. Reasoning well under uncertainty like this is core to the responsible-AI work we do at bigspark. New to the terms here? See the Learn shelf.