Simulation Simulation Simulation imitation of chance behavior based on a model that accurately reflects the phenomenon under consideration By observing simulated outcomes, researchers gain insight on the real world. Simulation Why use simulation? Some situations do not lend themselves to precise mathematical treatment. Others may be difficult, time-consuming, or expensive to analyze. In these situations, simulation may approximate real-world results; yet, require less time, effort, and/or money than other approaches. How to Conduct a Simulation A simulation is useful only if it closely mirrors real-world outcomes. The steps required to produce a useful simulation are below: State the problem or describe the random phenomenon. 2. State the assumptions. 3. Assign digits to represent outcomes (die, spinner, random 1. digit table, calc.) Simulate many repetitions 5. State your conclusions. 4. (until outcome shows stable pattern) Simulation Example In this section, we work through an example to show how to apply simulation methods to probability problems. Problem Description On average, suppose a baseball player hits a home run once in every 10 times at bat. Using simulation, estimate the likelihood that the player will hit 2 home runs in consecutive at bats. Solution Use five steps required to produce a useful Simulation: 1. Problem: – 2. State Assumptions: – – 3. at bats are independent of each other (that is, what happens during one at bat does not influence the next at bat) Homerun occurs 10% of at bats Assign Digits: – – – – 4. Estimate the likelihood that the player will hit 2 home runs in consecutive at bats two possible outcomes: home run or no home run “2” represents a home run and other digits represent no home run “22” represents back to back home runs Any other two digit combination represents failure to hit back to back homeruns Simulate Many Repetitions: – Stat Trek’s random digit generator was utilized for this example – In this example, the list of random numbers consists of 500 2-digit pairs 5. State Conclusions – In the list, we found 6 occurrences of "22", which are highlighted in red in the table Random Numbers 42 86 36 17 30 74 51 32 45 89 39 46 59 04 53 34 74 92 68 49 62 06 82 63 76 99 92 90 20 82 75 73 03 64 31 56 86 47 14 39 69 30 97 22 52 13 80 05 35 96 02 76 28 38 80 27 06 89 31 78 57 41 83 30 08 18 34 81 59 70 85 32 11 21 36 65 24 88 84 11 43 08 03 31 90 54 49 77 09 73 69 96 29 20 15 16 75 39 35 62 04 53 34 74 92 68 49 62 06 82 63 76 21 70 78 91 09 85 66 79 23 99 80 93 38 14 39 69 30 97 22 52 13 80 05 35 96 63 88 17 79 46 44 00 35 28 27 83 18 11 30 08 18 34 81 59 70 85 32 11 21 36 10 89 72 14 61 40 24 65 12 91 01 17 64 09 73 69 96 29 20 15 16 75 39 35 62 95 85 81 82 41 05 01 28 61 25 20 48 07 70 78 91 09 85 66 79 23 99 80 93 38 87 95 08 26 02 83 96 40 16 98 10 55 04 88 17 79 46 44 00 35 28 27 83 18 11 10 40 01 94 93 22 84 77 75 05 67 60 58 89 72 14 61 40 24 65 12 91 01 17 64 42 53 68 15 94 04 19 93 45 55 97 44 23 85 81 82 41 05 01 28 61 25 20 48 07 71 67 94 26 90 86 14 73 37 32 33 92 56 95 08 26 02 83 96 40 16 98 10 55 04 12 25 43 19 00 13 57 33 15 27 72 21 29 40 01 94 93 22 84 77 75 05 67 60 58 88 50 43 41 71 33 26 24 54 16 09 07 37 53 68 15 94 04 19 93 45 55 97 44 23 06 48 95 74 84 00 47 25 36 51 98 77 87 67 94 26 90 86 14 73 37 32 33 92 56 52 79 12 02 98 99 58 22 18 45 78 42 37 25 43 19 00 13 57 33 15 27 72 21 29 42 86 36 17 30 74 51 32 45 89 39 46 59 50 43 41 71 33 26 24 54 16 09 07 37 99 92 90 20 82 75 73 03 64 31 56 86 47 48 95 74 84 00 47 25 36 51 98 77 87 02 76 28 38 80 27 06 89 31 78 57 41 83 79 12 02 98 99 58 22 18 45 78 42 37 65 24 88 84 11 43 08 03 31 90 54 49 77 This simulation predicts that the player will hit consecutive home runs 6 times in 500 at bats. Thus, the simulation suggests that there is a 1.2% chance that a randomly selected pair of at bats would consist of two home runs. The actual probability, based on the multiplication rule, states that there is a 1.0% chance of hitting consecutive home runs. While the simulation is not exact, it is very close. And, if we had generated a list with more random numbers, it likely would have been even closer. 1. Orders of frozen yogurt flavors have the following relative frequencies: 38% chocolate, 42% vanilla, 20% strawberry. State problem. – 2. State assumptions. – – – 3. 5. Frequencies are the same as stated Assume that customers order one flavor only Customers’ choices of flavors do not influence one another Assign digits. – – – 4. Simulate 10 frozen yogurt sales based on this recent history. 00-37 chocolate 38-79 vanilla 80-99 strawberry Simulate. State your conclusions. Simulate: Use Calculator to simulate – Results: Run 20 numbers State Conclusions: – Chocolate: – Vanilla: – Strawberry: A couple plans to have children until they have a girl or until they have four children, whichever comes first. Problem: – Simulate and estimate probability that the strategy will produce girl Assumptions: – Probability of obtaining girl .5 and boy .5 – Sexes of successive children independent Assign Digits (or flip coin): – 0, 1, 2, 3, 4 = girl – 5, 6, 7, 8, 9 = boy Simulate using line 130 of table B: Conclusions: Homework 6.1-4, 8-9, 12