This Bayes theorem calculator performs the most important update in reasoning: start with a prior probability, fold in evidence (a test’s sensitivity and specificity, or any likelihoods), and get the posterior — what you should believe after seeing the result.
Out of 10,000 people at the entered prior, the counts behind these percentages appear in the worked example below — natural frequencies are how humans (including doctors) actually digest Bayes.
The Theorem That Runs Every Test Result
P(A|B) = P(B|A) · P(A) / P(B) — the probability of the condition given the evidence equals the probability of the evidence given the condition, scaled by how plausible the condition was before the evidence arrived. The prior is not bias to be ashamed of; it’s the base rate, and ignoring it (base-rate neglect) is the most replicated reasoning error in medicine, law and everyday judgment. The conditional-probability machinery it rests on is our Probability Calculator‘s territory. Part of our Statistics Calculators collection.
Worked Example (Verified) — the Classic That Fools Physicians
Disease prevalence 1%, test sensitivity 99%, specificity 95%. You test positive. The defaults above:
- PPV = 0.99 × 0.01 ÷ (0.99 × 0.01 + 0.05 × 0.99) = 16.7% — five of six positives are false alarms
- In natural frequencies, per 10,000 people: 100 have the disease, 99 test positive; 9,900 don’t, but 5% of them — 495 — also test positive. Of 594 positives, only 99 are real: 99 ÷ 594 = 16.7% ✔
- Meanwhile the negative is nearly conclusive: NPV ≈ 99.99% — the same test is a superb rule-out and a modest rule-in, because the prior was low
- Raise the prior to 20% (symptomatic clinic population) and the identical test’s PPV jumps to ~83% — context isn’t decoration; it’s half the answer
Using Bayes Beyond Medicine
- Spam filters are naive Bayes machines: prior spam rates updated by word likelihoods.
- Troubleshooting: a rare failure mode + a suggestive log line ≠ the rare failure is likely; multiply by the base rate first.
- Sequential evidence: feed the posterior back as the next prior — two independent positive tests in the example take you from 16.7% to about 80%.
- Courtrooms: the prosecutor’s fallacy swaps P(evidence|innocence) for P(innocence|evidence) — Bayes’ theorem is precisely the correction.
Related Tools
- Probability Calculator — events, unions and conditions
- P-Value Calculator — the frequentist counterpart (and its limits)
- Statistics Calculators — the full collection
Frequently Asked Questions
How do you use Bayes’ theorem for a test result?
Posterior = (sensitivity × prior) ÷ [sensitivity × prior + (1 − specificity) × (1 − prior)]. Prior 1%, sensitivity 99%, specificity 95% → a positive means 16.7%, not 99% — the false positives from the healthy majority outnumber true positives from the rare sick minority.
Why is the prior so powerful?
Because evidence multiplies belief rather than replacing it. Strong tests (likelihood ratios of 20:1 here) move low priors a lot in relative terms — 1% → 16.7% is a 17× update — yet the absolute posterior can stay low. Both facts are the theorem working as designed.
What is sensitivity vs specificity?
Sensitivity: of those WITH the condition, the share testing positive. Specificity: of those WITHOUT it, the share testing negative. Bayes needs both, plus the prior — a test’s brochure numbers alone never determine what your result means.
What are PPV and NPV?
Positive/negative predictive values: the posterior probabilities after a positive (condition present) or negative (condition absent) result. They are properties of test and population — the same test has different PPV in screening (low prior) and diagnosis (high prior).
How do likelihood ratios fit in?
Odds form of Bayes: posterior odds = prior odds × LR, with LR+ = sensitivity ÷ (1 − specificity) ≈ 19.8 here. Clinicians chain LRs across successive findings exactly this way; the percentage form in this calculator is the same math wearing friendlier clothes.
Is this Bayes calculator free?
Yes — free, instant, no sign-up.