Overview

Bayes' theorem updates a probability when you get new evidence. This applies it to the classic test case: how likely is a condition after a positive result?

Enter the prior probability, the test's sensitivity and its false positive rate.

Worked examples

InputsResult
Prior Probability of Condition (%)2Sensitivity (%)92False Positive Rate (%)8Posterior probability P(ConditionPositive): 19.01%False-alarm share among positives: 80.99%
Show 2 more examples
Prior Probability of Condition (%)50Sensitivity (%)80False Positive Rate (%)20Posterior probability P(ConditionPositive): 80%False-alarm share among positives: 20%
Prior Probability of Condition (%)0.5Sensitivity (%)99False Positive Rate (%)2Posterior probability P(ConditionPositive): 19.92%False-alarm share among positives: 80.08%

How it works

The posterior is the chance of a true positive divided by the chance of any positive. True positives are prior × sensitivity, and false positives are (1 − prior) × false positive rate. The result shows how strongly the prior shapes the answer.

The formula

P(A | B) = P(B | A) × P(A) ÷ P(B)
P(A)Prior probability
P(B | A)Sensitivity
P(B)Total chance of a positive

Practical tips

  • A 2% prior, 92% sensitivity and 8% false positive rate give a posterior of 19.01%.
  • Use the posterior as the new prior if you test again with an independent test.
  • Small changes to a low prior can change the posterior a lot.

Frequently asked questions

Where does the prior come from?

Base rates from research, or a reasonable starting belief before the evidence.

Is this only for medical tests?

No. It applies to spam filters, quality checks and any evidence that updates a belief.

What if the false positive rate is 0?

Then every positive is real and the posterior is 100%.