How to use this calculator
For a test, enter the prior probability (prevalence), the sensitivity and the specificity. For anything else, list each hypothesis with its prior and the probability of the evidence if it were true; the hypotheses should be mutually exclusive and cover every case.
Formulas
Worked example
A test with 95% sensitivity and 90% specificity for a condition with 1% prevalence
- P(+) = 0.95 × 0.01 + 0.10 × 0.99 = 0.1085.
- P(A | +) = 0.0095/0.1085 = 8.76%.
- In 10 000 people: 95 true positives and 990 false positives, so most positives are false.
- A second independent positive raises it to 47.7%.
Frequently asked questions
Why is the posterior so low when the test is accurate?
Because the condition is rare. False positives come from the 99% without it, so even a 10% false-positive rate swamps the true positives. This is the base-rate fallacy.
What are sensitivity and specificity?
Sensitivity is the probability of a positive result when the condition is present; specificity is the probability of a negative result when it is absent.
Do the priors have to add to 1?
They should, because the hypotheses must cover every possibility. If they don’t, the calculator scales them and warns you.