In an earlier post (back in 2011) I mentioned that it would be interesting to visit Eliezer Yudkowsky's site and in particular his explanation of Bayes' theorem. It still is. In the post I posed the question that Eliezer uses on his site and gave the answer but I suggested you go and visit his site to find out how to calculate it. I didn't realise how common that question was back then. I was thinking about it recently and thought it might be nice to show another, more graphical way of getting to grips with the calculation.
Here is the question:
1% of women at age forty who participate in routine screening have breast cancer. 80% of women with breast cancer will get positive mammographies. 9.6% of women without breast cancer will also get positive mammographies. A woman in this age group had a positive mammography in a routine screening. What is the probability that she actually has breast cancer?
Remember that in tests, only 15% of doctors got the correct answer. The same is true in courts where probability of guilt is calculated. There are lots of examples and it's pretty serious. Bayes' Theorem really needs to be better understood.
Step 1
Right, we can draw the following tree.
1% of women (0.01) have cancer.
Therefore, 99% do not (0.99).
We mark the values on the branches as shown
0.01
--------- C [cancer]
|
|
|
|
|
|
start
|
|
|
|
|
| 0.99
--------- NC [no cancer]
What else do we know?
0.01
--------- C [cancer]
|
|
|
|
|
|
start
|
|
|
|
|
| 0.99
--------- NC [no cancer]
Step 2
What else do we know?
80% (0.8) of women with breast cancer will get positive mammographies. 9.6% (0.096) of women without breast cancer will also get positive mammographies.
0.8
---------- P [positive]
|
|
0.01 |
--------- C [cancer]
| |
| |
| |
| ---------- N [negative]
|
|
start
|
| 0.096
| ---------- P [positive]
| |
| |
| 0.99 |
--------- NC [no cancer]
|
|
|
---------- N [negative]
So the question is, given the above tree, a woman gets a positive mammography in a routine screening. What is the probability that she actually has breast cancer?
0.8
---------- P [positive]
|
|
0.01 |
--------- C [cancer]
| |
| |
| |
| ---------- N [negative]
|
|
start
|
| 0.096
| ---------- P [positive]
| |
| |
| 0.99 |
--------- NC [no cancer]
|
|
|
---------- N [negative]
So the question is, given the above tree, a woman gets a positive mammography in a routine screening. What is the probability that she actually has breast cancer?
Step 3
I want to fill in the missing branches just to make it complete. So before we get into calculating our answer we'll tidy up.
0.8
---------- P [positive]
|
|
0.01 |
--------- C [cancer]
| |
| |
| | 0.2
| ---------- N [negative]
|
|
start
|
| 0.096
| ---------- P [positive]
| |
| |
| 0.99 |
--------- NC [no cancer]
|
|
| 0.904
---------- N [negative]
The thing to do here, is to make the related branches add up to 1.0.
So 0.8 + 0.2 = 1.0
And from the other node, 0.096 + 0.904 = 1.0
That is the probability of going down one of those two routes at each node is 100% (1.0)
Step 4
We calculate the final nodes, (they are intersections actually but that terminology might be confusing in this diagram. The intersections between C and P, C and N etc)
But
0.8
---------- P C ∩ P = 0.01x0.8 = 0.008
|
|
0.01 |
--------- C [cancer]
| |
| |
| | 0.2
| ---------- N C ∩ N = 0.01x0.2 = 0.002
|
|
start
|
| 0.096
| ---------- P NC ∩ P = 0.99x0.096 = 0.095
| |
| |
| 0.99 |
--------- NC [no cancer]
|
|
| 0.904
---------- N NC ∩ N = 0.99x0.904 = 0.895
Step 5
Now answer the question.A woman gets a positive mammography in a routine screening. What is the probability that she actually has breast cancer?
So we write this as,
P( P | C)
which means Probability( Positive | Cancer),
or, the probability of getting a Positive, given that the woman has Cancer.
This is conditional probability.
P( P | C ) can be converted to:
C ∩ P Note that C ∩ P = P ∩ C
P
So we plug in the numbers:
C ∩ P = 0.008
P 0.008 + 0.095 <--(all of the posibilities of being positive)
= 0.008
0.103
= 0.77 or 7.7%
most of the doctors when tested, estimated the figure to be around 70%!
The equation
It doesn't look too much like Bayes' theorem though does it. It might be good to work toward the equation now though we don't need to know it to do conditional probablity.
P(A|B)is read as the probability of A given B. So we know B, or B has happened, so what is the probability of A.
P(A|B) = P(A ∩ B)
P(B)
P(A ∩ B) = P(A|B).P(B)
It can be noted that
P(A ∩ B) = P(B ∩ A)
Also,
P(A ∩ B) = P(A|B).P(B)
P(A ∩ B) = P(B|A).P(A)
P(A|B).P(B) = P(B|A).P(A)
P(A|B) = P(B|A).P(A)
P(B)