Anda di halaman 1dari 38

CONDITIONAL PROBABILITY,

EVENT INDEPENDENCE, AND


BAYES THEOREM
Waskito Pranowo
Teknik Geofisika
Universitas Pertamina
Conditional Probability
• Conditional Probability adalah probabilitas suatu
event jika event lain sudah terjadi.
• Conditional Probability dinotasikan dengan
𝑃 𝐵 𝐴 , dibaca Probability B given A.
• 𝑃 𝐵 𝐴 adalah probabilitas kemunculan event B,
jika event A sudah terjadi lebih dahulu (event A
adalah given)

Sec 2-4 Conditional Probability 2


Conditional Probability
• Berikut ini adalah contoh kasus conditional
probability:
A communications channel has an error rate of 1 per
1000 bits transmitted. Errors are rare, but do tend to
occur in bursts. If a bit is in error, the probability that
the next bit is also in error is greater than 1/1000.

• Dari mana kah kita mengetahui bahwa kasus di


atas adalah conditional probability?

Sec 2-4 Conditional Probability 3


Contoh
Diketahui sample space
𝑆 = 1,2,3,4,5,6,7

• Berapakah probabilitas mendapatkan angka 3?


• Jika angka ganjil yang diambil (given), berapakah
probabilitas mendapatkan angka 3?
Example 2-11
There are 4 probabilities conditioned on flaws in the
below table.
Parts Classified
Surface Flaws
Defective Total
Yes (F ) No (F' )
Yes (D ) 10 18 28
No (D' ) 30 342 372
Total 40 360 400
Carilah:
• 𝑃 𝐹 ,𝑃 𝐷
• 𝑃 𝐷|𝐹 , 𝑃 𝐷′ |𝐹 , 𝑃 𝐷|𝐹′ , 𝑃 𝐷′|𝐹′
Sec 2-4 Conditional Probability 5
Jawaban
Parts Classified
•𝑃 𝐹 = 40Τ400 Surface Flaws
Defective Total
•𝑃 𝐷 = 28Τ400 Yes (F ) No (F' )
Yes (D ) 10 18 28
•𝑃 𝐷|𝐹 = 10Τ40 No (D' ) 30 342 372
•𝑃 𝐷′ |𝐹 = 30Τ40 Total 40 360 400

•𝑃 𝐷|𝐹′ = 18Τ360
•𝑃 𝐷′|𝐹′ = 342Τ360
Random Samples
• Random berarti setiap item memiliki
kemungkinan yang sama untuk dipilih. Jika lebih
dari satu item dijadikan sampel, random artinya
bahwa setiap hasil sampling memiliki
kemungkinan yang sama.
• 2 items are taken from S = {a,b,c} without
replacement.
• Ordered sample space: S = {ab,ac,bc,ba,ca,cb}
• Unordered sample space: S = {ab,ac,bc}
Sec 2-4 Conditional Probability 7
Sampling without
Replacement
Suatu wadah terdiri dari 30 item: 5 item A and 25
item B. Jika dua item diambil secara acak
bergiliran tanpa dikembalikan.
Berapakah probabilitas terambil item B pada
pengambilan kedua, jika pengambilan pertama
terambil item A?
25
𝑃 𝐵|𝐴 =
29

Sec 2-4 Conditional Probability 8


Sampling with Replacement
Suatu wadah terdiri dari 30 item: 5 item A and 25
item B. Jika dua item diambil secara acak
bergiliran dengan dikembalikan(with
replacement).
Berapakah probabilitas terambil item B pada
pengambilan kedua, jika pengambilan pertama
terambil item A?
25
𝑃 𝐵|𝐴 =
30

Sec 2-4 Conditional Probability 9


Example 2-12 : Sampling
Without Enumeration
A batch of 50 parts contains 10 made by Tool 1
and 40 made by Tool 2. If 2 parts are selected
randomly,
a) What is the probability that the 2nd part came
from Tool 2, given that the 1st part came from Tool
1?

b) What is the probability that the 1st part came


from Tool 1 and the 2nd part came from Tool 2?

Sec 2-4 Conditional Probability 10


Multiplication Rule
• The conditional probability can be rewritten to
generalize a multiplication rule.
𝑃 𝐴 ∩ 𝐵 = 𝑃 𝐵 𝐴 · 𝑃 𝐴 = 𝑃 𝐴 𝐵 · 𝑃(𝐵)

• The last expression is obtained by exchanging the


roles of A and B.

𝑃 𝐴∩𝐵 𝑃 𝐴∩𝐵
𝑃 𝐵𝐴 = , 𝑃 𝐴𝐵 =
𝑃 𝐴 𝑃 𝐵
Sec 2-5 Multiplication & Total Probability
11
Rules
Example 2-13: Machining
Stages
Probabilitas suku cadang yang dibuat pada tahap
pertama memenuhi spesifikasi adalah 0.90.
Probabilitas suku cadang tersebut memenuhi
spesifikasi pada tahap ke-2 ketika memenuhi
spesifikasi pada tahap pertama adalah 0.95.
Berapa probabilitas bahwa kedua tahap
memenuhi spesifikasi?
Jawaban
Andaikan A adalah event suku cadang memenuhi
spesifikasi tahap pertama dan B untuk tahap kedua.
0.9 = 𝑃 𝐴
0.95 = 𝑃 𝐵|𝐴
Ditanya: “Probabilitas bahwa kedua tahap memenuhi
spesifikasi”.
“Kedua tahap” → tidak memilih → dan
𝑃 𝐴 ∩ 𝐵 = 𝑃 𝐵 𝐴 𝑃 𝐴 = 0.95 0.9 = 0.855
Two Mutually Exclusive Subsets
• A and A are mutually
exclusive.
• 𝐴 ∩ 𝐵 and 𝐴′ ∩ 𝐵 are mutually
exclusive
• 𝐵 = 𝐵 ∩ 𝐴 ∪ 𝐵 ∩ 𝐴′

Total Probability Rule


For any two events A and B
𝑃 𝐵 = P 𝐴 ∩ 𝐵 ∪ 𝐴′ ∩ 𝐵
𝑃 𝐵 = 𝑃 𝐴 ∩ 𝐵 + 𝑃 𝐵 ∩ 𝐴′
= 𝑃 𝐵|𝐴 ∙ 𝑃 𝐴 + 𝑃 𝐵|𝐴′ ∙ 𝑃 𝐴′
Example 2-14: Semiconductor
Contamination
Information about product failure based on chip
manufacturing process contamination is given
below. Find the probability of failure!
Probability Level of Probability
of Failure Contamination of Level
0.1 High 0.2
0.005 Not High 0.8

Let F denote the event that the product fails.


Let H denote the event that the chip is exposed to
high contamination during manufacture.
Sec 2-5 Multiplication & Total Probability
15
Rules
Probability Level of Probability
Answer of Failure Contamination of Level
0.1 High 0.2
0.005 Not High 0.8

• 𝑃 𝐹 𝐻 = 0.100 and 𝑃 𝐻 = 0.2,


𝑃 𝐹 ∩ 𝐻 = 𝑃 𝐹 𝐻 ∙ 𝑃 𝐻 = 0.2 0.1 = 0.02

• 𝑃 𝐹 𝐻′ = 0.005 and 𝑃 𝐻′ = 0.8,


𝑃 𝐹 ∩ 𝐻′ = 𝑃 𝐹 𝐻′ ∙ 𝑃 𝐻′ = 0.005 0.8
= 0.004

• 𝑃 𝐹 = 𝑃 𝐹 ∩ 𝐻 + 𝑃 𝐹 ∩ 𝐻′
= 0.020 + 0.004 = 0.024
Total Probability Rule (Multiple Events)

• A collection of sets 𝐸1 , 𝐸2 ,
…, 𝐸𝑘 such that
𝐸1 ∪ 𝐸2 ∪ ⋯ ∪ 𝐸𝑘 = 𝑆 is
said to be exhaustive.
• Assume 𝐸1 , 𝐸2 , …, 𝐸𝑘
are 𝑘 mutually exclusive
and exhaustive. Then
P( B) = P( B  E1 ) + P( B  E2 ) + ... + P( B  Ek )
= P( B | E1 )  P( E1 ) + P( B | E2 )  P( E2 ) + ... + P( B | Ek )  P( Ek )
Sec 2-5 Multiplication & Total Probability
17
Rules
Example 2-15: Semiconductor
Failures-1
Probability Level of Probability
of Failure Contamination of Level
0.100 High 0.2
0.010 Medium 0.3
0.001 Low 0.5

Find the probability of failure.

Sec 2-5 Multiplication & Total Probability


18
Rules
Probability Level of Probability
of Failure Contamination of Level
0.100 High 0.2
0.010 Medium 0.3
0.001 Low 0.5

𝑃 𝐹∩𝐻 𝑃 𝐹′ ∩ 𝐻 𝑃 𝐹∩𝑀 𝑃 𝐹′ ∩ 𝑀 𝑃 𝐹∩𝐿 𝑃 𝐹′ ∩ 𝐿


= 𝑃 𝐹 𝐻 .𝑃 𝐻 = 𝑃 𝐹′ 𝐻 . 𝑃 𝐻 = 𝑃 𝐹 𝑀 .𝑃 𝑀 = 𝑃 𝐹′ 𝑀 . 𝑃 𝑀 = 𝑃 𝐹 𝐿 .𝑃 𝐿 = 𝑃 𝐹′ 𝐿 . 𝑃 𝐿

𝑃 𝐹 =𝑃 𝐹∩𝐻 +𝑃 𝐹∩𝑀 +𝑃 𝐹∩𝐿


= 0.02 + 0.003 + 0.0005 = 0.0235
Event Independence
• Dua events disebut independent jika salah satu
dari pernyataan ekuivalen berikut ini benar:
• 𝑃(𝐴 | 𝐵) = 𝑃(𝐴)
• 𝑃(𝐵 | 𝐴) = 𝑃(𝐵)
• 𝑃(𝐴 ∩ 𝐵) = 𝑃(𝐴) · 𝑃(𝐵)
• Ini berarti bahwa terjadinya satu event tidak
berdampak pada probabilitas terjadinya event
lainnya.

Sec 2-6 Independence 20


Example 2-16: Flaws and
Functions
• Table 1 provides an example of 400 parts
classified by surface flaws and as (functionally)
defective. Suppose that the situation is
different and follows Table 2. Let F denote the
event that the part has surface flaws. Let D
denote the event that the part is defective.

Sec 2-6 Independence 21


The data shows whether the events are independent.
Independence with Multiple
Events
• The events E1, E2, … , Ek are independent if and
only if, for any subset of these events:

𝑃 𝐸𝑖1 ∩ 𝐸𝑖2 ∩ … ∩ 𝐸𝑖𝑘 = 𝑃 𝐸𝑖1 · 𝑃 𝐸𝑖2 … · 𝑃(𝐸𝑖𝑘 )

𝑃 𝐸𝑖1 ∩ 𝐸𝑖2 ∩ … ∩ 𝐸𝑖𝑘 = ෑ 𝑃 𝐸𝑖𝑗


𝑗=1

Sec 2-6 Independence 23


Contoh
• Probabilitas suatu kolam terdapat kontaminan
adalah sebesar 0.1. Terdapat 10 kolam dengan
sifat yang sama yang saling terpisah. Berapakah
probabilitas tidak terdapat kontaminan di
seluruh kolam?

Jawaban:
Kolam satu tidak berkaitan dengan kolam lainnya
karena terpisah. Sehingga kasus tersebut
independen
• Probabilitas adanya kontaminan, 𝑃 𝐶 = 0.1,
sehingga probabilitas tidak adanya kontaminan
adalah 𝑃 𝐶 ′ = 1 − 𝑃 𝐶 = 0.9
• Probabilitas tidak terdapat kontaminan di 10
kolam adalah
𝑃 𝐶1′ ∩ 𝐶2′ ∩ ⋯ 𝐶10

= 𝑃 𝐶1′ . 𝑃 𝐶2′ … 𝑃 𝐶10

= 0.9 ∙ 0.9 … ∙ 0.9


= 0.9 10 = 0.35
Bayes’ Theorem
• Thomas Bayes (1702-1761) was an English
mathematician and Presbyterian minister.
• His idea was that we observe conditional
probabilities through prior information.
• Bayes’ theorem states that,

𝑃 𝐵 𝐴 ∙𝑃 𝐴
𝑃 𝐴𝐵 = , 𝑃 𝐵 >0
𝑃 𝐵

Sec 2-7 Bayes Theorem 26


Example 2-18
• The conditional probability that a high level of
contamination was present when a failure
occurred is to be determined. The information
from Example 2-14 is summarized here.
Probability Level of Probability
of Failure Contamination of Level
0.1 High 0.2
0.005 Not High 0.8

•𝑃 𝐻𝐹 ?

Sec 2-7 Bayes Theorem 27


Answer Example 2-18
• Let F denote the event that the product fails, and
let H denote the event that the chip is exposed to
high levels of contamination.
• From the previous we get 𝑃 𝐹 = 0.024
Probability Level of Probability

Previous Slide of Failure Contamination of Level


0.1 High 0.2
0.005 Not High 0.8

• 𝑃 𝐹 𝐻 = 0.100 and 𝑃 𝐻 = 0.2,


𝑃 𝐹 ∩ 𝐻 = 𝑃 𝐹 𝐻 ∙ 𝑃 𝐻 = 0.2 0.1 = 0.02

• 𝑃 𝐹 𝐻′ = 0.005 and 𝑃 𝐻 = 0.8,


𝑃 𝐹 ∩ 𝐻′ = 𝑃 𝐹 𝐻′ ∙ 𝑃 𝐻′ = 0.005 0.8
= 0.004

• 𝑃 𝐹 = 𝑃 𝐹 ∩ 𝐻 + 𝑃 𝐹 ∩ 𝐻′
= 0.020 + 0.004 = 𝟎. 𝟎𝟐𝟒
Answer Example 2-18
Probability Level of Probability
of Failure Contamination of Level
0.1 High 0.2
0.005 Not High 0.8

• 𝑃 𝐹|𝐻 = 0.1, 𝑃 𝐹 = 0.024, 𝑃 𝐻 = 0.2

𝑃 𝐹𝐻 𝑃 𝐻 0.1 0.2
𝑃 𝐻|𝐹 = =
𝑃 𝐹 0.024
= 0.83
Bayes Theorem with Total
Probability
• If E1, E2, … Ek are k mutually exclusive and exhaustive events
and B is any event,
𝑃 𝐵 𝐸1 ∙ 𝑃 𝐸1
𝑃 𝐸1 𝐵 = , 𝑃 𝐵 >0
𝑃 𝐵
𝑃 𝐵 𝐸1 ∙ 𝑃 𝐸1
𝑃 𝐸1 𝐵 =
𝑃 𝐵|𝐸1 𝑃 𝐸1 + 𝑃 𝐵|𝐸2 𝑃 𝐸2 + ⋯ + 𝑃 𝐵|𝐸𝑘 𝑃 𝐸𝑘

• Note : Numerator expression is always one of the terms in the


sum of the denominator.

Sec 2-7 Bayes Theorem 31


Example 2-19: Bayesian Network
A printer manufacturer obtained the following three types of
printer failure probabilities. Hardware 𝑃 𝐻 = 0.1, software 𝑃 𝑆 =
0.6, and other 𝑃 𝑂 = 0.3. Also, 𝑃 𝐹 𝐻 = 0.9, 𝑃 𝐹 𝑆 = 0.2, and
𝑃 𝐹 𝑂 = 0.5. If a failure occurs, determine if it’s most likely due to
hardware, software, or other.
P ( F ) = P ( F | H ) P ( H ) + P ( F | S ) P ( S ) + P ( F | O) P (O)
= 0.9(0.1) + 0.2(0.6) + 0.5(0.3) = 0.36
P ( F | H )  P ( H ) 0.9  0.1
P( H | F ) = = = 0.250
P( F ) 0.36
P ( F | S )  P( S ) 0.2  0.6
P(S | F ) = = = 0.333
P( F ) 0.36
P ( F | O )  P (O) 0.5  0.3
P (O | F ) = = = 0.417
P( F ) 0.36
Note that the conditionals given failure add to 1. Because 𝑃 𝑂 𝐹
is largest, the most likely cause of the problem is in the other
category.
Sec 2-7 Bayes Theorem 32
Example in Geoscience Case
• A 3D geophysical survey concludes that a new area has three potential
regions where oil can be found. It is equally likely that oil could be found in
any of three regions. On the basis of the surrounding regions and the
presence of source rock, it is possible for only one of the regions to contain
oil.
• Geoscientist are certain that one of these regions should have commercial
reserves. If only one exploration well is drilled in a region, there is a 40%
chance that oil will not be discovered in that region although oil may be
present.
• If one well is drilled in Region 1 and is unsuccessful, what is the probability
that oil present in Region 1?
• What is the probability that oil is present in other two regions?
Answer
Let 𝑅𝑖 where i=1,2,3 is an event that oil is in
Region i. Let 𝐹 is an event that the exploration of
Region 1 is failed
Asked: What is the probability the oil is
discovered in Region 1 if exploration in Region-1
failed?
𝑃 𝑅1 𝐹 ?
𝑃 𝐹|𝑅1 𝑃 𝑅1
𝑃 𝑅1 |𝐹 =
𝑃 𝐹|𝑅1 𝑃 𝑅1 + 𝑃 𝐹|𝑅2 𝑃 𝑅2 + 𝑃 𝐹|𝑅3 𝑃 𝑅3
Answer
From the information:
“It is equally likely that oil could be found in any of three
regions.”
1
𝑃 𝑅1 = 𝑃 𝑅2 = 𝑃 𝑅3 =
3
“If only one exploration well is drilled in a region, there is
a 40% chance that oil will not be discovered in that region
although oil may be present.”
We know that the drilling in Region 1 is failed to get oil
(although may be the oil is in the Region-1), then
𝑃 𝐹 𝑅1 = 0.4
Answer
• We know that there is only 1 region that has oil.
• If the oil is in Region-2, then exploration in
Region-1 is 100% failed,
𝑃 𝐹 𝑅2 = 1
• If the oil is in Region-3, then exploration in
Region-1 is 100% failed,
𝑃 𝐹 𝑅3 = 1
Answer
𝑃 𝑅1 = 0.333, 𝑃 𝑅2 = 0.333, 𝑃 𝑅3 = 0.333

𝑃 𝐹 𝑅1 = 0.4, 𝑃 𝐹 𝑅2 = 1, 𝑃 𝐹 𝑅3 = 1

𝑃 𝐹|𝑅1 𝑃 𝑅1
𝑃 𝑅1 |𝐹 =
𝑃 𝐹|𝑅1 𝑃 𝑅1 + 𝑃 𝐹|𝑅2 𝑃 𝑅2 + 𝑃 𝐹|𝑅3 𝑃 𝑅3

0.4 0.333
𝑃 𝑅1 |𝐹 = = 0.167
0.4 0.333 + 1 0.333 + 1 0.333
Answer
1 0.333
𝑃 𝑅2 |𝐹 = = 0.417
0.4 0.333 + 1 0.333 + 1 0.333

1 0.333
𝑃 𝑅3 |𝐹 = = 0.417
0.4 0.333 + 1 0.333 + 1 0.333

Anda mungkin juga menyukai