Interactive Bayes Calculator
Estimate how likely a condition is after seeing a test result. Enter percentages for base rate, sensitivity, and specificity.
What this Bayes calculator helps you answer
Most people ask a deceptively simple question after seeing a test result: “So what are the chances this is true?” The Bayes calculator gives that answer in a mathematically correct way by combining:
- Prevalence (how common the condition is before testing),
- Sensitivity (how often the test catches true cases), and
- Specificity (how often the test correctly rules out non-cases).
With those three values, you can compute the posterior probability: the updated probability after seeing either a positive or negative result.
Bayes’ theorem in one line
P(D|+) = [P(+|D) × P(D)] / { [P(+|D) × P(D)] + [P(+|¬D) × P(¬D)] }
For a negative result, we use the related form:
P(D|-) = [P(-|D) × P(D)] / { [P(-|D) × P(D)] + [P(-|¬D) × P(¬D)] }
Where P(+|¬D) = 1 − specificity and P(-|D) = 1 − sensitivity.
Why this matters: the base-rate effect
Even very accurate tests can mislead when the condition is rare. If prevalence is low, false positives can outnumber true positives. That means a positive result might still correspond to a modest true probability.
This is exactly the intuition trap Bayes helps you avoid. Rather than relying on headlines like “95% accurate,” you can ask a better question: “95% accurate in what population?”
Quick example
Suppose prevalence is 1%, sensitivity is 99%, specificity is 95%.
- Among 10,000 people, about 100 truly have the condition.
- True positives: about 99.
- False positives: about 495.
So a positive result is true only around 16.67% of the time. That surprises many people, but Bayes makes it clear.
How to use this calculator correctly
1) Choose realistic prevalence
Prevalence should reflect the population you care about, not a global average unless that is truly relevant. Screening high-risk groups and general populations can produce very different posterior probabilities.
2) Enter sensitivity and specificity from the same source
Try to use values from one study or test protocol. Mixing statistics from different contexts can create inconsistent estimates.
3) Set observed result
Select positive or negative to get the corresponding posterior probability. The calculator also shows both PPV and NPV metrics so you can compare both interpretations.
4) Use natural frequencies
The population field converts abstract percentages into expected counts (true positives, false positives, true negatives, false negatives). This often makes interpretation much easier.
Practical use cases
- Medical screening and diagnostic follow-up decisions
- Spam filtering and fraud detection systems
- Quality control in manufacturing testing pipelines
- Security alerts where false alarms are common
- Any classification task where priors matter
Common mistakes to avoid
- Confusing sensitivity with posterior probability.
- Ignoring prevalence (base rate).
- Treating “accuracy” as enough to decide real-world risk.
- Forgetting that test characteristics can change by context.
Bottom line
Bayes’ theorem is less about fancy math and more about better thinking under uncertainty. If you can estimate prior probability, sensitivity, and specificity, you can make far better decisions than intuition alone. Use this page whenever you need a quick, transparent posterior estimate.