Skip to content

Bayes Theorem Calculator

Given a prior probability and a test's sensitivity and specificity, find the updated (posterior) probability after a positive result.

What this answers

Bayes theorem answers "given that a test came back positive, what is the actual probability that the condition is really present?" This is almost always a smaller number than people intuitively expect, especially when the condition is rare, because a low-prevalence base rate means most positive results come from the much larger pool of healthy people who happened to test falsely positive.

How it is calculated

The posterior probability is sensitivity times the prior, divided by the total probability of testing positive (the "evidence"). That evidence combines two paths to a positive result: true positives (sensitivity times prior) and false positives (the false positive rate, one minus specificity, times everyone without the condition).

Worked example

For a condition with 1% prevalence, a test with 90% sensitivity, and 95% specificity: the false positive rate is 5%, so a positive result comes from .9×.01=.009 true positives plus .05×.99=.0495 false positives, for a total evidence of .0585. The posterior probability is .009/.0585, about 15.4%, far below what the test's apparent 90%/95% accuracy might suggest.

Assumption audit

Calculated from your data: the false positive rate, the total probability of a positive result, and the resulting posterior probability.
Evidence to review: how confident you actually are in the prior (base rate); a different, more specific prior for your exact population can change the posterior substantially.
You must verify: that the sensitivity and specificity figures you entered actually apply to your population and test conditions, not a different study population where the test may perform differently.

What this result does not mean

A posterior probability is a mathematically updated base rate, not a personal diagnosis or a certainty statement about any one individual. Never call a low or moderate posterior probability a definitive answer, particularly when the underlying prior itself is uncertain or population-specific.

Common mistakes

A frequent mistake, sometimes called the base rate fallacy, is ignoring the prior entirely and treating sensitivity alone as the probability the condition is present given a positive test; the worked example above shows how dramatically the prior can pull the posterior down even with a highly sensitive test. Another is confusing sensitivity with specificity; the two describe performance on opposite groups (people with the condition versus people without it), and swapping them produces a completely different, incorrect posterior.

Limitations

This calculator assumes sensitivity and specificity are known exactly and constant across the population; in practice both are themselves estimates with their own uncertainty, which this calculation does not propagate into the posterior.