search

Found

info Overview

See the posterior P(A|B) after a positive result. Tune prior, sensitivity, and false-positive rate from 0.01% to 99.99%, plus marginal P(B).

📘 How to Use

  1. Set the prior P(A) slider to the base rate of your hypothesis in the population
  2. Adjust the likelihood P(B|A) (sensitivity) and false-positive rate P(B|¬A) sliders
  3. Read the posterior P(A|B), the marginal P(B), and the prior-vs-posterior comparison bars

Bayes Theorem Calculator

%

Proportion of the population for which hypothesis A is true

%

Probability of a positive test result when A is true

%

Probability of a positive test result when A is false

Posterior P(A|B)

16.67 %

Probability that A is true given a positive test result

Marginal P(B)

5.94 %

Prior vs posterior comparison

Prior P(A) 1.00%
Posterior P(A|B) 16.67%
Copied!
Article

Bayes Theorem Calculator | Posterior Probability from Prior and Likelihood

Drag three sliders — prior, likelihood (sensitivity), and false-positive rate — and the calculator applies Bayes' theorem to return the posterior P(A|B) and the marginal P(B). Every input runs from 0.01% to 99.99% in 0.0001 steps, so you can explore the low-prevalence regime where intuition breaks down.

💡 About this tool

"The test is 99% accurate and it came back positive, so I'm 99% likely to have the disease." That gut reaction is wrong, and it's the single most common mistake people make with diagnostic tests. The accuracy of the test (sensitivity) and the chance you actually have the condition given a positive (the posterior) are two different numbers. What separates them is the base rate — the prior.

This tool lets you push all three knobs and watch the posterior move. Set prevalence to 1%, sensitivity to 99%, and false-positive rate to 5%, and the posterior probability of actually being sick after a positive result is only 16.67%. Even an excellent test gets swamped by false positives when the event is rare — the classic false-positive paradox — and the two comparison bars show that gap at a glance.

It's not just for medicine. Spam filters, A/B test interpretation, fraud detection, and quality-control pass/fail decisions all share the same structure: you saw some evidence, and now you need to update the probability of a hypothesis.

🧐 Frequently Asked Questions

Q. What exactly are the prior, likelihood, and false-positive rate? The prior P(A) is the probability of the hypothesis before seeing evidence (e.g., disease prevalence). The likelihood P(B|A), or sensitivity, is the chance the evidence shows up when the hypothesis is true. The false-positive rate P(B|¬A) is the chance the evidence shows up even when the hypothesis is false.

Q. Why does a high sensitivity still give a low posterior? When the prior is very low, the sheer number of false positives from the large healthy majority outweighs the true positives from the few who are sick. This is "base rate neglect" — the cognitive trap Bayes' theorem corrects.

Q. What is the marginal probability P(B)? It's the total probability of observing the evidence — true positives plus false positives — computed as P(B|A)P(A) + P(B|¬A)(1−P(A)). It's the denominator of Bayes' theorem.

Q. I only know specificity. Can I convert it? False-positive rate = 1 − specificity. A test with 95% specificity has a 5% false-positive rate.

Q. Can I enter probabilities below 0.01%? The slider floor is 0.0001 (0.01%). For extremely rare events, approximate near that lower bound.

📚 Why the math feels counterintuitive

Thomas Bayes never published the result that bears his name; his friend Richard Price found it in his notes and read it to the Royal Society in 1763, two years after Bayes died. The general form most people learn today was actually developed independently and popularized by Pierre-Simon Laplace.

The reason the posterior surprises almost everyone is that the human brain anchors on the headline number — "99% accurate" — and quietly ignores how rare the condition is. Statisticians call this base-rate neglect, and it shows up far beyond clinical tests: in airport screening, in early COVID antigen kits, and in any "reliable detector" pointed at a rare target. Sliding the prior down toward 0.01% in this calculator reproduces that whiplash on demand, which is exactly why the prior-vs-posterior bars are placed side by side.