4.13 Bayes' theorem
Studying this course? Keep your progress in one place.
Key facts
- Bayes' theorem reverses a conditional probability: from to .
- Numerator: the one route through the cause of interest. Denominator: , the sum of all routes.
- Up to three events in a partition: , , .
- Use the law of total probability to find unknown probabilities first.
- Interpret the result: rare causes give low posteriors even with accurate tests.
What Bayes' theorem solves
It turns round into .
Often we know how likely an observation is given a cause, such as , but we want the reverse: . Bayes' theorem turns one conditional probability round into the other.
The starting probability of the cause, before the evidence, is the prior probability. The updated probability after the evidence is the posterior probability.
- 1
Prior
the probability of the cause before any evidence
- 2
Evidence
an observation, such as a positive test
- 3
Posterior
the updated probability of the cause given the evidence
Which is the posterior in 'a person tests positive; how likely is the condition?'
Two events
The route through that produces , divided by the total probability of .
From the formula booklet:
The numerator is the route through that produces . The denominator is , found by the law of total probability: add every route that produces .
Think of a tree: the first branches are the cause, the second the evidence. Multiply along branches, add the branches ending in the evidence, then divide.
- 1
Branches from B and B′
First branches are the cause
- 2
Multiply along each branch
Gives each route to A
- 3
Add the routes ending in A
This is P(A)
- 4
Divide the route through B by P(A)
This is P(B | A)
- Numerator
- Denominator, P(A)
Worked example
2% have a condition . and . Find .
- 1
Route through : .
- 2
Route through : .
- 3
.
- 4
.
Why is the denominator in Bayes' theorem?
Three events
Add all three routes in the denominator; the events must be a partition.
If , , are mutually exclusive and together cover every outcome (a partition), the denominator is the sum of all three routes:
Example: machines A, B, C make 50%, 30%, 20% of bolts with defect rates 2%, 3%, 5%. , so .
Machine C makes only 20% of the bolts but about 34% of the defective ones.
- Share of all bolts
- Share of defective bolts
In the machine example, what is P(A | D)?
Unknowns and complements
Write the law of total probability as an equation and solve for the unknown.
Some questions give and ask for a missing conditional probability first. If , , and , then , so .
For the evidence not happening, use the complementary branches: and , so .
Check your answers: every posterior lies between 0 and 1, and the posteriors for a partition add up to 1.
- Law of total probability
Worked example
, and . Find .
- 1
Let . Then .
- 2
.
- 3
.
With the values above, what is ?
Interpreting the answer
Rare conditions give many false positives, so most positives are from people without the condition.
Screening for a rare condition gives many false positives: although the test is accurate, most people tested do not have the condition, so false positives outnumber true positives. With 2% prevalence, only about 16% of positives actually have it.
A second, independent piece of evidence updates the probability again: for a scam filter, , up from after one check.
IB questions often ask you to comment: say what the number means for the person or the system.
Why do most positives come from people without the condition in the chart above?
Try an exam question
2% of a population have a condition . A test gives a positive result with probability 0.95 for people with and 0.10 for people without . (a) Find . (b) Find the probability that a person with a positive result has .
[4 marks]
- [1]Route through : .
- [1].
- [1].
- [1].
That's the notes covered.
Carry on to the next subtopic.
Try a question
Find the probability that the test is positive.
1 mark, marked against the mark scheme
Find the probability that the test is positive.
1 mark, marked against the mark scheme