STAT 203 Tree Diagrams and Bayes’ Rule Dr. Bruce Dunham Department of Statistics UBC Lecture 24
Introduction We have defined rules for probability, including generalized additive and multiplicative rules. The latter gives probabilities for compound (or joint) events: P(A and B) = P(A) P(B|A) = P(B) P(A|B). We see how to apply this rule and also discuss “reversing” a conditional probability.
Tree Diagrams Some situations require repeated applications of the generalized multiplicative rule. Given “past” events, the probability of “future” events must sum to one. In visualizing what is happening, a tree diagram may help.
Example 1% of a population have condition X. A test exists, but is fallible: 98% with condition X give a positive result, while 5% without it test positive. You choose someone at random from the population. What is the chance they have X and test positive?
For instance, 0.98 is the probability of testing +ve given that you have condition X. By the generalised rule, the probability of having condition X and testing +ve is 0.0098.
Reversing Conditioning In the given example, we know that P(Test +ve | Have X) is 0.98. But that is not of direct interest to a patient who has a +ve test result. They want to know P(Have X | Test +ve). In general P(A|B) ≠ P(B|A).
Using the tree … We could find the probability in question using the tree diagram and the conditional probability rule: P(Have X | Test +ve) = P(Have X and Test +ve)/ P(Test +ve). From the tree, we see the above is 0.0098/(0.0098 + 0.0495) = 0.165.
Bayes’ Rule More formally, a rule exists for reversing conditional probabilities. When we consider the case with just two alternatives (B or Bc ) the rule states P(B | A) = P(A | B)P(B) /(P(A|B)P(B) + P(A| Bc )P(Bc)) The rule allows us to “flip” conditional probabilities.
Remarks on Bayes’ Theorem The result is attributed to Rev Thomas Bayes (1702? – 1761), published posthumously. A more general form exists for when we consider multiple alternative “causes” of event A. (Say B1, B2, … , Bk ). For cases here, you may find using tree diagrams easier.
1. For the scenario in Q1, what is the probability a chip chosen at random is defective and came from factory F1? 0.21 0.31 0.35 0.50 0.71 Ans: A From tree diagram or otherwise, P(D and F1) = P(D|F1)P(F1) = 0.35 × 0.10 = 0.21. 11
2. For the scenario in Q1, what is the probability a chip chosen at random is defective? 0.25 0.31 0.35 0.50 0.60 Ans: B The event {D} can be split into two mutually exclusive events: {D and F1} and {D and F2}. We can use the multiplicative rule to find the probabilities of these events. E.g., P(D and F1) = P(D|F1)P(F1). 12
Note that {D} is the union of two mutually exclusive events.
P(D and F1) = P(D|F1)P(F1) and P(D and F2) = P(D|F2)P(F2). The event {D} can be split into two mutually exclusive events: {D and F1} and {D and F2}. We can use the multiplicative rule to find the probabilities of these events. Specifically, P(D and F1) = P(D|F1)P(F1) and P(D and F2) = P(D|F2)P(F2). Drawing a Venn diagram helps!
3. For the scenario in Q1, what is the probability a chip came from factory F1 given that it is defective? 0.21 0.31 0.35 0.39 0.68 Ans: E Use tree diagram or Bayes’ rule. 15
Before the next class: Visit www.slate.stat.ubc.ca Review today’s activity. Read chapter 15 of text on sampling distributions. Don’t forget on-line homework!