5  Introduction to Simulation

Example 5.1

Let \(X\) be the sum of two rolls of a fair four-sided die, and let \(Y\) be the larger of the two rolls (or the common value if a tie). Set up a “box model” and explain how you would use it to simulate a single realization of \((X, Y)\). Could you use a spinner instead?




Example 5.2

Consider the matching problem with \(n=4\). Label the objects 1, 2, 3, 4, and the spots 1, 2, 3, 4, with spot 1 the correct spot for object 1, etc. Let \(X\) be the number of rocks that are placed in the correct spot, and let \(C\) be the event that at least one rock is placed in the correct spot. Describe how you would use a box model to simulate a single realization of \(Y\) and of \(C\). Could you use a spinner instead?




Example 5.3 Consider a version of the meeting problem where Regina and Cady will definitely arrive between noon and 1, but their exact arrival times are uncertain. Rather than dealing with clock time, it is helpful to represent noon as time 0 and measure time as minutes after noon, so that arrival times take values in the continuous interval [0, 60].

Explain how you would construct a spinner and use it to simulate an outcome. Why could we not simulate this situation with a box model?




Example 5.4

In the meeting problem, how could you construct a circular spinner to represent that they are more likely to arrive near 12:30 and less likely to arrive near 12:00 or 1:00? Imagine the spinner needle is still equally likely to point at any value on the circular axis.




\[ {\small \text{P}(A) \approx \frac{\text{number of repetitions on which $A$ occurs}}{\text{number of repetitions}}, \quad \text{for a large number of $\text{P}$-repetitions} } \]

Example 5.5

Use a four-sided die (or a box or a spinner) and perform by hand 10 repetitions of the simulation in Example Example 5.1. (Yes, really do it.) For each repetition, record the results of the first and second rolls (or draws or spins) and the values of \(X\) and \(Y\). Based only on the results of your simulation, how would you approximate the following? (Don’t worry if the approximations are any good yet.)

  1. \(\text{P}(A)\), where \(A\) is the event that the first roll is 3.




  2. \(\text{P}(X=6)\)




  3. \(\text{P}(X \ge 6)\)




  4. \(\text{P}(Y = 3)\)




  5. \(\text{P}(Y \ge 3)\)




  6. \(\text{P}(X=6, Y=3)\)




  7. \(\text{P}(X\ge6, Y \ge 3)\)




  8. Construct a table of the simulated relative frequencies of each possible value \(x\) of \(X\).




  9. Construct a table of the simulated relative frequencies of each possible value \((x, y)\) pair of \((X, y)\).




  10. Will the results above tend to produce good estimates of the corresponding theoretical values? Why? If not, how could we improve the estimates?




Example 5.6

Recall the meeting problem. Describe in detail how, in principle, you could conduct by hand a simulation and use the results to approximate the probability that Regina and Cady arrive with 15 minutes of each other for the following two models. (See Sections 2.4.2 and 2.5.1 of the textbook.)

  1. Uniform(0, 60), independent arrivals model




  2. Normal(30, 10), independent arrivals model