Bayes’ Theorem Examples
Example 1
Historical Data.
P(cavity) = 0.1 — 10%
P(toothache) = 0.05 — 5%
P(Cavity | toothache) = 0.8 — 80%
Future Prediction:
P(toothache | cavity) = ?
using bays law à P(B|A) = {P(A|B)P(B)}/P(A)
P(toothache | cavity) = {P(cavity | toothache) P(toothache) } / P(cavity)
= (0.8*0.05)/0.1 = 0.4
Example 2
If HIV has a prevalence of 3% in San Francisco, and a particular HIV test has a false positive rate of .001 and a false negative rate of .01, what is the probability that a random person who tests positive is actually infected (also known as “positive predictive value”)?
Solution of Example 2
We have to find the probability of hiv+ given the report is positive.
Using Bayes theorem
P(hiv+|t+) = P(t+|hiv+)P(hiv+) / P(t+)
Now,
false positive P(t+|hiv-) = .001
P(t-|hiv-) =1-.001 = .999
false negative = P(t-|hiv+) = .01
P(t+|hiv+) = 1-.01 = .99
P(t+) = P(t+&hiv+) + P(t+&hiv-)
=P(t+|hiv+)P(hiv+) + P(t+|hiv-)P(hiv-)
= .99*.03 + .001*.97
Putting all these values in equation
P(hiv+|t+) = P(t+|hiv+)P(hiv+) / P(t+)
= (.99 * .03)/{.99*.03 + .001*.97}
= .968 ===> 96.8%
Bayes’s Theorem Example 1
Bayes’s Theorem Example 2
Bayes’s Theorem Example 3