Baye’s
Theorem
Prepared by: Engr. Villamor J. Dela Cruz Jr.
Instructor II
College of Engineering, Architecture &
Technology
Baye’s Thereom
• A formula in probability theory that describes how to update the probability of a
hypothesis when new evidence is introduced.
• It shows the relationship between a “prior probability” – your initial belief about an
event – and a “posterior probability” – the revised probability after accounting for new
information.
Baye’s Theorem Formula
• For two events, A and B the formula is :
Prior
Likelihood The probability of “A” being
The probability of “B” being True. This is the Knowledge
True, given “A” is True
𝑷 𝑩 𝑨 ∙ 𝑷(𝑨)
𝑷 𝑨𝑩 =
𝑷(𝑩)
POSTERIOR Marginalization
The probability of “B” being True
The probability of “A” being
True, given “B” is True
Example Scenario
Imagine a rare disease that only affects 1% of the population. A new
test for this disease is developed with the following characteristics :
• True Positive Rate (Sensitivity): The test correctly identifies the disease in 99% of people
who have it
• False Positive Rate: The test incorrectly gives a positive result in 5% of people who do not
have the disease
Now, consider a person who tests positive. What is the actual probability that this person has the
disease?
𝑷 𝑩 𝑨 ∙ 𝑷(𝑨)
Example Scenario 𝑷 𝑨𝑩 =
𝑷(𝑩)
Define the events based on the problem statement
Imagine a rare disease that only affects Marginal Likelihood, P(B): This is the probability of a person
1% of the population. A new test for this A = The person has the disease testing positive, regardless of whether they have the disease.
B = The person tests positive for the disease.
𝑷(𝑨|𝑩)
disease is developed with the following
characteristics : They have the disease AND test positive (TRUE POSITIVE)
Determine the Probabilities
• True Positive Rate (Sensitivity): The They do NOT have the disease AND test positive
test correctly identifies the disease in Prior Probability, P(A) : based on the rate of the (FALSE POSITIVE)
99% of people who have it disease in the population
Probability of not having the disease, P(not A)
P(A) = 1%
• False Positive Rate: The test P(not A) = 1 – P(A) = 1 – 0.01 = 0.99
incorrectly gives a positive result in Likelihood, P(B|A): This is the probability of a positive
5% of people who do not have the test given the person has the disease (the true positive
Probability of False Positive
rate)
disease
P(B|A) = 99%
P(B|not A) = P(false positive rate) = 5%
Now, consider a person who tests
positive. What is the actual probability Probability of Positive Test P(B)
that this person has the disease? P(B) = 𝐏 𝐁 𝐀 ∙ 𝑷 𝑨 + 𝑷 𝑩 𝒏𝒐𝒕 𝑨 ∙ 𝑷(𝒏𝒐𝒕 𝑨) (𝟎. 𝟗𝟗) ∙ (𝟎. 𝟎𝟏)
𝑷 𝑨𝑩 =
P(B) = 𝟎. 𝟗𝟗 𝟎. 𝟎𝟏 + (𝟎. 𝟎𝟓)(𝟎. 𝟗𝟗) 𝟎. 𝟎𝟓𝟗𝟒
P(B) = 𝟎. 𝟎𝟓𝟗𝟒 𝑷 𝑨 𝑩 = 𝟎. 𝟏𝟔𝟔𝟕
Even with a positive test result from a highly accurate test, there is only about a
16.7% chance that the person actually has the disease.
𝑷 𝑭 𝑴 ∙ 𝑷(𝑴)
Example Scenario 𝑷 𝑴𝑭 =
𝑷(𝑭)
Define the events based on the problem statement
During the board examination in civil
Probability of the Examinee Flunking, P(F)
engineering, there were 350 L = examinee from Luzon
examinees from Luzon, 250 from V = examinee from Visayas
𝑷 𝑴𝑭 𝑷 𝑭 = 𝑷 𝑭 𝑳 ∙ 𝑷 𝑳 + 𝑷 𝑭 𝑽 ∙ 𝑷 𝑽 + 𝑷 𝑭 𝑴 ∙ 𝑷(𝑴)
Visayas, and 400 from Mindanao. M = examinee from Mindanao
F = examinee is a flunker 𝟑𝟓𝟎
The results of the exam revealed 𝑷 𝑭 𝑳 = 𝟑% 𝑷 𝑳 = = 𝟎. 𝟑𝟓
𝟏𝟎𝟎𝟎
that the flunkers from Luzon,
𝟐𝟓𝟎
Visayas, and Mindanao were 3%, 𝑷 𝑭 𝑽 = 𝟓% 𝑷 𝑽 = = 𝟎. 𝟐𝟓
The probability of a person flunking given they are from 𝟏𝟎𝟎𝟎
5% and 7% respectively. If the name mindanao
of the flunker is picked at random, 𝑷 𝑭 𝑴 = 𝟕% 𝑷 𝑭 𝑴 = 𝟕%
what is the probability that he/she is
from Mindanao? 𝑷 𝑭 = 𝟎. 𝟎𝟑 𝟎. 𝟑𝟓 + 𝟎. 𝟎𝟓 𝟎. 𝟐𝟓 + (𝟎. 𝟎𝟕)(𝟎. 𝟒𝟎)
The probability of a person flunking given they are from
Mindanao 𝑷 𝑭 = 𝟎. 𝟎𝟓𝟏
𝟒𝟎𝟎 𝟒𝟎𝟎
𝑷 𝑴 = = = 𝟎. 𝟒𝟎 (𝟎. 𝟎𝟕) ∙ (𝟎. 𝟒𝟎)
𝟑𝟓𝟎 + 𝟐𝟓𝟎 + 𝟒𝟎𝟎 𝟏𝟎𝟎𝟎 𝑷 𝑴𝑭 =
𝟎. 𝟎𝟓𝟏
The probability of that the Flunker is from Mindanao 𝟐𝟖
is 28/51 or 54.9%. = = 𝟎. 𝟓𝟒𝟗
𝟓𝟏
Homework
1. In a certain town, 60% of the people have fair complexion, 40% have a tall height, and
20% have both fair complexion and tall height. A person is selected at random from the
town.
a.) if the person has a fair complexion, what is the probability that he or she also has a
tall height?
b.) If the person has a tall height, what is the probability that he or she does not have a
fair complexion?
Homework
2. Two urns contain balls of different colors. Urn 1 contains 4 red, and 3 black balls, and
Urn 2 contains 5 red and 4 black balls. One ball is transferred from Urn 1 to Urn 2 and
then a ball is drawn from Urn 2. If the ball drawn is found to be red in color, what is the
probability that the transferred ball is black?