numvana

Bayes' Theorem Calculator (Diagnostic Test Accuracy)

Find the true probability of a condition after a positive or negative test result, given how common the condition is and the test's true- and false-positive rates — Bayes' theorem applied to diagnostic testing.

P(condition | positive result)
16.67%
P(condition | negative result)
0.0106%
Overall chance of a positive result
5.94%

How it works

Bayes' theorem states P(condition | positive) = P(positive | condition) × P(condition) ÷ P(positive). The denominator, the overall chance of a positive result, is expanded using the law of total probability: P(positive) = (true positive rate × prior) + (false positive rate × (1 − prior)). The same algebra run on 'negative' instead of 'positive' gives the probability the condition is present despite a negative result.

This is the standard framing for diagnostic test accuracy: the prior is how common the condition is in the population being tested (not something this calculator invents — you supply it, e.g. from published prevalence data for your situation), the true positive rate is the test's sensitivity, and the false positive rate is how often it flags a healthy case anyway.

FAQ

Why can a '99% accurate' test still be wrong most of the time?

This is the classic base-rate fallacy: with a 1% prior, a 99% true positive rate, and a 5% false positive rate, a positive result still only means a 1-in-6 (about 16.7%) chance of actually having the condition — because the condition is rare, the much larger pool of healthy people who get a false positive outnumbers the few genuinely positive cases, even at a 5% false positive rate. Accuracy rates alone are misleading without accounting for how common the condition is to begin with.

Where do I get the prior, true positive rate, and false positive rate?

From whatever source describes your specific situation — a test's published sensitivity/specificity, or a prevalence study for the population you're reasoning about. This calculator only does the arithmetic; it doesn't supply or assume any real-world rates for you.

Related calculators