Stat 330 (Spring 2015): slide set 6 E2 = choose Box 2 and pick a gold coin E1 = choose Box 1 and pick a gold coin Define new events E1 and E2: P (Select a gold coin|B2) = 0.5. Why? P (Select a gold coin|B1) = 1. Why? 2 Choosing one box (at random) means, that all boxes are equally likely to be chosen: P (Bi) = 13 for i = 1, 2, 3. A tree diagram shows all possible outcomes of this two-step procedure: Treasure Hunt... continued Last update: January 13, 2015 Stat 330 (Spring 2015) Slide set 6 Stat 330 (Spring 2015): slide set 6 1 2 · 13 = 16 . 1 3 + 16 = 0.5. 3 We just used the Law of Total Probability to compute the probability of choosing a gold coin. P ( gold coin ) = Thus we have: This is because those are the only ways to get a gold coin, as we’ve seen in the tree diagram and they are mutually exclusive (disjoint)! The probability to choose a gold coin is the sum of P (E1) and P (E2) = P ( pick a gold coin |B2) · P (B2) = P (E2) = P ( choose Box 2 and pick a gold coin ) = P ( pick a gold coin |B1) · P (B1) = 1 · 13 = 13 . P (E1) = P ( choose Box 1 and pick a gold coin) Treasure Hunt... continued We use the definition of conditional probability to get P (E1) and P (E2)! Stat 330 (Spring 2015): slide set 6 1 Define B1, B2, B3 to be the events that Box 1, 2 or 3 is selected randomly. For a problem like this, that consists of a step-wise procedure, it is often useful to draw a tree (a flow chart) of the choices we can make in each step. • Suppose that you select one of the boxes randomly and then select one of the coins from this box. What is the probability that the coin you select is a gold coin? • Box 3 has two silver coins. • Box 2 has one gold coin and one silver. • Box 1 has two gold coins Experiment: Treasure Hunt Total Probability Law and Bayes’ Rule Stat 330 (Spring 2015): slide set 6 P (A|Bi)P (Bi). In our Treasure Hunt example, the events B1, B2, and B3 form a cover Ω, as a coin can be drawn only from one of the boxes. 6 Note that event A does not intersect the event B3 as there are no gold coins in Box 3. P (A) = P (A|B1)P (B1) + P (A|B2)P (B2) = 1 · 13 + 12 · 13 = 0.5 as before. = P (Bj |A) = Proof of Bayes’ Rule: P (A|Bj )P (Bj ) . k j=1 P (A|Bj )P (Bj ) P (Bj ∩ A) P (A|Bj )P (Bj ) = P (A) P (A) 7 Theorem: Bayes’ Rule. If B1, . . . , Bk is a cover or partition of Ω, and A is an event, then P (A|Bj )P (Bj ) P (Bj |A) = k . j=1 P (A|Bj )P (Bj ) Stat 330 (Spring 2015): slide set 6 Bayes’ rule. Because B1, . . . , Bk partition Ω, the events A∩B1, . . . A∩Bk are disjoint, and ∪ki=1Ai = A where Ai = A ∩ Bi. k By Axiom (iii) (slide set 2 p.5), P (A) = i=1 P (A ∩ Bi ) = k i=1 P (A|Bi )P (Bi ). • • By definition of conditional probability P (A|Bi)P (Bi) = P (A ∩ Bi) • Stat 330 (Spring 2015): slide set 6 The probability kof event A is put together as sum of the probabilities of the intersections i=1 P (A ∩ Bi). Defining event A = drawing a gold coin, we have i=1 k Proof of the Law of Total Probability: P (A) = Theorem: Law of Total Probability. If the collection of events B1, . . . , Bk is a cover of Ω, and A is an event, then 5 Law of Total Probability (continued...) We can depict event A using a Venn diagram: Stat 330 (Spring 2015): slide set 6 Law of Total Probability (continued...) 4 • If we represent a multi-step procedure with a tree diagram, then the branches of the tree form a cover. • We can represent a cover using a Venn diagram: (i) the events are mutually exclusive (i.e., Bi ∩ Bj = ∅ for i = j), and k (ii) the union of the events is Ω (i.e., i=1 Bi = Ω). Definition. A collection of events B1, . . . Bk is called a cover or partition of Ω if Law of Total Probability Stat 330 (Spring 2015): slide set 6 :=Cd P (chip is defective :=Td it’s defective) tester says = P (Cd|Td) | We will apply Bayes’ Rule, using Cd, and C̄d as cover. 8 If the test device says the chip is defective, what is the probability that the chip actually is defective? P ( “tester says chip is defective” | “chip is defective” ) = 0.94 P ( “tester says chip is good” | “chip is good” ) = 0.95 A given lot of chips contains 2% defective chips. Each chip is tested before delivery. However, the tester is not wholly reliable: Example 1.7.3: (Hofmann notes) = = = P (Cd|Td) = 9 Stat 330 (Spring 2015): slide set 6 P (Td|Cd)P (Cd) P (Td|Cd)P (Cd) + P (Td|C¯d)P (C¯d) 0.94 · 0.02 0.94 · 0.02 + (1 − P (T̄d|C̄d)) · 0.98 0.94 · 0.02 = 0.28 0.94 · 0.02 + (1 − 0.95) · 0.98 P (Td|Cd)P (Cd) P (Td) Continue Example 1.7.3