Conditional probability and Bayes' theorem
P(A | B) is the probability of A once B is known. Bayes' theorem turns the condition around.
Formulas
- P(A | B) = P(A ∩ B) / P(B)
- Total probability: P(B) = P(B | A) · P(A) + P(B | Ā) · P(Ā)
- Bayes: P(A | B) = P(B | A) · P(A) / P(B)
Your turn
Three problems on this topic. Comma or point, fractions like 1/6 work too.
Task
A disease affects 2% of people. A test detects the ill with 90% (sensitivity) and the healthy with 97% (specificity). What is P(ill | positive test)?
P (4 decimal places)
Comma or point; fractions like 1/6 work too.
Worked example
A disease affects 5% of people. A test detects the ill with 95% (sensitivity) and the healthy with 97% (specificity). What is P(ill | positive test)?
Worked solution
- 1.P(+) = 0.95 · 0.05 + 0.03 · 0.95 = 0.0760
- 2.Bayes: P(ill | +) = P(+ | ill) · P(ill) / P(+) = 0.0475 / 0.0760 = 0.6250
Typical mistake: Confusing P(ill | +) with the sensitivity P(+ | ill).
Two-way table: passed (P) and attended lectures (A). What is P(P | A)?
Worked solution
- 1.P(P | A) = number (P and A) / number A = 27 / (27 + 23) = 0.5400
Typical mistake: Dividing by the grand total instead of the total of the condition.
Frequently asked questions
Why is P(ill | positive) often small?
For rare diseases there are far more healthy people, so even a few false positives outnumber the true positives.
