Example 1: Spam Detection
Let’s say historically, 20% of emails are spam, so
and the probability that the email is not spam is
.
Suppose the probability of observing the word “free” in a spam email is 0.8, , and in a non-spam email is 0.05,
.
Now, if we receive an email containing the word “free”, we want to know the probability that it’s spam.
Using Bayes’ Theorem:
We need to calculate , the overall probability of observing the word “free”:
Now, plugging into Bayes’ Theorem:
So, given that the email contains the word “free”, there’s an 80% chance it’s spam.
Example 2: Medical Diagnosis
Suppose the prevalence of a rare disease is 0.01, so and
.
Let’s say the sensitivity of the test (probability of a positive result given the patient has the disease) is 0.95, , and the specificity (probability of a negative result given the patient doesn’t have the disease) is 0.90,
.
If a patient tests positive, we want to find the probability they actually have the disease.
Using Bayes’ Theorem:
We need to calculate , the overall probability of testing positive:
Now, plugging into Bayes’ Theorem:
So, if the patient tests positive, there’s approximately an 8.76% chance they actually have the disease.
Discover more from Science Comics
Subscribe to get the latest posts sent to your email.