Total Probability and Bayes' Theorem: Quick Revision | StemPy Lab
MathematicsAlso Statistics & Data Science
Total Probability and Bayes' Theorem: Quick Revision
A brief note on total probability and Bayes' theorem: partitions, the law of total probability, the reversal of a condition, natural frequencies and the common traps. With a worked example, practice, a program and questions to check yourself.
Natural frequencies: take a large round number of cases, count the cases on each path to A, and divide.
Sum: the posteriors of a partition add up to 1.
Tests and traps
Sensitivity:P(+∣ill). Specificity:P(−∣healthy).
Base rate: a positive result for a rare illness is often a false alarm.
Prosecutor's fallacy:P(evidence∣innocent) is not P(innocent∣evidence).
Three doors: a host who knows where the prize is makes switching win with probability 32.
Second test: the posterior of the first test is the prior of the second, for independent tests.
A worked example
Two bags are chosen by the toss of a fair coin. Bag 1 holds 3 red and 1 blue ball. Bag 2 holds 1 red and 3 blue balls. A ball is drawn and it is red.
The paths to red. Bag 1: 21×43=83. Bag 2: 21×41=81.
The total.P(red)=83+81=21.
The posterior.P(bag 1∣red)=1/23/8=43.
Practice with new numbers
A program to try
The program finds the three answers of the worked example with exact fractions.
Mistakes to avoid
Turning the condition around.P(+∣ill) is not P(ill∣+).
Dividing by one path. The bottom of Bayes' theorem is the sum of all the paths to A.
Ignoring the prior. Rare causes stay unlikely.
Cases that overlap or leave a gap. Check that the shares add up to 1.
Check yourself
Given P(B)=0.4, P(A∣B)=0.5 and P(A∣B′)=0.25, find P(A).
For the same events, find P(B∣A).
A disease affects 4% of a group. A test finds 80% of the ill people and clears 95% of the healthy people. A person tests positive. What is the probability that the person is ill?
Why do the posteriors of a partition add up to 1?
In a game with 5 doors, you pick one. The host, who knows where the prize is, opens 3 other doors, all empty. You switch to the last closed door. What is the probability that you win?
Sources
OpenStax, Introductory Statistics, Chapter 3, sections on the rules of probability, contingency tables and tree diagrams.
NCERT, Mathematics Part II for Class XII, Chapter 13, sections on the theorem of total probability and Bayes' theorem.