“I’m really sorry, the vampirograph indicated that you are a vampire.” Imagine that you (or your mother/brother/girlfriend/pet scorpion) received such a message. You’re probably terrified, worrying about the future, thinking about the upcoming treatment. Wait a moment! Before you start panicking, consult… a mathematician.
Medical tests aren’t perfect. Testing positive for an illness doesn’t necessarily mean that you’re sick; for many reasons, tests can detect things that aren’t really there. On the other hand, a negative test result doesn’t exclude the disease without any doubt. The question is: can we quantify the level of uncertainty linked to a particular test? Or in this case: if you test positive on a vampirograph, what’s the probability that you’re really a vampire?
A similar question was tackled in the 18th century by a Presbyterian minister, Reverend Thomas Bayes. Bayes’ theorem became a basis for statistical inference, even though conclusions drawn from it are sometimes counter intuitive. His result gives us an explicit formula to update our prior belief about the probability of some event of interest based on additional evidence:
$$\mathbb{P}(\text{event}|\text{evidence})=\mathbb{P}(\text{event})\frac{\mathbb{P}(\text{evidence}|\text{event})}{\mathbb{P}(\text{evidence})}.$$Let’s get some intuition about this equation. I assume you’re familiar with the notion of the probability measure $\mathbb{P}$; don’t worry about a rigorous definition, a common interpretation—ie how likely the event is—will suffice. The mysterious symbols $\mathbb{P}\left(\text{something}|\text{something else}\right)$ denote a conditional probability—how likely $\text{something}$ is given that $\text{something else}$ happened.
Hold on, how did we get from vampires to estimating if a cute guy is also nice? (No, I’m not a Twilight fan.) Bayes’ theorem has many applications! Before we approach our vampire problem, we need to make a few assumptions—all numbers come from my imagination [citation needed]. The scenario is as follows:
- Of the vampirography participants, approximately 2% are in fact vampires.
- When someone is a vampire, they have 0.85 chance of being detected, ie getting a positive result from a vampirograph (so there is a 0.15 chance they remain undetected).
- When someone is an actual human being, they have 0.1 chance of being falsely “detected” (so the remaining 90% of vampirographs give legitimate negative results).
In other words numbers:
vampires (0.02) | humans (0.98) | |
positive result | 0.85 | 0.1 |
negative result | 0.15 | 0.9 |
Now assume that you tested positive on a vampirograph. What are the chances that you’re a genuine vampire? Time to ask Bayes for help.
We’re interested in $\mathbb{P}(\text{vampire}|\text{positive result})$—the probability that you’re a vampire if you tested positive. So what do the numbers tell us?
- The probability that you’re a vampire based only on the fact that you’re getting a vampirography: $\mathbb{P}(\text{vampire})=0.02$.
- The probability that you’re a human based only on the fact that you’re getting a vampirography: $\mathbb{P}(\text{human})=0.98$.
- The probability that you test positive if you’re a vampire: $\mathbb{P}(\text{positive result}|\text{vampire})=0.85$.
- The probability that you test positive if you’re a human: $\mathbb{P}(\text{positive result}|\text{human})=0.1$.
We also need the probability that you test positive regardless of what you are (you’re either a vampire or a human, we assume no other possibilities). This is a bit more tricky, but let’s see what we can squeeze out of our data. We’ll need the law of total probability, which might be interpreted as a weighted average of probabilities, where we average over all possible cases. In our example we have only two possibilities—someone is either a vampire or a human. A vampirograph gives a positive result, in each of these cases: rightly when we deal with an actual vampire and falsely when the participant is human. Therefore we can split our calculation of the probability of the positive result into these two separate cases.
\begin{align*}
\mathbb{P}(\text{positive result})&=\mathbb{P}(\text{positive result}|\text{vampire})\mathbb{P}(\text{vampire})\\&\quad+\mathbb{P}(\text{positive result}|\text{human})\mathbb{P}(\text{human})
\\&=0.85\times 0.02 + 0.1\times 0.98\\&=0.115,
\end{align*}where we have used the law of total probability. Now we’re ready to plug everything into Bayes’ formula:
\begin{align*}
\mathbb{P}(\text{vampire}|\text{positive result})&=\mathbb{P}(\text{vampire})\frac{\mathbb{P}(\text{positive result}|\text{vampire})}{\mathbb{P}(\text{positive result})}\\&=0.02 \cdot \frac{0.85}{0.115}=0.148.
\end{align*}Yes, even though vampirography seems to be pretty good at detecting vampires, if you test positive the chance that you’re actually a vampire is only 14.8%! No need to panic yet, I guess. Why is this number so small though? This is always the case with very rare conditions, when the prior probability has a big influence on the posterior. Before the test, the chance that a randomly chosen participant prefers human blood to ketchup is very small, only 2%, because this is the proportion of vampires in the population. Getting a positive result significantly increases this value, but we started from a low level, so the final probability remains quite low. Luckily most dangerous diseases, such as different types of cancer, tuberculosis or AIDS, are relatively rare, which means that conclusions of our study would be similar if you replaced being a vampire with a real illness. This means that a worrying test result was most likely a mistake, not a real problem, and that you should follow up with a doctor and possibly repeat the test.
Conclusion? Take care of yourself and get tested regularly (this article isn’t sponsored by the NHS in case you’re wondering). However, if you test positive, don’t panic and consult with a doctor… or a clergyman. Preferably Thomas Bayes.
Pingback: Adventures in Chance-ylvania | Certain about uncertainty