Ad Space
Posterior Probability P(A | B)

Probability Tree

Reading the treeThe tree splits first on A vs. ¬A (the prior), then each branch splits again on B vs. ¬B. The two highlighted branches ending in B are exactly the numerator and denominator of Bayes' theorem — P(A|B) is the highlighted top branch's share of all the highlighted branches combined.

Ad Space

Bayes' Theorem Explained

Bayes' theorem tells you how to correctly update a belief in light of new evidence — converting "how likely is the evidence, given the hypothesis" into "how likely is the hypothesis, given the evidence."

P(AB)=P(BA)P(A)P(BA)P(A)+P(B¬A)P(¬A)P(A|B) = \frac{P(B|A) \, P(A)}{P(B|A)\,P(A) + P(B|\lnot A)\,P(\lnot A)}

P(A|B): the posterior probability: the updated probability of A being true, given evidence B. This is what you're solving for.

P(A): the prior probability of A, before seeing any evidence.

P(B|A): the likelihood: the probability of observing evidence B given that A is true.

P(¬A): the prior probability that A is false, equal to 1 − P(A).

P(B|¬A): the probability of observing evidence B given that A is false.

Worked Example: The Medical Test Paradox

Using the calculator's default values above — a disease with 1% prevalence, a test with 99% sensitivity, and a 5% false positive rate — a positive result gives a posterior probability of only about 16.7%, not 99%. Out of 10,000 people, about 100 actually have the disease (99 test positive), but among the 9,900 healthy people, 5% — about 495 — also test positive. So among all 594 positive results, only 99 are real cases: 99/594 ≈ 16.7%. This is the base rate fallacy in action: the disease's rarity matters just as much as the test's accuracy.

Why Intuition Gets This Wrong

Most people, on hearing "99% accurate test, positive result," intuitively expect something close to 99% certainty. That intuition ignores the base rate entirely — it implicitly assumes the condition is common, when in this example it's actually rare. Bayes' theorem forces the base rate back into the calculation explicitly, which is exactly why doctors are trained to interpret single positive screening tests cautiously and often order a confirmatory second test before treating a diagnosis as certain.

A Brief History of Bayes' Theorem

Reverend Thomas Bayes developed the theorem's core idea in the 1740s and 50s, though it was published posthumously in 1763 after his death, edited and presented by his friend Richard Price. Pierre-Simon Laplace independently rediscovered and significantly generalized the result a few decades later, developing much of what's now recognized as Bayesian probability theory. The framework fell somewhat out of favor for a long stretch of the 20th century in favor of frequentist statistics, before resurging dramatically since the 1990s as Bayesian methods became central to modern machine learning and statistical inference.

Common Bayes' Theorem Mistakes

Confusing P(B|A) with P(A|B) — treating a test's accuracy as if it directly told you the probability the condition is present — is the single most common error, sometimes called the "prosecutor's fallacy" in legal contexts. Forgetting to include the base rate P(A) entirely, effectively assuming a 50/50 prior, is another frequent mistake that skews results dramatically for rare conditions or events. Using percentages that don't represent true probabilities (like non-representative sample statistics) as if they were the real base rate is a third common pitfall.

Bayesian Statistics Terms You Should Know

Prior Probability — the initial probability estimate for a hypothesis before seeing new evidence.

Posterior Probability — the updated probability estimate after incorporating new evidence.

Likelihood — the probability of observing the evidence given a particular hypothesis, P(B|A).

Base Rate Fallacy — the common error of ignoring how common or rare a condition is when interpreting new evidence about it.

This calculator assumes A and ¬A are the only two possibilities and that the given conditional probabilities are accurate; real-world estimates of these probabilities carry their own uncertainty.

Frequently Asked Questions

Why is a positive medical test result often much less certain than it feels?

Because when a condition is rare, even a small false-positive rate produces more false positives in absolute terms than true positives, once you account for how few people actually have the condition in the first place. This is the base rate fallacy — intuition focuses on the test's accuracy and forgets how rare the condition is, while Bayes' theorem correctly weighs both.

What's the difference between P(B|A) and P(A|B)?

They answer different questions and are easy to confuse. P(B|A) is the probability of evidence B given that A is true (e.g., a test's sensitivity — how often it correctly flags someone who has a condition). P(A|B) is the reverse — the probability A is true given that you've observed evidence B (e.g., how likely someone actually has the condition, given a positive test). Bayes' theorem is precisely the tool for converting one into the other.

Where is Bayes' theorem used outside of medical testing?

Extremely widely — spam filters use it to judge whether an email is spam given which words it contains, forensic and legal reasoning uses it to weigh evidence, machine learning uses Bayesian methods for classification and uncertainty estimation, and search-and-rescue operations use it to update the probable location of a missing person as new information arrives. Anywhere a belief needs to be updated in light of new evidence, Bayes' theorem is the formal tool for doing it correctly.

Ad Space