In this problem we are going to calculate the probability that a patient has an illness given a positive test result for the illness. A positive test result means the test thinks the patient has the illness.
Things that we know:
This example was originally presented in the context of the nasal swab tests for COVID-19. I realize that may be sensitive to some of you. The seriousness of this pandemic underscores the potential for Bayesian probability to be applied to important contexts.
The probability that the patient has the illness given a positive test result is:
First lets define some useful terms:
Let $F$ be the event that the patient has the illness Let $E$ be the event that the test result is positive $P(F|E)$ = probability of the illness given a positive test. This is the number we want to calculate. $P(E|F)$ = probability of a positive result given illness = $P(E|F^c)$ = probability of a positive result given no illness = $P(F)$ = natural probability of the illness =
In this problem we know $P(F|E)$ but we want to know $P(E|F)$. We can apply Bayes Theorem to turn our knowledge of one conditional into knowledge of the reverse.
$P(F|E) = \frac{P(E|F)P(F)}{P(E|F)P(F) + P(E|F^c)P(F^c)}$
One way to build intuition for Bayes Theorem is to think about "natural frequences". Imagine we have 1000 people. Let's think about how many of those have the illness and test positive and how many don't have the illness and test positive.
We are going to color people who have the illness in blue and those without the illness in pink (those colors do not imply gender!).
$1000 \times P(F)$ people have the illness $1000 \times (1- P(F))$ people do not have the illness.
A certain number of people with the illness will test positive (which we will draw in Dark Blue) and a certain number of people without the illness will test positive (which we will draw in Dark Pink):
$1000 \times P(F) \times P(E|F)$ people have the illness and test positive $1000 \times P(F^c) \times P(E|F^c)$ people do not have the illness and test positive.
Here is the whole population of 1000 people:
The number of people who test positive and have the illness is ?. The number of people who test positive and don't have the illness is ?. The total number of people who test positive is ?.
Out of the people who test positive, the fraction that have the illness is ?/? = ? which is a close approximation of the answer. If instead of using 1000 imaginary people, we had used more, the approximation would have been even closer to the actual answer (which we calculated using Bayes Theorem).