A few weeks ago, I included the article “Legacy of a Bayesian Thinker” in The Mavericks Game. In the article I excerpted an explanation of Bayes Theorem, from Better Explained.
Big thanks to my super smart and eagle-eyed friend Azin who noticed that my copy-paste skills could be improved! This assumption that I included — 9.6% of mammograms detect breast cancer when it’s there (and therefore 90.4% correctly return a negative result) — should have read — 9.6% of mammograms detect breast cancer when it’s not there (and therefore 90.4% correctly return a negative result). That little “not” is obviously a big deal. 🙂
If you clicked through to Better Explained, you got the full (and correct) explanation.
The result shared remains the same — given the assumptions in the scenario, if you test positive for cancer, your actual chance of having cancer is 7.8%.
Since that’s a rather shocking result, let’s walk through the scenario ourselves.
Here’s the setup in the breast cancer testing scenario:
- 1% of women have breast cancer (and therefore 99% do not).
- 80% of mammograms detect breast cancer when it is there (and therefore 20% miss it).
- 9.6% of mammograms detect breast cancer when it’s not there (and therefore 90.4% correctly return a negative result).
Put in a table, the probabilities look like this:
Let’s build up our understanding of the scenario.
First, what is the probability of a positive test result?
Well, that’s the probability of a positive result with cancer x the probability of cancer, plus the probability of a positive test result without cancer x the probability of no cancer. Writing this as a mathematical expression,
P(A) = P(A|B) x P(B) + P(A|~B) x P(~B)
Notation:
- A, B = events
- P(A|B) = probability of A given B is true
- P(A|~B) = probability of A given B is not true
- P(A), P(B) = the independent probabilities of A and B
- P(~A), P(~B) = the independent probabilities of A and B not being true
P(+ result) = P(+ result | with cancer) x P(cancer) + P (+ result | no cancer) x P(no cancer)
P(+ result) = 80% x 1% + 9.6% x 99% = 0.008 + .095 = 0.103 = 10.3%
So the probability of a positive test result is 10.3%, regardless of whether or not you have cancer.
Next, what is the probability of a negative test result?
Similarly, that’s the probability of a negative test result with cancer x the probability of cancer, plus the probability of a negative test result without cancer x the probability of no cancer. Mathematically,
P(A) = P(A|B) x P(B) + P(A|~B) x P(~B)
P(- result) = P(- result | with cancer) x P(cancer) + P (- result | no cancer) x P(no cancer)
P(- result) = 20% x 1% + 90.4% x 99% = 0.002 + .089 = 0.897 = 89.7%
Thus the probability of a negative test result is 89.7%, regardless of whether or not you have cancer. And we can check our math as the probability of a positive test result (10.3%) plus the probability of a negative test result (89.7%) should sum to 100%. And it does.
Ok, now let’s go on to the case where you get a positive test result.
That is, the doctor says, “You have cancer.” What’s the chance you actually have cancer?
In this case, we want the probability of a positive test result with cancer x the probability of cancer, and then we divide by the overall probability of getting a positive test result — our 10.3%. Again, expressed mathematically,
P(A|B) x P(B) = P(B|A) x P(A)
Which is, P(A|B) = [P(B|A) x P(A)] / P(B)
Notation:
- A, B = events
- P(A|B) = probability of A given B is true
- P(B|A) = probability of B given A is true
P(cancer | + result) = [P(+ result | with cancer) x P(cancer)] / P(+ result)
P(cancer | + result) = [80% x 1%] / 10.3% = 0.008 / 0.103 = 0.00776 = 7.8%
So the chance you actually have cancer when you get a positive test result is 7.8%.
For those who are curious, let’s consider the case where you get a negative test result.
The doctor says, “You don’t have cancer.” What’s the chance you actually have cancer?
P(A|B) x P(B) = P(B|A) x P(A)
Which is, P(A|B) = [P(B|A) x P(A)] / P(B)
P(cancer | – result) = [P(- result | with cancer) x P(cancer)] / P(- result)
P(cancer | – result) = [20% x 1%] / 89.7% = 0.002 / 0.897 = 0.0022 = 0.22%
So 2 in 1000 people gleefully walk out of the doctor’s office thinking they do not have cancer, but they really do.
Hopefully this step-by-step has helped to illuminate the conditional probabilities of Bayes Theorem. If you find yourself intrigued, here’s a great video that explains Bayesian maths as related to geometry. And the video highlights that Bayes Theorem was used to locate a sunken ship carrying $700MM in gold! 🌟 Perhaps you’ll find your own lucky pot ‘o gold by applying Bayes Theorem. 🍀