What this calculator does
Bayes theorem revises a probability in the light of evidence. With a 1% prior, a test that catches 99% of true cases and wrongly flags 5% of healthy ones gives a posterior of just 16.7%.
That result is the single most important thing this calculator has to show. A 99% accurate test producing a positive result that is right only one time in six seems wrong until you count the people: out of 10,000, about 99 true cases test positive and about 495 healthy people also test positive. The false positives outnumber the true ones by five to one because there are so many more healthy people to draw them from.
The formula
The posterior is the true positive rate times the prior, divided by the total probability of the evidence. That denominator is the sum of two routes to a positive result: the true positives, prior times sensitivity, and the false positives, one minus the prior times the false positive rate. Both routes are shown separately so the arithmetic is visible.
| Term | Meaning |
|---|---|
| Prior | The probability before seeing the evidence, often the base rate in the population. |
| Posterior | The revised probability after the evidence. |
| Sensitivity | P(evidence | A): the chance of a positive result when the condition is present. |
| False positive rate | P(evidence | not A): the chance of a positive result when it is absent. This equals 1 minus specificity. |
The inputs explained
| Field | What to enter |
|---|---|
| Prior probability P(A) (%) | Prior probability, typically the base rate of the condition in the population being tested. |
| P(evidence | A): true positive rate (%) | True positive rate, also called sensitivity. |
| P(evidence | ¬A): false positive rate (%) | False positive rate, which is 1 minus specificity. A test with 95% specificity has a 5% false positive rate. |
When to use it
Interpreting a medical test result
A positive result means very different things for a screening test on the general population and a diagnostic test on symptomatic patients, purely because the prior differs.
Assessing a fraud or spam flag
Automated detection on a rare event produces mostly false positives unless specificity is extremely high.
Updating a belief with evidence
Any situation where a starting estimate should be revised by new information follows this structure.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
How much does the base rate change the answer?
The same test applied to populations with different underlying rates.
| Prior probability | Posterior P(A | evidence) | P(evidence) | P(evidence | ¬A) contribution |
|---|---|---|---|
| 0.1% | 1.94% | 5.09% | 5.00% |
| 1% | 16.7% | 5.94% | 4.95% |
| 5% | 51.0% | 9.70% | 4.75% |
| 20% | 83.2% | 23.8% | 4.00% |
| 50% | 95.2% | 52.0% | 2.50% |
Questions
Why is a 99% accurate test only 16.7% reliable?
Because the condition is rare. Testing 10,000 people with a 1% base rate finds about 99 of the 100 true cases, but also wrongly flags about 495 of the 9,900 healthy people. Of roughly 594 positives, only 99 are real. The false positives dominate because the healthy group is so much larger.
What is the base rate fallacy?
Judging a positive result by the test accuracy while ignoring how rare the condition is. It is a well-documented error made by professionals as well as the public, and it is the single most common mistake in interpreting diagnostic tests.
What prior should I use?
The rate in the population actually being tested, not the general population. For someone with relevant symptoms the prior is far higher than the population base rate, which is exactly why the same test result means much more in a diagnostic setting than in mass screening.
How do I get the false positive rate from specificity?
Subtract it from 100%. A test with 95% specificity has a 5% false positive rate. Specificity describes how often it correctly clears healthy cases; the false positive rate describes how often it fails to, and this calculator asks for the latter.
For the related test metrics, see the diagnostic test metrics calculator. For probability conditioned on an event, see the conditional probability calculator.