Theorem — Bayes

Let AA and BB be two events with P(A),P(B)>0P(A), P(B) > 0. Then: P(BA)=P(AB)P(B)P(A).P(B\mid A) = \frac{P(A\mid B)\cdot P(B)}{P(A)}. If moreover {B1,,Bn}\{B_1,\ldots,B_n\} is a partition of Ω\Omega, for each BjB_j: P(BjA)=P(ABj)P(Bj)iP(ABi)P(Bi).P(B_j\mid A) = \frac{P(A\mid B_j)\cdot P(B_j)}{\sum_i P(A\mid B_i)\cdot P(B_i)}.

Proof

From the product formula P(AB)=P(AB)P(B)P(A\cap B) = P(A\mid B)\cdot P(B) and P(AB)=P(BA)P(A)P(A\cap B) = P(B\mid A)\cdot P(A), equating the right-hand sides gives the first formula. The second is the first with the total probability P(A)=iP(ABi)P(Bi)P(A) = \sum_i P(A\mid B_i)P(B_i) in the denominator. ∎

Remark — The intuition behind Bayes

Bayes’ theorem lets us invert a conditional probability: from P(AB)P(A\mid B) to P(BA)P(B\mid A). It is the tool for going from a “cause” (BB) to an “effect” (AA) and then asking, given the effect, what is the probability that BB was the cause. It is at the heart of probabilistic reasoning in medicine, justice, diagnostics, and machine learning.

Example — Diagnostic test, completed

A rare disease affects 0,1%0,1\% of the population. A diagnostic test has sensitivity 99%99\% (P(T+M)=0,99P(T^+\mid M)=0,99) and specificity 98%98\% (P(T+M)=0,02P(T^+\mid \overline{M})=0,02). A person tests positive. What is the probability that they are actually ill?

We have already computed P(T+)0,02097P(T^+) \approx 0,02097 (the sum of the two paths). Bayes: P(MT+)=P(T+M)P(M)P(T+)=0,990,0010,020970,04724,7%.P(M\mid T^+) = \frac{P(T^+\mid M)P(M)}{P(T^+)} = \frac{0,99\cdot 0,001}{0,02097} \approx 0,0472 \approx \mathbf{4,7\%}. Moral: even though the test is very accurate, the posterior probability of being ill given a positive test is only 4,7%4,7\%. The reason is that the disease is so rare that the false positives (healthy people with a positive test) far outnumber the true positives. This is the famous “base rate fallacy” in the interpretation of diagnostic tests.

Topics: Probability
Concepts: Conditional probability · Total probability · Bayes’ theorem
Methods: Bayes · Conditional prob · Total prob
Skills: Calculating probability · Using formulae
People: Thomas Bayes