### Probability by Simulation and Resampling

Simulation is the process of imitating an experiment using a physical or computational means. In this lab you are to create several simulations and resample (repeat the experiment) to compute probability.

Problem 1. In this problem you are to simulate a simple gaming device to estimate information about the outcomes. Retrieve the worksheet One-key Bandit. (RIGHT-CLICK the link and Save to your computer.).

Now open this worksheet. Notice that in row 3 the worksheet contains a sample of size 3 randomly selected from among the items: apple, banana, coconut, grape, orange, and pear. When the Recalculate Key (F9) is pressed a new sample is randomly generated. Try it a few times to check.

A. Your goal is to determine how many times, on the average, the game must be played before obtaining all 3 entries the same. To collect data create the following table (not in columns A-C).
 Trial 1 2 3 4 5 Average # Plays
Now Experiment. Keep track of the number of times you press the recalculate key (F9) before all three match. Record this number as Trial 1 and do it again for Trials 2 and 3. For Trials 4 and 5 ask a classmate for two numbers. Find the average number of plays needed. In a text box write a summary explaining why these numbers are different and give your best guess as to what the theoretical value should be.

B. We now consider the probability of three matches? Two matches? No matches? To check the play of 100 games copy the cell range A3..C3 to the range A6..A105. This will produce the outcome of 100 games. Examine the results of these games to fill in Trial 1 of the table below.

 Trial 1 2 Three matches Two matches No matches
Now, press the recalculate key (F9) to randomly generate another 100 games and fill in the data for Trial 2. In a text box state your estimates for the percentage of games that fall into each category.

Problem 2. This problem illustrates how to set up a simulation for computing a probability. You will use the Excel formulas =Rand() to generate random numbers between 0 and 1, =Int(value) to round value down to the nearest integer, and the logical cell formula

=If(logical_condition, if_true_do,if_false_do)
for considering cases based on a condition.
Here is the situation:
Assume Michael Jordan has an 83% free throw average. Find the probability he makes 10 free throws in a row without a miss.

The strategy: Consider each free throw shot as a random integer from 1 to 100 where a number from 1 to 83 represents a successful throw and a number from 84 to 100 represents a miss. To simulate a free throw we need to generate a random integer from 1 to 100. There are two cell formulas that can do this: either

=RandBetween(1,100) or =Int(100*Rand()+1).
The latter formula is used below although either may be used. To make it easy to count the number of successes and misses we would like a formula to report 1 if a free throw is successful and 0 if it is a miss. This is done using the logical cell formula where we want a 1 value (a success) if the random integer is less than 84; otherwise, a 0 (a miss). Enter the formula
=If(Int(100*Rand()+1)<84,1,0)
in a cell. Press the Recalculate key (F9) a few times to see if the formula is working.

Now, set up a simulation for 10 free throws. Place the formula above in a cell to simulate one free throw and copy it to 9 other cells (in the same row). How many free throws were successful? The =sum(cell range) formula can be used to report the number of successes.

Okay, that's one trial. To calculate the probability of no misses copy the row with 10 shots 100 times and compute the percentage that there were no misses out of 10. State your conclusion in a text box.

In the next problem model the game and perform a simulation to answer the questions.

Problem 3. Suppose a baseball player has a batting average of .305. (That means, he gets a hit 30.5% of the time or gets 305 hits in every 1000 at-bats.) Assume the player gets 4 at-bats per game.
A. Simulate the players performance for 100 games (NOT at-bats). From the simulation estimate the probability of 0, 1, 2, 3, and 4 hits in a game.

B. Use the distribution computed in Part A to estimate the probability the player goes hitless in a game.

C. Use the distribution computed in Part A to estimate the probability the player gets at least 2 hits in a game.