Bayes' Theorem Calculator
Turn a base rate and a test's accuracy into the probability that actually matters — the chance the condition is present given a positive result.
Bayes' theorem is P(H | E) = P(E | H) P(H) ÷ P(E), where P(E) expands to P(E | H)P(H) + P(E | not H)P(not H).
How the bayes' theorem calculator works
Bayes' theorem is P(H | E) = P(E | H) P(H) ÷ P(E), where P(E) expands to P(E | H)P(H) + P(E | not H)P(not H). Given a prevalence, a sensitivity (true-positive rate) and a specificity (true-negative rate), it returns the positive and negative predictive values.
The famous result: a 99%-accurate test for a condition affecting 1 in 1,000 people gives a positive result that is wrong about 90% of the time, because the false positives from the vast healthy majority swamp the true positives.
Formula: PPV = sens × prev / (sens × prev + (1 − spec)(1 − prev))
Worked examples
| Inputs | P(condition | positive test) | Note |
|---|---|---|
| 1% prevalence, 99% accurate both ways | 50% | a positive is right exactly half the time |
| 0.1% prevalence | 9.0164% | a positive is right only about 9% |
| Common condition (20%) | 96.1165% | PPV rises above 96% |
FAQFrequently asked questions
What is Bayes' theorem?
A rule for updating a probability when new evidence arrives: the prior, multiplied by how well the evidence discriminates, renormalised.
Why is a 99% accurate test so often wrong?
Because accuracy is measured against the condition, not against the population. If only 1 in 1,000 has it, the 1% false positives from the other 999 outnumber the true positives ten to one.
What is the difference between sensitivity and PPV?
Sensitivity is P(positive | condition) — a property of the test. PPV is P(condition | positive) — what you actually want, and it depends on prevalence.
Does this apply outside medicine?
Everywhere: spam filters, fraud detection, security screening and forensic evidence all have the same structure.
What is a likelihood ratio?
How many times more likely a positive result is in someone with the condition than without. Above 10 is strong evidence; near 1 is none.
Where these figures come from
- NIST Digital Library of Mathematical Functions — reference definitions for elementary and special functions
- Wolfram MathWorld — definitions and formulas for every topic on this page
- NIST/SEMATECH e-Handbook of Statistical Methods — the statistical formulas (mean, variance, z, confidence intervals, sample size)
- Australian Curriculum (ACARA) — Mathematics — the terms and methods taught in Australian schools
Last checked: September 2026. Formulas are fixed by mathematics and do not change with tax years or regulations.