What is Bayes' theorem?
The relation that reverses the direction of a conditional probability: P(A | B) = P(B | A) × P(A) ÷ P(B). It is used to update the prior probability P(A) of a cause A into the posterior probability P(A | B) on the basis of an observed result B. It is used for calculating the positive predictive value of a test, for spam filtering (naive Bayes) and for estimating the causes of failures. It also shows the effect of the base rate: when the cause is rare, many positives are false even for an accurate test.
Japanese name: ベイズの定理
Bayes' theorem appears in 2 practice questions across 2 topics, including Probability, Statistics and Queueing, Machine Learning Basics.
Field: Probability, Statistics and Queueing
Working through a test example
Consider a test that judges 99% of defective parts positive and wrongly judges 1% of good parts positive, when 0.1% of parts are defective. Out of 1 million parts, 990 of the 1,000 defective ones test positive, and 9,990 of the 999,000 good ones also test positive. Only 990 ÷ (990 + 9,990) ≈ 9% of the positives are really defective. Replacing probabilities with concrete counts in a table like this gives the right answer even without remembering the formula.
FAQ
Why are many positives false even for an accurate test?
When the cause (a defect or disease) is very rare among the things tested, the number of good items wrongly judged positive exceeds the number of true positives. For example, if good items outnumber defective ones 1,000 to 1, even a 1% error rate gives about ten times as many positives as there are defective items. How far a positive result can be trusted depends not only on the accuracy of the test but also on the original proportion (the base rate).
How does it differ from conditional probability?
A conditional probability is the quantity itself, "the probability that A occurs when B has occurred", while Bayes' theorem is a formula expressing the relationship between P(A | B) and P(B | A), with the direction reversed. It is used when the known accuracy of a test is P(positive | defective) but what you want is P(defective | positive).