Bayes Theorem Application
Bayes Theorem Application
Bayes Theorem Application
Solution:
P(B|¬A) is the probability of testing positive given that you don't have the
disease, which is the false positive rate. In this case, it's 5% (0.05).
P(¬A) is the probability of not having the disease, which is 99% (1 - 0.01).
So, if a person tests positive for the disease, the probability that they
actually have it is approximately 63.7%.
Example 2: Email Spam Detection
Solution:
We want to find P(B|A), the probability that the email is spam given that it
contains the keywords. Using Bayes' theorem:
P(A) = P(A|B) * P(B) + P(A|¬B) * P(¬B) P(A) = (0.90 * 0.30) + (0.10 * 0.70) =
0.27 + 0.07 = 0.34
So, if an email contains the keywords, the probability that it's spam is
approximately 79.4%.
Solution:
A: It rains (P(A) = ?)
B: Meteorologist predicts rain (P(B) = 0.70)
¬B: Meteorologist predicts no rain (P(¬B) = 0.30)
P(A|B) = 0.60 (probability of correct rain prediction)
P(A|¬B) = 0.90 (probability of correct no-rain prediction)
We want to find P(A|B), the probability that it will rain given the
meteorologist's prediction. Using Bayes' theorem:
P(B) = P(B|A) * P(A) + P(B|¬A) * P(¬A) P(B) = (0.60 * P(A)) + (0.30 * (1 - P(A)))
0.70 = 0.60P(A) + 0.30 - 0.30P(A) 0.40P(A) = 0.40 P(A) = 0.40 / 0.40 P(A) = 1
Now that we know P(A) is 1, we can use Bayes' theorem to find P(A|B):
Solution: Let A be the event that a person has Disease X, and B be the event
that the test result is positive. We want to find P(A | B), the probability that
a person has the disease given a positive test result.
P(B | A) = Probability of a positive test result given that a person has the
disease = 1 - False Negative Rate = 1 - 0.02 = 0.98 P(A) = Prior probability
of having the disease = 0.01 P(B) = Total probability of a positive test result
= P(B | A) * P(A) + P(B | ¬A) * P(¬A) = (0.98 * 0.01) + (0.05 * 0.99) ≈ 0.0587
So, given a positive test result, the probability that a person actually has
Disease X is approximately 16.68%.
Suppose you receive an email, and your spam filter has previously
determined that 90% of spam emails contain the word "free," while only
10% of legitimate emails contain this word. If the email you received
contains the word "free," what is the probability that it's spam?
Solution: Let A be the event that an email is spam, and B be the event that
the email contains the word "free." We want to find P(A | B), the probability
that the email is spam given that it contains the word "free."
So, if an email contains the word "free," the probability that it's spam is
90%.
Suppose you have two coins in a bag. Coin A is a fair coin (50% chance of
heads), while Coin B is biased (80% chance of heads). You randomly choose
one of the coins and toss it, and it comes up heads. What is the probability
that you chose Coin B?
So, if you got heads, the probability that you chose Coin B is approximately
61.54%.