Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the...

33
Conditional Probability

Transcript of Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the...

Page 1: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Conditional Probability

Page 2: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Conditional Probability of an Event

Illustrating Example (1):

Consider the experiment of guessing the answer to a multiple choice question of 8 choices. The probability of guessing the right answer is 1/8. But if knowing that three of these choices are certainly wrong answers and should be disregarded, then the probability of getting the right answer swells to 1/5.

Page 3: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Illustrating Example (2):Consider the usual rolling of the die experiment, where the sample

space is S = { 1 , 2 , 3 4 , 5 , 6 }Let B be the event that an even number occurs, then: B = {2 , 4, 6 }andp(B) = n(B) / n(S) = 3/6 = ½Supposed that the die is rolled out of our view and we are told that a

number greater than three occurred.The event F of a number greater than 3 is:A = { 4 , 5 , 6 }Knowing that A has occurred, the probability that an even number

occurs will increases and becomes equal to p({4,6}) / p(A) = 2/3. We denote that by p(B/A) and read it “ the probability of B given A”

Notice that B∩A = { 4 , 6 }Thus: p(B/A) = n (B∩A) / n(A) = [n (B∩A) / n (S)] / [n(A) / n (S) ] = p(B∩A) / p(A) = (2/6) /(3/6) = 2/3

Page 4: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Formula of Conditional Probability of an Event

If E & A are two events in an experiment andp(A) is not equal to 0, then the conditional probability p(E│A) that E will occur

given that A has already occurred is equal to p(A∩E) / p(A)

p(E│A) = p(A∩E) / p(A)

p(E│A) is pronounced “ the probability of E given A”

→Product Rule:p(A∩E) = p(A) . p(E│A)

Page 5: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Example (3)

A man has two kids. What’s the probability that both are boys, given that one of them is a boy

Solution

Let the notation BG mean the first child is a boy and the second is a girl, and read the notations BB, GB and GG in the same manner.

The sample space S = {BB, BG, GB, GG}

Let E be the event tat both of the children are boys and F the event that at least one of them is a boy. Then,

E = {BB} and F = {BB, BG, GB}

Then p(F) = ¾, E∩F = {BB}, p(E∩F ) = ¼Therefore;P(E/F) = p(E∩F ) / p(F) = ¼ / ¾ = ¼ (4/3) = 1/3

Page 6: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Example (4)

Assuming that 32% of the readers of a magazine will read an ad for a certain product in that magazine and 2% of those will buy the product. What’s the probability that a reader of the magazine will buy the product?

Solution

Let F be the event that a reader reads the ad and E the event that a reader buys the product . Then, E∩F is the event that a reader reads the ad and buys the product, p(F) = 0.32 and p(E/F) = 0.02

P(E/F) = p(E∩F ) / p(F)

Or

p(E∩F ) = P(E/F) p(F) = 0.02 (0.32)= 0.0064

Page 7: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Stochastic Processes

A finite stochastic process is an experiment consisting of a finite numbers of stages in which the outcomes and associated probabilities of each stage depend on the outcomes and associated probabilities of the preceding (previous) stages.

Page 8: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Illustrating Example (5)

Consider the experiment of drawing 2 cards without replacement from a deck of playing cards(52 cards).

We think of the experiment as a stochastic process of 2 stagesStage(1): First DrawingLet F be the event that the card drawn is a face card. Then: FC is the event that the card drawn is not a face card, n(F)

=12 and n(FC) = 52 – 12 = 40And so p(F) = 12/52 and p(FC) = 40/52Stage(2): Second DrawingLet G be the event that the card drawn is a face card. Then: GC

is the event that the card drawn is not a face card.1. If the outcome of the first stage is a face card, then n(G) =

11 and n(GC)=40, and hence p(G/F) = 11/51 and p(GC/F) = 40/51

2. If the outcome of the first stage is not a face card, then n(G) = 12 and n(GC)=39, and hence p(G/FC) = 12/51 and p(GC/FC) = 39/51

Page 9: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Tree Diagram for Stochastic Process

F

FC

P(F)=12/52

P(FC)=40/52

P(G/F)=11/51

P(GC/F)=40/51

P(G/FC)=12/51

P(GC/FC)=39/51

GC

G

G

GC

Page 10: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

1. The probability that the first and the second card are face cards:

P(F∩G) = p(F) p(G/F) = (12/52 ) (11/51)

2. The probability that the second card is a face card and the first is not :

P(FC∩G) = p(FC) p(G/FC) = (40/52 ) (12/51)

F∩G and FC∩G are mutually exclusive.

3. The probability that the second card is a face card= p(G)=p[ (F∩G) U (FC∩G) ] ( notice that are mutually exclusive)= p(F∩G) + p(FC∩G)= p(F) p(G/F) + p(FC) p(G/FC)= (12/52 ) (11/51) + (40/52 ) (12/51)= 12(11+40) / (51)(52) = 12/52 = 3/13

Page 11: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Independent Events1. If A & B are independent events, then

p(E│F) = p(E) and p(F│E) = p(F)Or equivalently;p(E∩F) = p(E) . p(F) (Why?)

Because p(E∩F) = p(E) . p(F│E)

2. A group of events E1, E2,….,En are independent if:

p(E1 ∩ E2 ∩ …. ∩ En ) = p(E1) p(E2)….. p(En)

Page 12: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Example (6)

In the experiment of tossing a coin twice. Let E be the event that the outcome of the first toss is head and let F be the event that the outcome is tail in the second toss

Show that E & F are independent.

Solution:

The sample space S= {HH, HT, TH, TT}E = {HH, HT} and F = {HT, TT} and so E∩F =

{HT}→ p(E) = 2/4 = ½, p(F) = 2/4 = ½ and p(E∩F ) = ¼ P(E) p(F) = ½ (½) = ¼ = p(E∩F )→ E & F are independent events

Page 13: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Example (7)

Assume that E & F & G are independent events and p(E)=0.25, p(F) = 0.2 and p(G) = 0.4. Find:

P(E ∩ F), p(E ∩ F ∩ G)

Solution:

p(E∩F ) = p(E) p(F) = (0.25 )(0.2) = 0.05p(E ∩ F ∩ G) = p(E) p(F) p(G) = (0.25 )(0.2)(0.4) =

0.02

Page 14: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Posteriori & Priori Probabilities

1. Posteriori Probability is the probability calculated after the outcomes of an experiment have been observed.

2. Priori Probability is the probability of the likelihood that an event will occur

Page 15: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Partition of the Sample SpaceA partition of the sample

space S is a family

A1, A1, A3,….., An of mutually exclusive events

( disjoint subsets of S) whose union is S.

In the opposite illustration, we have:

A1U A1U A3 = S

A1∩A2 = Φ , A1∩A3 = Φ

and A2∩A3 = Φ

S

E1 E3E2

A1 A3A2

S

Page 16: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Partition of the Sample SpaceGiven a partition {A1, A1, A3,

….., An } of S, for any event D, we have:

D

= (A1∩D) U (A2∩D) U (A3∩D) U …… (An∩D)

In the opposite illustration, we have:

D= (A1∩D) U (A2∩D) U (A3∩D)

S

E1 E3E2

A1 A3A2

S

A1∩D A2∩D A3∩D

Page 17: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Bayes’ Theorem

Page 18: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Simple Case: A sample Space Partitioned to two sets

Let A1, A2 be a partition of a sample space S and let E be an event of the experiment such that p(E), p(A1) and p(A2) not equal to 0. And let:

Σ = p(A1) p( E │A1) + p(A2) p( E │A2)

Then a posteriori probabilities p(A1│E) and p(A2│E) are given by:

p(A1│E) = p(A1) . p(E │A1) / Σ

= p(A1) P(E / A1) / [ p(A1) P(E / A1) + p(A2) P(E / A2) ]

= product of Probabilities along path through A1 and E / Sum of all products of probabilities along each paths to E

p(A2│E) = p(A2) . p(E │A2) / Σ

= p(A2) P(E / A2) / [ p(A1) P(E / A1) + p(A2) P(E / A2) ]

= product of Probabilities along path through A2 and E / Sum of all products of probabilities along each paths to E

Page 19: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

A1

E

E

P(A1)

P(A2)P(E/A2)

P(E/A1)

P(A2 / E) = p(A2) P(E / A2) / [ p(A1) P(E / A1) + p(A2) P(E / A2) ]

p(A2) P(E/A2)

EC

EC

A2

p(A1) P(E/A1)

P(A1 / E) = p(A1) P(E / A1) / [ p(A1) P(E / A1) + p(A2) P(E / A2) ]

Page 20: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

General Case:A sample Space Partitioned to n sets

Let A1, A2, …,An be a partition of a sample space S and let E be an event of the experiment such that p(E) and p(Ak) not equal to 0, for all k = 1,2,…,n

andΣ = p(A1) p( E │A1) + p(A2) p( E │A2) + … + p(An) p(E

│An )

Then a posteriori probability p(Ak│E) is given by:

p(Ak│E) = p(Ak) . p(E │Ak) / Σ

= product of Probabilities along path through Ak and E / Sum of all products of probabilities along each paths to E

Page 21: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

A1

An

A2

E

E

E

EP(A1)

P(A2)

P(A3)

P(An)

P(E/An)

P(E/A3)

P(E/A2)

P(E/A1) p(A1) P(E/A1)

p(An) P(E/An)

p(A2) P(E/A2)

EC

EC

EC

Page 22: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

1. p(A1│E) = p(A1) . p(E │A1) / Σ

=p(A1) . p(E │A1) / [ p(A1) p( E │A1) + p(A2) p( E │A2) + … + p(An) p(E │An ) ]

2. p(A2│E) = p(A2) . p(E │A2) / Σ

=p(A2) . p(E │A2) / [ p(A1) p( E │A1) + p(A2) p( E │A2) + … + p(An) p(E │An ) ]

3. p(A3│E) = p(A3) . p(E │A3) / Σ

=p(A3) . p(E │A3) / [ p(A1) p( E │A1) + p(A2) p( E │A2) + … + p(An) p(E │An ) ]

Page 23: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

4. p(A4│E) = p(A4) . p(E │A4) / Σ

=p(A4) . p(E │A4) / [ p(A1) p( E │A1) + p(A2) p( E │A2) + … + p(An) p(E │An ) ]

5. p(A5│E) = p(A5) . p(E │A5) / Σ

=p(A5) . p(E │A5) / [ p(A1) p( E │A1) + p(A2) p( E │A2) + … + p(An) p(E │An ) ]

………….

…………..

n. p(An│E) = p(An) . p(E │An) / Σ

=p(An) . p(E │An) / [ p(A1) p( E │A1) + p(A2) p( E │A2) + … + p(An) p(E │An ) ]

Page 24: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Example (8)

The panels of an electronic apparatus is manufactured in three different locations (Plants A, B and C) before sent for final assembly. The table on the next slides indicates the percentage of panels produced by these plants, as well as, the percentage of the defective ones among them.

If a manufactured unit is selected randomly and that the panel is found to be defective, what’s the probability that the panel was manufactured in plant C?

Page 25: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

PlantProduced Panels

Detective Panels

A50 %1 %

B30 %2 %

C20 %2 %

Page 26: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Solution

Let A, B & C be the events that the selected apparatus has a panel manufactured in plants A, B and C respectively.

Let D e the event that the apparatus has a defective panel.

P(C/D)= p(C) p(D/C) / Σ

Where:Σ= p(A) p(D/A) + p(B) p(D/B) +

p(C) p(D/C)

A

C

B

D

D

D

DC

DC

DC

P(A) = 0.5

P(C) = 0.2

P(B) = 0.3

P(D/A) = 0.1

P(D/C) = 0.12

P(D/B) = 0.2

Page 27: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Solution - Details

Let A, B & C be the events that the selected apparatus has a panel manufactured in plants A, B and C respectively.

Let D e the event that the apparatus has a defective panel.Then p(A) = 0.50, p(B) = 0.30, p(C) = 0.20& Then p(D/C)The probability that the selected apparatus is defective given that it came from plant C

= 0.02. Similarly;p(D/A) = 0.01 and p(D/B) = 0.02By Bayes’ Theorem;The probability that the selected apparatus came from plant C given that it is defective

given that it is defective

P(C/D) = p(C) p(D/C) / Σ= p(C) p(D/C) / [ p(A) p(D/A) + p(B) p(D/B) + p(C) p(D/C) ]= (0.20) (0.02) / [ (0.50) (0.01) + (0.30) (0.02) + (0.20) (0.02) ]= 027

Page 28: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Example (9)

The percentage of people carrying the ‘Math-hatin” virus who test positive by a blood test for that virus is 95% and the percentage of those not carrying the virus who, all the same, test positive is 3%.

Assume that a person is selected at random and given the test. If the result is positive, what’s the probability that the person has the virus, knowing that 8% of the population have the virus?

Page 29: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Solution

Let V, T be the event that the selected person “has the virus”

and the event “ the selected person tested positive” respectively.

We have:

P(V) = 0.08

P(T/V) = 095

P(T/ VC) = 0.03

V

T

T

VC

TC

P(V) = 0.08

P(T/V) = 0.95

P(VC) = 0.92P(T/VC) = 0.03

TC

Page 30: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Let V, and T be the events “having the virus” and “testing positive” respectively, then VC, and TC be the event “ not having the virus” and “not testing positive” respectively.

We have: the sample space is the populationS = V U VC partitioned into the V and VC

P(V) = 0.08, p(T/V) = 0.95 and p(T / VC) = 0.03Hence:P(VC) = 1 - P(V) = 1 - 0.08 = 0.92 & By Bayes’ Theorem;P(V/T) = p(V) p(T/V) / Σ= p(V) p(T/V) / [p(V) p(T/V) + p(VC) p(T/VC) ]= (0.08) (0.95) / [(0.08) (0.95) + (0.92) (0.03) ]= 0.733591 ≈ 0.734

Page 31: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Example (3)

Two girls who are identical twin (can not be distinguished) dressed exactly the same. The first girl, Fatima, has in her purse one QR note & one SR note, while the other girl, Maryam, has in her identical purse two QR notes. One of the girl is selected at random and asked to hand a note from her purse at random. The note turned out to be a QR note. What’s the probability that the other note left in her purse is also a QR note?

Page 32: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Solution

Let , F and Q be the events that “the selected girl if Fatima” and “ the selected note is a QR note” respectively.

We have:p(F) = 0.5p(FC) = p(Maryam)

= 0.5

p(Q/F) = 0.5p(Q/ FC) = 1.0

F

Q

Q

FC = MQC

P(F) = 0.5

P(Q/F) = 0.5

P(FC) = 0.5P(Q/ FC) = 1.0

QC

Page 33: Conditional Probability. Conditional Probability of an Event Illustrating Example (1): Consider the experiment of guessing the answer to a multiple choice.

Let F, and Q be the events that “Fatima is selected” and “QR note is selected” respectively, then FC is the event that “ Fatima is not selected” or equivalently “ Maryam is selected”.

We have the sample space parttioned into the sets F & FC S = F U FC P(F) = 0.5, p(Q/F) = 0.5 and p(Q / FC) = 1.0 We want to find the conditional probability that the selected girl is

Maryam ( the event FC) given that the selected note is a QR note (the event Q), that’s p(FC/Q) ( which, of course, what’s meant by the probability that the remaining note is a QR note)

By Bayes’ Theorem;P(FC/Q) = p(FC) p(Q/ FC) / Σ= p(FC) p(Q/ FC) / [ p(FC) p(Q/ FC) + p(F) p(Q/F) ]= (0.5) (1.0) / [(0.5) (1.0) + (0.5) (0.5) ]= 0.6666 ≈ 0.67Or Exactly:P(M/Q) = (1/2) (1) / [ (1/2) (1) + ((1/2) (1/2) ) ] = 1/2 / (3/4) = 2/3