Guides Math & Statistics

How Bayes' Theorem Works

Bayes' theorem explained with natural frequencies: how a 90 % accurate test with a 1 % base rate gives only a 9 % chance of disease, how likelihood ratios update beliefs, and where it goes wrong.

Last reviewed:

AdSense Placeholder
Slot: header_reference_page
On this page

Bayes' theorem tells you how to update the probability of something (a hypothesis A) after seeing evidence (B): P(A|B) = P(B|A) × P(A) / P(B). Its famous lesson is that how common something is to begin with matters as much as how good the test is. Run your own numbers in the Bayes’ Theorem Calculator; the term is defined in Bayes' Theorem.

The idea in one example

Suppose 1 % of people have a condition, a test detects it 90 % of the time (sensitivity) and wrongly flags 9 % of healthy people (so specificity is 91 %). You test positive. What is the chance you have it?

Count people instead of probabilities

Out of 10,000 people Test positive Test negative Total
Have the condition 90 10 100
Healthy 891 9,009 9,900
Total 981 9,019 10,000

Of the 981 positive results only 90 are real, so the chance is 90 / 981 = 9.17 %, not 90 %. A negative result is 99.89 % likely to be correct.

Updating with a second test

In odds form: prior odds 1 : 99, times the likelihood ratio 0.90 / 0.09 = 10, give posterior odds 10 : 99, which is 9.2 %. A second independent positive test multiplies the odds by 10 again: the chance becomes 50.3 %.

Where people go wrong

  • Ignoring the base rate (the base-rate fallacy): quoting the test's accuracy as if it were the chance of being right.
  • Mixing up directions: P(positive | sick) is not P(sick | positive).
  • Assuming independence: repeated tests by the same method often share errors, so each does not add the full factor of 10.
  • Estimates of the prior and the error rates are themselves uncertain; the answer is only as good as they are.

Try these tools

See also

  • Glossary Bayes' Theorem
    Bayes' theorem is the rule for updating the probability of a hypothesis after seeing new evidence: P(A|B) = P(B|A) × P(A) / P(B).
  • Glossary Probability
    Probability is a number from 0 (impossible) to 1 (certain) that measures how likely an event is.
  • Glossary Confidence interval
    A confidence interval is a range around a sample estimate that would contain the true value in a stated share (such as 95%) of repeated.
  • Comparison Relative Risk vs Odds Ratio
    Two ways to compare an outcome between two groups: how they are calculated from a 2 × 2 table.
  • Cheat sheet Statistics Formulas Cheat Sheet
    Mean, standard deviation, z-score, confidence intervals, chi-square.

Frequently Asked Questions

When a condition is rare, the small share of false positives among the many healthy people can outnumber the true positives among the few sick ones. This is the base-rate effect.

AdSense Placeholder
Slot: footer_leaderboard