Conditional probability · Definition

Bayes' theorem

probabilityconditional

Before you start you need to know

It takes us from what we observe back to what caused it: updating an initial belief with new evidence.

Definition

Bayes' theorem inverts a conditional probability: it gives the probability \(P(B_j\mid A)\) of a cause \(B_j\) given an observed effect \(A\), from the probability of the effect given that cause.

\[P(B_j\mid A)=\frac{P(A\mid B_j)\,P(B_j)}{\sum_{i}P(A\mid B_i)\,P(B_i)}\]

Writing \(P(A\cap B)\) in two ways, \(P(B\mid A)P(A)=P(A\mid B)P(B)\), and solving gives \(P(B\mid A)=P(A\mid B)P(B)/P(A)\). When \(B_1,\dots,B_n\) is a partition, the denominator \(P(A)\) is computed with total probability, which yields the full formula. \(P(B_j)\) is called the prior, \(P(A\mid B_j)\) the likelihood and \(P(B_j\mid A)\) the posterior probability.

Guiding example: a disease affects 1 % of the population; the test is positive for 99 % of the sick and 5 % of the healthy. A positive result has probability \(\dfrac{0.01\cdot0.99}{0.01\cdot0.99+0.99\cdot0.05}=\tfrac16\) of belonging to a sick person. Although the test looks very reliable, the disease is so rare that false positives among the healthy outnumber true positives.

So the posterior depends both on the evidence and on the initial proportion of each case. With a coin that is either fair or two-headed, each consecutive head raises the suspicion of the trick coin: after three heads it goes from 1/2 to 8/9. This is the basis of Bayesian inference.

The most common mistake is confusing \(P(A\mid B)\) with \(P(B\mid A)\), or ignoring the prior (the «base rate fallacy»). If \(P(A\mid B_i)\) is the same for every case, observing \(A\) changes nothing: the posterior equals the prior.

Think about it

If the test were perfect (no false positives), what would be the probability of being sick after a positive?

It would be 1: the healthy term in the denominator vanishes and numerator and denominator coincide.

Why can a test with 99 % sensitivity give an inconclusive positive?

Because if the disease is rare, false positives from the huge healthy population can outnumber the true positives.

Exercises 10

References

  • Joseph K. Blitzstein, Jessica Hwang, Introduction to Probability, 2nd edition, CRC Press, 2019. §2.3
  • Sheldon Ross, A First Course in Probability, 10th edition, Pearson, 2019. §3.3
  • Larry Wasserman, All of Statistics, 1st edition, Springer, 2004. §1.4