Exam PProbability foundationsFree to read

Bayes' theorem and the law of total probability

Reverse a conditional probability: weight each cause by its prior and its likelihood, then normalise. The denominator is always the law of total probability.

The formulas

Law of total probability
P(A)=∑kP(A∣Bk)P(Bk)P(A) = \sum_{k} P(A\mid B_k)P(B_k)
Bayes
P(Bj∣A)=P(A∣Bj)P(Bj)∑kP(A∣Bk)P(Bk)P(B_j\mid A) = \dfrac{P(A\mid B_j)P(B_j)}{\sum_k P(A\mid B_k)P(B_k)}
Two-event form
P(B∣A)=P(A∣B)P(B)P(A∣B)P(B)+P(A∣Bc)P(Bc)P(B\mid A) = \dfrac{P(A\mid B)P(B)}{P(A\mid B)P(B) + P(A\mid B^{c})P(B^{c})}
Odds form
P(B1∣A)P(B2∣A)=P(A∣B1)P(A∣B2)⋅P(B1)P(B2)\dfrac{P(B_1\mid A)}{P(B_2\mid A)} = \dfrac{P(A\mid B_1)}{P(A\mid B_2)}\cdot\dfrac{P(B_1)}{P(B_2)}

Where it comes from

  1. The partition {Bk}\{B_k\} cuts AA into disjoint pieces A∩BkA \cap B_k, so P(A)=∑kP(A∩Bk)=∑kP(A∣Bk)P(Bk)P(A) = \sum_k P(A\cap B_k) = \sum_k P(A\mid B_k)P(B_k).
  2. Bayes is then just P(Bj∣A)=P(A∩Bj)/P(A)P(B_j\mid A) = P(A\cap B_j)/P(A) with both parts rewritten using the multiplication rule.
  3. The odds form drops the shared denominator, which is why it is faster when only a ratio is asked for.

Worked example

A motor book is 50% low risk, 30% standard and 20% high risk, with annual claim probabilities of 2%, 5% and 11%. A policyholder claims this year. What is the probability they are high risk?

  1. Total probability of a claim: 0.5(0.02)+0.3(0.05)+0.2(0.11)=0.0470.5(0.02) + 0.3(0.05) + 0.2(0.11) = 0.047.
  2. Bayes numerator for high risk: 0.2×0.11=0.0220.2 \times 0.11 = 0.022.
  3. P(high∣claim)=0.0220.047=0.4681P(\text{high}\mid\text{claim}) = \dfrac{0.022}{0.047} = 0.4681.
  4. The high-risk group is 20% of the book but 46.8% of the claimants - the prior has been sharply updated.

Answer: 0.4681

This answer is recomputed from the site’s own interest-theory and probability functions every time the test suite runs, so the page and the mathematics cannot drift apart.

Memory hooks

  • Numerator is one prior times one likelihood; denominator is the sum of all of them. The posteriors must sum to 1 - check it.
  • The denominator IS the law of total probability. Compute it once and reuse it for every class.

Traps

  • Forgetting a class in the denominator, so the posteriors do not sum to 1.
  • Swapping prior and likelihood - the prior is the class probability, the likelihood is the event probability GIVEN the class.

Related

Drill this: the Exam P question bank has original questions on this topic, and today’s free round is open to everyone.