Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Chapter 4 Probability Concepts 4.1 Events and Probability Three Helpful Concepts in Understanding Probability: Experiment Sample Space Event Experiment An activity for which the outcome is uncertain is an experiment. Example 4.1.1: Examples of experiments 2 Flipping a coin Rolling two dice Taking an exam Observing the number of arrivals at a drive-up window over a 5-minute period 4.1 Events and Probability (cont.) Sample Space The list of all possible outcomes of an experiment is called the sample space. Example 4.1.2: Example of sample space 3 Flipping a coin twice results in one of four possible outcomes. These possible outcomes are HH, HT, HT, TT. Therefore, sample space = {HH, HT, TH, TT}. If there are n outcomes of an experiment, sample space lists all n outcomes. 4.1 Events and Probability (cont.) Event An event consists of one or more possible outcomes of the experiment. It is usually denoted by a capital letter. Example 4.1.3: Examples of experiments and some corresponding events 4 Experiment: Rolling two dice; events: A = rolling a total of 7, B = rolling a total greater than 8, C = rolling two 4s. Experiment: Taking an exam; events: A = pass, B = fail. Experiment: Observing the number of arrivals at a drive-up window over a 5-minute period; events: A0 = no arrivals, A1 = seven arrivals, etc. 4.1 Events and Probability (cont.) Probability A numerical measure of the chance OR likelihood that a particular event will occur. The probability that event A will occur is written P(A). The probability of any event ranges from 0 to 1, inclusive. P(A) = 0 means event A will never occur. P(A) = 1 means event A must occur. 5 4.1 Events and Probability (cont.) How to come up with probability? Classical Definition of Probability If event A occurs in m of the n outcomes in an experiment, then the probability that event A will occur is: m P ( A) n 6 This assumes all n possible outcomes have an equal chance of occurring. Example 4.1.4: Toss a nickel and a dime. The sample space (i.e., the list of the possible outcomes) is {HH, HT, TH, TT}. If event A is observing one head and one tail, then m = 2 and n = 4. So according to classical definition of probability, P(A) = m/n = 2/4 = 0.5. 4.1 Events and Probability (cont.) Relative Frequency Approach Observe an experiment n times and count the number of times event A occurs, m. P ( A) 7 m n Example 4.1.5: A production process has been in operation in for 250 days and has been accident-free for 220 days. If event A is a randomly chosen accident-free day in the future, then, according to relative frequency approach, P(A) = 220/250 = 0.88. Subjective Probability A measure (between 0 and 1) of your belief that a particular event will occur. Example 4.1.6: Example of subjective probability: The probability that it will rain today is 50%. 4.2 Basic Concepts Contingency Table (also called Cross-Tab Table) Contingency tables are used to record and analyze the relationship between two variables. Example 4.2.1: Datacomp Survey: Datacomp recently conducted a survey of 200 selected purchasers of their newly introduced laptop computer to obtain a genderand-age profile of its new customers. The data are summarized in the following contingency table. Age (Years) 8 < 30 30 - 45 > 45 Sex (U) (B) (O) Total Male (M) 60 20 40 120 Female (F) 40 30 10 80 Total 100 50 50 200 Some Events: M = a male is selected F = a female is selected U = the person selected is under 30 B = the person selected is between 30 & 45 O = the person selected is over 45 4.2 Basic Concepts (cont.) Contingency Table (also called Cross-Tab Table) Example 4.2.2: At a local University 75% of the Business faculty are professors and 70% of the faculty are full time. 80% of the professors are full time. Suppose the faculties are randomly assigned to courses. 9 If you take a course in the Business School, what is the probability that you will get a Professor for the course? What is the probability that a teacher selected at random is a Professor AND is Full Time? What is the probability that a teacher chosen at random is Not a Professor OR is Not Full Time? 4.2 Basic Concepts (cont.) Marginal Probability Marginal probability is the probability of one event, regardless of the other events. Example 4.2.2: In Datacomp Survey, the marginal probabilities are: 10 P(M) = 120/200 = 0.6 P(F) = 80/200 = 0.4 P(U) = 0.5 P(B) = 0.25 P(O) = 0.25 4.2 Basic Concepts (cont.) 11 Complement of an event The complement of an event A is the event that A does not occur. This event is denoted by A. For example, A = it rains tomorrow, A = it does not rain tomorrow. Example 4.2.3: In Datacomp Survey: M = a male is selected. M = a male is not selected = a female is selected. P(M) = 0.6, and so P(M) = P(F) = 0.4. P(A) + P(A) = 1 P(A) = 1 – P(A) P(A) = 1 – P(A) 4.2 Basic Concepts (cont.) Joint Probability The probability of the occurrence of two events at the same time Example 4.2.4: In Datacomp Survey, what proportions are males between 30 and 45? That is, find the probability of selecting a person who is a male and between 30 and 45. P(M and B) = 20/200 = 0.10 Example 4.2.5: The probability of selecting a person who is a female and under 30 is P(F and U) = 40/200 = 0.20. 12 4.2 Basic Concepts (cont.) Either of Two Events The probability of either event A or event B occurring is written as P(A or B). Example 4.2.6: In Datacomp Survey, the probability of selecting a person who is male or under 30 is P(M or U) = (120 + 40) / 200 = 0.80. 13 Conditional Probability Whenever you are given information and are asked to find a probability based on this information, the result is a conditional probability. This probability is written as P(A|B) and read as “probability of A given B”. Example 4.2.7: In Datacomp Survey, what is the probability that a randomly selected customer is male given that he is under 30? P(M | U) = 60/100 = 0.60. 4.2 Basic Concepts (cont.) Independent Events Events A and B are independent if the probability of event A is unaffected by the occurrence or nonoccurrence of event B. Events A and B are independent if and only if: Example 4.2.8: In Datacomp Survey, are events M and U independent? 14 P(A | B) = P(A) (assuming P(B) ≠ 0), or P(B | A) = P(B) (assuming P(A) ≠ 0), or P(A and B) = P(A) • P(B) P(M) = 120/200 = 0.6, P(M | U) = 60/100 = 0.6, so they are independent. P(U) = 100/200 = 0.5, P(U | M) = 60/120 = 0.5, so they are independent. P(M and U) = 60/200 = 0.3, P(M) • P(U) = 0.6 • 0.5 = 0.3, so they are independent. 4.2 Basic Concepts (cont.) Dependent Events Events that are not independent are dependent events. P(A | B) = P(A and B) /P(B) P(B | A) = P(A and B) /P(A) P(A and B) = P(A | B) • P(B) = P(B | A) • P(A) 15 4.2 Basic Concepts (cont.) Mutually Exclusive Events If an event can not occur when another event has occurred the two events are said to be mutually exclusive. Events A and B are mutually exclusive if their joint probability is zero, that is, P(A and B) = 0. P(A or B) = P(A) + P(B) Example 4.2.9: Consider an experiment of randomly selecting a card fro a deck of 52 cards. Is the event of selecting a queen mutually exclusive from the event of selecting a heart? No. Why? 16 Non-mutually Exclusive Events P(A and B) ≠ 0. P(A or B) = P(A) + P(B) - P(A and B). 4.3 Going Beyond the Contingency Table Venn Diagram In Venn diagram, a rectangle represents all possible outcomes of an experiment. Event are shown in the rectangle as circles. The probability of an event occurring is its corresponding area in the Venn diagram. A B A 0.4 A 0.6 17 Venn diagram for events A and B. The rectangle represents all possible outcomes of an experiment Venn diagram for P(A) = 0.4. 4.3 Going Beyond the Contingency Table (cont.) A Venn diagram for P(A and B). The points in the shaded area are in A and B B A Venn diagram for P(A or B). The points in the shaded area are in A or B B 18 A B Venn diagram of mutually exclusive events. P(A and B) = 0 and P(A or B) = P(A) + P(B). 4.3 Going Beyond the Contingency Table (cont.) 19 Probability Rules General Additive Rule P(A or B) = P(A) + P(B) - P(A and B) Special Additive Rule If A and B are mutually exclusive then P(A or B) = P(A) + P(B) Example 4.3.1: In Datacomp Survey, what is the probability of selecting a person who is male or under 30? That is, find P(M or U). P(M or U) = P(M) + P(U) – P(M and U) = 120/200 + 100/200 – 60/200 = 0.80 Example 4.3.2: The probability of event A is 0.5 and the probability of event B is 0.2. If P(A and B) is 0.1, what is P(A or B)? P(A or B) = P(A) + P(B) – P(A and B) = 0.5 + 0.2 – 0.1 = 0.6 Example 4.3.3: In Datacomp Survey, find P(M or F). P(M or F) = P(M) + P(F) – P(M and F) = 120/200 + 80/200 – 0/200 = 0.6 + 0.4 – 0 = 0.6 + 0.4 = P(M) + P(F) = 1.0 4.3 Going Beyond the Contingency Table (cont.) General Conditional Probability Rule P( A and B) P( B) P( A and B) P( B | A) P( A) P( A | B) assuming P(B) 0, and assuming P(A) 0 Special Conditional Probability Rule If events A and B are independent then: 20 P ( A | B) P ( A), and P ( B | A) P ( B) 4.3 Going Beyond the Contingency Table (cont.) Example 4.3.4: If P(A and B) = 0.4 and P(B) = 0.8, find P(A|B). P( A and B) 0.4 P( A | B) 0.5 P( B) 0.8 Example 4.3.5: If P(A) = 0.3 and P(B) = 0.4, and P(A and B) = 0.2, are events A and B statistically independent? Use conditional probability rules. 21 P( A and B) 0.2 P( A | B) 0.5 P( A) P( B) 0.4 P( A and B) 0.2 P( B | A) 0.67 P( B) P( A) 0.3 Events A and B are not independent. 4.3 Going Beyond the Contingency Table (cont.) Multiplicative Rule P( A and B) P( A | B) P( B) P( B | A) P( A) Special Multiplicative Rule If events A and B are independent then: P( A and B) P( A) P( B) Example 4.3.6: Let P(A) = 0.6, P(B) = 0.2, and P(A|B) = 0.1. Find P(A and B) P( A and B) P( A | B) P( B ) 0.1 0.2 0.02 22 4.3 Going Beyond the Contingency Table (cont.) Sampling Without Replacement Assume that you select a card from a deck, examine it, and then discard it. You then select another card. This procedure is called sampling without replacement. Example 4.3.7: Let A = selecting a king on the first draw, and B = selecting a king on the second draw. What is the probability of drawing two kings [P(A and B)]? If you select a king on the first draw, then, of the 51 cards remaining, three are kings. So, P(A) = 4/52 and P(B|A) = 3/51. P(A and B) = (4/52)(3/51) = 0.0045. 23 4.3 Going Beyond the Contingency Table (cont.) Sampling With Replacement Assume that you select a card from a deck and replace it before selecting the second card. This procedure is called sampling with replacement. Example 4.3.8: Let A = selecting a king on the first draw, and B = selecting a king on the second draw. What is P(B|A)? There are still 52 cards in the deck. So, P(B|A) = 4/52. Using Excel to Construct a Contingency Table KPK Data Analysis > Qualitative Data Charts > Contingency Table. 24 4.4 Tree Diagrams A tree diagram shows all possible outcomes of an experiment and the probabilities of each. A general form of a tree diagram is: E1 B E2 .. . 25 B En B Example 4.4.1: Draw a tree diagram for the Datacomp Survey data. 4.4 Tree Diagrams (cont.) Rules for Tree Diagram Rule # 1: The probability of the event on the right side (say, event B) of the tree is equal to the sum of the paths; that is, all probabilities along a path leading to event B are multiplied, and then summed over all paths leading to B. Rule # 2: The posterior probability for the ith path is: i - th path P( Ei | B) sum of paths where, the " sum of paths" is found using Rule # 1. 26 4.4 Tree Diagrams (cont.) Example 4.4.2: Zetadyne Corporation 50% of components produced on shift 1 20% of components produced on shift 2 30% of components produced on shift 3 6% of the components produced on shift 1 are defective 8% 27 of the components produced on shift 2 are defective 15% of the components produced on shift 3 are defective Shift 1 (.06) Defective (.08) Defective (.15) Defective 2 (.2) 3 4.4 Tree Diagrams (cont.) Solution 1 – What percentage of the components are defective? P(Defective) = sum of paths = (.5)(.06) + (.2)(.08) + (.3)(.15) = .030 + .016 + .045 = .091 Solution 2 – Given that a defective component is found, what is the probability that it was produced during shift 3? P(shift 3 | defective) 28 = third path sum of paths = (.3)(.15) .091 = (.045) = .495 .091