Professional Documents
Culture Documents
Bayes' Theorem and Its Applications
Bayes' Theorem and Its Applications
A REPORT BY
Formula 1-1 (Bayes’ Formula). Let H = {H1, H2, …} be a positive partition of S, and A be an
event with P(A) > 0. Then for any event Hk of the partition H,
𝐏(𝐇𝐤 ) 𝐏(𝐀|𝐇𝐤 )
𝐏(𝐇𝐤 |𝐀) = 𝒏
∑ 𝐏(𝐇𝐣 ) 𝐏(𝐀|𝐇𝐣 )
𝒋=𝟏
𝐏(𝐇𝐤 ) 𝐏(𝐀|𝐇𝐤 )
𝐏(𝐇𝐤 |𝐀) = ∞
∑ 𝐏(𝐇𝐣 ) 𝐏(𝐀|𝐇𝐣 )
𝒋=𝟏
𝐏 ( 𝐀 𝐁)
𝐏 ( 𝐀 | 𝐁) =
𝐏 ( 𝐁)
Note. The numerator is derived from the rule of multiplication. The denominator follows the
formula for total probability P(A), defined as:
∞ n
P(A) = ∑ 𝐏(𝐇𝐣 ) 𝐏(𝐀|𝐇𝐣), or ∑ 𝐏(𝐇𝐣 ) 𝐏(𝐀|𝐇𝐣 )
𝒋=𝟏 𝒋=𝟏
Formula 1-2 (Special Case). In the case of a partition (positive) into two events, H = {B, B c}, and
any event A with P (A) > 0, we have:
𝐏(𝐁) 𝐏(𝐀|𝐁)
𝐏 ( 𝐁|𝐀 ) =
𝐏(𝐁) 𝐏(𝐀|𝐁) + 𝐏(𝐁 𝐜 ) 𝐏(𝐀|𝐁𝐜 )
Formula 1-2 is particularly used in False Positives and False Negatives, which will be tackled
through examples below.
(Source: Bartoszynski, R., & Niewiadomska-Bugaj, M. (2008). Probability and Statistical
Inference, 2nd Edition. Hoboken, NJ. John Wiley & Sons, Inc.)
Example 1. In a certain factory, machines I, II, and III are all producing springs of the same
length. Of their production, machines I, II, and III respectively produce 2%, 1%, and 3% defective
springs. Of the total production of springs in the factory, machine I produces 35%, machine II
produces 25%, and machine III produces 40%. Find the posterior probability of machine III
producing defective springs.
Solution:
Let D be the event of getting a defective spring. If one spring is selected at random from the total
springs produced in a day, then by the law of total probability:
If the selected spring is defective, the conditional probability that it was produced by machine III
is, by Bayes’ formula;
𝐏(𝐈𝐈𝐈) 𝐏(𝐃|𝐈𝐈𝐈)
𝐏(𝐈𝐈𝐈|𝐃) =
𝐏(𝐃)
(𝟎. 𝟒𝟎) (𝟎. 𝟎𝟑)
𝐏(𝐈𝐈𝐈|𝐃) =
𝟎. 𝟎𝟐𝟏𝟓
𝐏(𝐈𝐈𝐈|𝐃) 𝟎. 𝟓𝟓𝟖𝟏
Note how the posterior probability of III (= 0.5581) increased from the prior probability of III (=
0.40) after the defective spring was observed, because III produces a larger percentage of
defectives than I and II.
(Source: Hogg, R., Tanis, E., & Zimmerman, D., (2015). Probability and Statistical Inference, 9th
Edition. Upper Saddle River, NJ. Pearson Education Inc.)
Example 2. In the United States, there are about 8 women in 100,000 who develops cervical
cancer. A Pap smear is a screening procedure used to detect this cancer. The procedure records
16% false negatives and 10% false positives. Find the probability of a Pap smear detecting a true
case of cervical cancer.
Solution:
Let C be the event of a woman getting cancer, and T be the event of Pap smear producing the
result. For women with this cancer, there are about 16% false negatives. For women without
cancer, there are about 10% false positives. In summary, that is;
Pap Smear detects cervical Pap Smear did not detect
cancer cervical cancer
Women with cervical cancer 0.84 0.16
Women without cervical
0.10 0.90
cancer
Also, the probability of a women having cervical cancer is 0.00008, so the compliment is 0.99992.
Example 3. Consider two urns. The first contains two white and seven black balls, and the second
contains five white and six black balls. We flip a fair coin and then draw a ball from the first urn
or the second urn depending on whether the outcome was heads or tails. What is the conditional
probability that the outcome of the toss was heads given that a white ball was selected?
Solution:
Let W be the event that a white ball is drawn, and let H be the event that the coin comes up heads.
The desired probability P(H|W) may be calculated as follows:
𝐏(𝐇) 𝐏(𝐖|𝐇)
𝐏(𝐇|𝐖) =
𝐏(𝐇) 𝐏(𝐖|𝐇) + 𝐏(𝐇 𝐜 ) 𝐏(𝐖|𝐇𝐜 )
𝟏 𝟐
( )( )
𝐏(𝐇|𝐖) = 𝟐 𝟗
𝟏 𝟐 𝟏 𝟓
(𝟐)(𝟗) + (𝟐)(𝟏𝟏)
𝟐𝟐
𝐏(𝐇|𝐖) =
𝟔𝟕
(Source: Ross, S., (2010). Introduction to Probability Models, 10th Edition. Los Angeles, CA.
Elsevier Inc.)
Example 4. A laboratory blood test is 95 percent effective in detecting a certain disease when it
is, in fact, present. However, the test also yields a “false positive” result for 1 percent of the healthy
persons tested. (That is, if a healthy person is tested, then, with probability 0.01, the test result will
imply he has the disease.) If 0.5 percent of the population actually has the disease, what is the
probability a person has the disease given that his test result is positive?
Solution:
Let D be the event that the tested person has the disease, and E the event that his test result is
positive. The desired probability P(D|E) is obtained by:
Detected Not Detected
Present 0.95 0.05
Also, the probability of a person having the disease is 0.005, so the compliment is 0.995.
𝐏(𝐃) 𝐏(𝐄|𝐃)
𝐏(𝐃|𝐄) =
𝐏(𝐃) 𝐏(𝐄|𝐃) + 𝐏(𝐃𝐜 ) 𝐏(𝐄|𝐃𝐜)
(𝟎. 𝟎𝟎𝟓)(𝟎. 𝟗𝟓)
𝐏(𝐃|𝐄) =
(𝟎. 𝟎𝟎𝟓)(𝟎. 𝟗𝟓) + (𝟎. 𝟗𝟗𝟓) (𝟎. 𝟎𝟏)
𝟗𝟓
𝐏(𝐃|𝐄) = 𝟎. 𝟑𝟐𝟑
𝟐𝟗𝟒
(Source: Ross, S., (2010). Introduction to Probability Models, 10th Edition. Los Angeles, CA.
Elsevier Inc.)
Formula 1-3 (Updating the Evidence). Let H = {H1, H2, …} be a partition, and let A and B be
two events. If P(A B) > 0, then for every Hk in partition H, we have:
𝐏(𝐁 | 𝐀 𝐇𝐤 ) 𝐏(𝐇𝐤 | 𝐀)
=
∑ 𝐏(𝐁 | 𝐀 𝐇𝐣 ) 𝐏(𝐇𝐣 | 𝐀)
Proof. The middle term is Bayes’ formula applied to the LHS. We write the ff. to show the equality
of the middle and RHS.
If the drawn chip was white, the conditional probability that bowl B1 had been selected is, by
Bayes’ formula:
𝐏(𝐁𝟏 ) 𝐏(𝐖|𝐁𝟏 )
𝐏(𝐁𝟏 |𝐖) =
𝐏(𝐖)
𝟏
( )(𝟏)
𝐏(𝐁𝟏 |𝐖) = 𝟐
𝟎. 𝟔𝟓𝟔𝟐𝟓
𝐏(𝐁𝟏 |𝐖) 𝟎. 𝟕𝟔𝟏𝟗
(Source: Hogg, R., Tanis, E., & Zimmerman, D., (2015). Probability and Statistical Inference, 9th
Edition. Upper Saddle River, NJ. Pearson Education Inc.)
2. Suppose that medical science has developed a test for a certain disease that is 95% accurate, on
both those who do and those who do not have the disease. If the incidence rate of this disease in
the population is 5%, find the probability that a person: (i) Has the disease when the test is positive.
(ii) Does not have the disease when the test is negative.
Solution:
Let’s make a table first to determine the values under false positive and false negatives.
Test does not detect the
Test detects the disease
disease
Positive 0.95 0.05
Let D be the event the person has the disease, T be the event that the person was tested, and + or
– be the positive and negative.
(i)
+| + )
𝐏(𝐃+) 𝐏(𝐓 + |𝐃+)
𝐏 (𝐃 𝐓 =
𝐏(𝐃+) 𝐏(𝐓+ |𝐃+) + 𝐏(𝐃−) 𝐏(𝐓 +|𝐃−)
(𝟎. 𝟎𝟓)(𝟎. 𝟗𝟓) 𝟏
= =
(𝟎. 𝟎𝟓)(𝟎. 𝟗𝟓) + (𝟎. 𝟗𝟓)(𝟎. 𝟎𝟓) 𝟐
(ii)
𝐏(𝐃−) 𝐏(𝐓 − |𝐃−)
𝐏(𝐃− |𝐓 − ) =
𝐏(𝐃−) 𝐏(𝐓− |𝐃−) + 𝐏(𝐃+) 𝐏(𝐓 −|𝐃+)
(𝟎. 𝟗𝟓) (𝟎. 𝟗𝟓)
= = 𝟎. 𝟗𝟎𝟓
(𝟎. 𝟗𝟓) (𝟎. 𝟗𝟓) + (𝟎. 𝟎𝟓)(𝟎. 𝟎𝟓)
3. Two different suppliers, A and B, provide the manufacturer with the same part. All supplies of
this part are kept in a large bin. In the past 2% of all parts supplied by A and 4% of parts supplied
by B have been defective. Moreover, A supplies three times as many parts as B. Suppose that you
reach into the bin and select a part. (i) Find the probability that this part is defective. (ii) If the part
is non-defective, find the probability that it was supplied by B?
Solution:
(i) Let D be the event that the part was defective. Moreover, A supplies 75% of the parts while B
supplies 25% of the parts.
(ii)
𝐏(𝐁) 𝐏(𝐃𝐜 |𝐁)
𝐏(𝐁|𝐃𝐜 ) =
𝐏(𝐃𝐜 )
(𝟎. 𝟐𝟓)(𝟎. 𝟗𝟔)
𝐏(𝐁|𝐃𝐜 ) =
(𝟎. 𝟗𝟗)
𝐏(𝐁|𝐃𝐜 ) 𝟎. 𝟐𝟒𝟐𝟒
Note how the posterior probability of B (= 0.2424) decreased from the prior probability of III (=
0.96), because B a much less percentage of parts than A.