Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment...

31
Law of Total Probability and Bayes’ Rule

Transcript of Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment...

Page 1: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Law of Total Probabilityand Bayes’ Rule

Page 2: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

“Event-composition method”

• Understand the experiment and sample points.

• Using set notation, express the event of interest in terms of events for which the probability is known.

• Applying probability rules, combine the known probabilities to determine the probability of the specified event.

Page 3: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Problem 2.86

• In a factory, 40% of items produced come from Line 1 and others from Line 2.

• Line 1 has a defect rate of 8%. Line 2 has a defect rate of 10%.

• For randomly selected item, find probability the item is not defective. A: the selected item is not defective

Page 4: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Problem 2.86

• A: the selected item is not defective.

S

B1 B2

A

• B1: item came from Line 1. B2: item came from Line 2.

1 2( ) ( )A A B A B

Page 5: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Problem 2.86

• Since this is the union of disjoint sets,the Additive Law yields

1 2( ) ( )A A B A B

1 2( ) ( ) ( )P A P A B P A B

• Or, in terms of conditional probabilities

1 1 2 2( ) ( | ) ( ) ( | ) ( )P A P A B P B P A B P B

( ) (0.08)(0.40) (0.10)(0.60) 0.092P A

• So we may write

Page 6: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

The Decision Tree

Line 1

Line 2

defective

defective

not defective

not defective

Page 7: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Problem 2.94

• Must find blood donor for an accident victim in the next 8 minutes or else…

• Checking blood types of potential donors requires 2 minutes each and may only be tested one at a time.

• 40% of the potential donors have the required blood type.

• What is the probability a satisfactory blood donor is identified in time to save the victim?

Page 8: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Finding a Donor

• A: blood donor is found within 8 minutes

• Some sample points: “B bad, G good”A = { (G), (B,G), (B,B,G), (B,B,B,G) }

• Let Ai: ith donor has correct blood type

1 1 2 1 2 3

1 2 3 4

( ) ( ) ( )

( )

A A A A A A A

A A A A

4 mutually exclusive events

Page 9: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Finding a Donor

1 1 2 1 2 3 1 2 3 4( ) ( ) ( ) ( )A A A A A A A A A A A

• Trials are independent and each P(Ai) = 0.40,and so

1 1 2 1 2 3

1 2 3 4

( ) ( ) ( ) ( ) ( ) ( ) ( )

( ) ( ) ( ) ( )

P A P A P A P A P A P A P A

P A P A P A P A

( ) 0.4 (0.6)(0.4) (0.6)(0.6)(0.4)

(0.6)(0.6)(0.6)(0.4)

.8704

P A

Page 10: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Finding a Donor

1A

1A

2A

3A

4A2A

3A

4A

1 2 3 4

4

( ) 1 (donor is not found)

1 ( ) ( ) ( ) ( )

1 (0.

Or, more simply,

6)

P A P

P A P A P A P A

saved!

saved!

saved!

saved!

too late!

Page 11: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Problem 2.96

• Of 6 refrigerators, 2 don’t work.

• The refrigerators are tested one at a time.

• When tested, it’s clear whether it works!

A. What is the probability the last defective refrigerator is found on the 4th test?

B. What is the probability no more than 4 need to be tested to identify both defective refrigerators?

Page 12: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Problem 2.96

C. Given that exactly one defective refrigerator was found during the first 2 tests, what is the probability the other one is found on the 3rd or 4th test?

Page 13: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Partition of the Sample Space

S

B1 B2 Bk…

1 2

1 2

A collection of sets { , , , } such that

1. , and

2. , for ,

is called a partition of .

k

k

i j

B B B

S B B B

B B i j

S

Page 14: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Union of Disjoint Sets

S

B1 B2 Bk…

1 2

1 2

1 2

For the partition { , , , } of the sample space ,

we may write ( ) ( ) ( )

and so

( ) ( ) ( ) ( ).

k

k

k

B B B S

A A B A B A B

P A P A B P A B P A B

A

Page 15: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Recall Problem 2.86

• A: the selected item is not defective.

S

B1 B2

A

• B1: item came from Line 1. B2: item came from Line 2.

1 2( ) ( )A A B A B Not defective

Page 16: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Law of Total Probability

AS

B1 B2 Bk…

1 2

1 2

Hence, for the partition { , , , } of the sample space ,

we have ( ) ( ) ( ) ( )k

k

B B B S

P A P A B P A B P A B

If ( ) 0, then

( ) ( | ) ( )i

i i i

P B

P A B P A B P B

1 1 2 2

or equivalently,

( ) ( | ) ( ) ( | ) ( ) ( | ) ( ).k kP A P A B P B P A B P B P A B P B

Page 17: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Total Probability

B1

B2

B3

A

A

A

A

A

A

P(A|B1)P(B1)

P(A|B2)P(B2)

P(A|B3)P(B3)

1 1 2 2 3 3

( )

( | ) ( ) ( | ) ( ) ( | ) ( ).

P A

P A B P B P A B P B P A B P B

Page 18: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Bayes’ Theorem follows…1 1Since ( ) ( | ) ( ) ( | ) ( ),

we also havek kP A P A B P B P A B P B

1 1

( )( | )

( )

( )

( | ) ( ) ( | ) ( )

jj

j

k k

P A BP B A

P A

P A B

P A B P B P A B P B

1

or simply,

( ) ( | )

( | ) ( )

jj k

i ii

P A BP B A

P A B P B

Page 19: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Bayes’

B1

B2

B3

A

A

A

A

A

A

P(A|B1)P(B1)

P(A|B2)P(B2)

P(A|B3)P(B3)

22

1 1 2 2 3 3

( )( | )

( | ) ( ) ( | ) ( ) ( | ) ( )

P A BP B A

P A B P B P A B P B P A B P B

Page 20: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Making Resistors• Three machines M1, M2, and M3 produce “1000-

ohm” resistors.• M1 produces 80% of resistors accurate to within

50 ohms, M2 produces 90% to within 50 ohms, and M3 produces 60% to within 50 ohms.

• Each hour, M1 produces 3000 resistors, M2 produces 4000, and M3 produces 3000.

• If all of the resistors are mixed together and shipped in a single container, what is the probability a selected resistor is accurate to within 50 ohms?

Page 21: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Making Resistors• Define A: resistor is accurate to within 50 ohms.

• M1 produces 80% of resistors accurate to within 50 ohms, M2 produces 90% to within 50 ohms, and M3 produces 60% to within 50 ohms.

• Each hour, M1 produces 3000 resistors, M2 produces 4000, and M3 produces 3000.

1 2

3

( | ) 0.80, ( | ) 0.90,

and ( | ) 0.60

P A M P A M

P A M

1 2 3( ) 0.3, ( ) 0.40, and ( ) 0.30.P M P M P M

Page 22: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Using Total Probability

1 1 2 2 3 3

Since

( ) ( | ) ( ) ( | ) ( ) ( | ) ( )

we have

P A P A M P M P A M P M P A M P M

( ) (0.8)(0.3) (0.9)(0.4) (0.6)(0.3)

0.78

P A

That is, 78 % are expected to be accurate to within 50 ohms.

Page 23: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

The Tree

M1

M2

M3

A

A

A

A

A

A

(0.8)(0.3)

(0.9)(0.4)

(0.6)(0.3)

( ) (0.8)(0.3)

(0.9)(0.4)

(0.6)(0.3)

0.78

P A

Page 24: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

…given it’s within 50 ohms…

• Determine the probability that,given a selected resistor is accurate to within 50 ohms, it was produced by M1. P( M1 | A) = ?

• Determine the probability that,given a selected resistor is accurate to within 50 ohms, it was produced by M3. P( M3 | A) = ?

Page 25: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Given A…

M1

M2

M3

A

A

A

A

A

A

(0.8)(0.3)

(0.9)(0.4)

(0.6)(0.3)

1

1

(M | )

P(M )

( )

(0.8)(0.3)

0.78

P A

A

P A

Page 26: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Arthritis• A test detects a particular type of arthritis for

individuals over 50 years old.• 10% of this age group suffers from this arthritis.• For individuals in this age group known to have

the arthritis, the test is correct 85% of the time.• For individuals in this age group known to NOT

have the arthritis, the test indicates arthritis (incorrectly!) 4% of the time.

• P( has arthritis | tests positive ) = ?

Page 27: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Arthritis• 10% of this age group suffers from this arthritis.

P(have arthritis) = 0.10• For individuals in this age group known to have

the arthritis, the test is correct 85% of the time. P( tests positive | have arthritis ) = 0.85

• For individuals in this age group known to NOT have the arthritis, the test indicates arthritis (incorrectly!) 4% of the time. P(tests positive | no arthritis ) = 0.04

• P( have arthritis | tests positive ) = ?

Page 28: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Hasarthritis

(has arthritis | tests positive ) = ?P

Noarthritis

positive

negative

positive

negative

0.1

0.90.04

0.85

Page 29: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

The 3 Urns

• Three urns contain colored balls. Urn Red White Blue 1 3 4 1 2 1 2 3 3 4 3 2

• An urn is selected at random and one ball is randomly selected from the urn.

• Given that the ball is red, what is the probability it came from urn #2 ?

Page 30: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

The Lost Labels

• A large stockpile of cases of light bulbs, 100 bulbs to a box, have lost their labels.

• The boxes of bulbs come in 3 levels of quality: high, medium, and low.

• It’s known 50% of the boxes were high quality, 25% medium, and 25% low.

• Two bulbs will be tested from a box to check if they’re defective.

Page 31: Law of Total Probability and Bayes’ Rule. “Event-composition method” Understand the experiment and sample points. Using set notation, express the event.

Lost Labels…

• The likelihood of finding defective bulbs is dependent on the bulb quality:

Number of defects Low Medium High

0 .49 .64 .811 .42 .32 .182 .09 .04 .01

• Given neither bulb is found to be defective, what is the probability the bulbs came from a box of high quality bulbs?