Bayes Theorem Calculator
Enter how common the condition is (prior), how often the test catches it (sensitivity) and how often it correctly clears healthy people (specificity). You get the chance that a positive result is a true positive. For learning only, not medical advice.
Updated
Report a problem
Formula
- Posterior:
P(D|+) = sens x prior / (sens x prior + (1 - spec) x (1 - prior)) - Chance of a positive:
P(+) = sens x prior + (1 - spec) x (1 - prior) - Negative predictive value:
spec x (1 - prior) / (spec x (1 - prior) + (1 - sens) x prior) - All inputs are percentages. This is for learning, not medical advice.
Worked example
Prior 1%, sensitivity 90%, specificity 91%. Per 10,000 people: 100 have the condition, 90 of them test positive (true positives). Of the 9,900 healthy people, 9% = 891 test positive (false positives). P(+) = 981 / 10,000 = 9.81%. Posterior = 90 / 981 = 9.17%, so about 90.8% of positive results are false positives, even though the test looks accurate. Negative predictive value is 99.89%.
Frequently asked questions
What is Bayes' theorem?
It updates a probability when you see new evidence: P(condition | positive) = sensitivity x prior / (sensitivity x prior + (1 - specificity) x (1 - prior)). It is a statistics tool, not medical advice, and no result here replaces a clinician's judgement.
Worked example: why is a positive result from a 90% accurate test often wrong?
Take a condition in 1% of people and a test with 90% sensitivity and 91% specificity. Of 10,000 people, 100 have it and 90 test positive. Of the 9,900 without it, 9% (891) test positive by mistake. So 90 of 981 positives are real: 9.17%. About 91% of positives are false positives.
What is a false positive and why are there so many?
A false positive is a positive result for someone who does not have the condition. When the condition is rare, even a small false positive rate (1 - specificity) applies to a huge healthy group, so false positives can outnumber true positives. That is why the prior matters as much as the test.
What is the difference between sensitivity and the posterior probability?
Sensitivity is P(positive | condition): how many sick people the test catches. The posterior is P(condition | positive): how many positives are truly sick. They are different questions and swapping them is a common error. With a 50% prior and an 80% sensitive, 80% specific test they happen to match at 80%.
Is this calculator medical advice?
No. It shows the arithmetic of conditional probability using numbers you supply. Real prior rates depend on age, symptoms and history, and test figures vary by population. Discuss any test result with a qualified health professional.