Bayes' Theorem Calculator
What a positive result really means, once the rarity of the thing being tested for is taken into account.
Results
What this tool does
A test that is 99 per cent accurate sounds conclusive. It usually is not, and the reason is arithmetic rather than medicine: when a condition is rare, the handful of false positives among the vast healthy majority outnumbers the true positives among the few who have it. Put in how common the condition is, how well the test catches it, and how well it clears everyone else, and this page works out what a positive result is actually worth — laid out as a count of real people, because that is the version that makes the surprise obvious.
Formula
P(has | positive) = P(positive | has) × P(has) ÷ P(positive)
Variables
| Symbol | Meaning | Unit |
|---|---|---|
prior | How common it is to begin with | % |
sensitivity | The test catches this share of real cases | % |
specificity | And clears this share of the rest | % |
population | Imagine this many people | — |
OUT | A positive test is right this often | % |
NC | And a negative test, this often | % |
TP | Share who test positive at all | % |
VP | Have it and are found | — |
FP | Do not have it and are alarmed | — |
FN | Have it and are missed | — |
VN | Do not have it and are cleared | — |
LR | How much a positive shifts the odds | — |
PO | Odds before the test | — |
QO | Odds after it | — |
Worked example
- How common it is to begin with1 %
- The test catches this share of real cases99 %
- And clears this share of the rest95 %
- Imagine this many people100,000
- A positive test is right this often16.67 %
- And a negative test, this often99.9894 %
- Share who test positive at all5.94 %
- Have it and are found990
- Do not have it and are alarmed4950
- Have it and are missed10
- Do not have it and are cleared94,050
- How much a positive shifts the odds19.800
- Odds before the test0.01010
- Odds after it0.2000
Limitations
- The calculation runs entirely in your browser. The values you type are never sent to a server.
- This tool is informational only. It does not diagnose, treat or replace a qualified health professional. Speak to a doctor before making decisions about your health.
Frequently asked questions
How can a 99 per cent accurate test be wrong most of the time?
Because accuracy is measured on the people who have the condition, and almost nobody does. With the defaults on this page, in a hundred thousand people a thousand have it and the test finds 990 of them — excellent. But the other ninety-nine thousand get tested too, and five per cent of them come back positive by mistake, which is 4,950 people. So of everyone who tests positive, fewer than one in six actually has it. Nothing is wrong with the test; the rarity of the condition is doing the damage, and this is the single most misunderstood calculation in medicine.
Where do I find the two accuracy figures?
In the manufacturer's insert or the published validation study, where they are called sensitivity and specificity. Beware of a single "accuracy" percentage: it mixes the two together and depends on how common the condition was in whatever group they tested, which makes it close to meaningless on its own. The prevalence — the first box — should come from the population the person actually belongs to, not from the whole country, and that is usually where the real uncertainty lies.