STEP-BY-STEP TECHNOLOGY GUIDE: Probability Simulations Using Technology

TI-83/84

Simulating 100 Die Rolls

  • Step 1 Set the random number seed as follows. (The random number seed is a number that the calculator uses to generate random numbers.) Enter any number on the home screen. Press STO →, then MATH, highlight PRB, select 1: rand, and press ENTER. On the home screen press ENTER.
  • Step 2 Press MATH, highlight PRB, select 5: randInt(, and press ENTER.
  • Step 3 Enter 1, comma, 6, comma, 100, close parenthesis (Figure 6).
  • Step 4 Store the data in list L1 as follows. Press STO →, then 2nd, then 1, then press ENTER.
  • Step 5 To examine the die rolls, press STAT, select 1: EDIT, and press ENTER (Figure 7).

Simulating Coin Flips

You can simulate coin flips instead of die rolls by coding “heads” as 1 and “tails” as 0. Use the instructions for simulating 100 die rolls with the following changes: Enter 0, comma, 1, comma, 100, close parenthesis, so that the home screen shows randInt(0, 1, 100).

image
Figure 5.6: FIGURE 6
image
Figure 5.7: FIGURE 7

EXCEL

Simulating 100 Die Rolls

  • Step 1 Select cell A1. Click the Insert Function icon fx.
  • Step 2 For Search for a Function, type randbetween, click Go, then click OK.
  • Step 3 For Bottom, enter 1. For Top, enter 6 (Figure 8). Click OK. Cell A1 now contains a simulated random die roll.
  • Step 4 Select cell A1, copy it, and paste the contents into cells A2 through A100.

    253

    image
    Figure 5.8: FIGURE 8 Random die rolls in Excel.

Simulating the Sum of Two Dice

  • Step 1 Generate 100 die rolls in column A and another 100 die rolls in column B.
  • Step 2 Select cell C1. Enter =(A1+B1), and press ENTER.
  • Step 3 Select cell C1, copy it, and paste the contents into cells C2 through C100. Column C then represents 100 randomly generated sums of two dice.

Simulating Random Draws from a Probability Table

We illustrate using Example 11 (page 250). Excel requires that the categories in the probability model be coded as numeric. We therefore code “Private company” as 1, “Federal government” as 2, and so on.

  • Step 1 Type the model categories (for example, “Employment type”) in column A, their numeric codes in column B, and the respective probabilities in column C.
  • Step 2 Click Data > Data Analysis > Random Number Generation, then OK.
  • Step 3 For Number of Variables, enter 1.
  • Step 4 For Number of Random Numbers, enter the desired sample size.
  • Step 5 For Distribution, select Discrete.
  • Step 6 For Value & Probability Input Range, click and drag to select the coded categories and their probabilities, for example, B1:C7. Click OK.

Repeat Steps 1–6 for increasing sample sizes.

Simulating Coin Flips

You can simulate coin flips instead of die rolls by coding “heads” as 1 and “tails” as 0. Use the die roll instructions with the following changes: For Bottom, enter 0. For Top, enter 1.

MINITAB

Simulating 100 Die Rolls

  • Step 1 Click on Calc > Random Data > Integer…
  • Step 2 For Number of rows of data to generate, enter 100.
  • Step 3 For Store in column(s), type C1.
  • Step 4 For Minimum value, enter 1. For Maximum value, enter 6.
  • Step 5 Click OK.

Simulating the Sum of Two Dice

  • Step 1 Generate 100 die rolls in C1 and another 100 die rolls in C2.
  • Step 2 Click Calc > Calculator. For Store result in variable, enter C3. For Expression, enter C1 + C2. Click OK. Column C3 then represents 100 randomly generated sums of two dice.

Simulating Random Draws from a Probability Table

We illustrate using Example 11 (page 250). Minitab requires that the categories in the probability model be coded as numeric.

We therefore code “Private company” as 1, “Federal government” as 2, and so on.

  • Step 1 Type the model categories in C1, their numeric codes in C2, and the respective probabilities in C3 (Figure 9).
  • Step 2 Click on Calc > Random Data > Discrete…
  • Step 3 For Number of rows of data to generate, enter the desired sample size.
  • Step 4 For Store in column(s), select the next available column, such as C4.
  • Step 5 For Values in, enter the column with the numerically coded categories, such as C2.
  • Step 6 For Probabilities in, enter the column with the probabilities, such as C3.
  • Step 7 Click OK.

Repeat Steps 1–7 for increasing sample sizes, as shown in Figure 9.

Simulating Coin Flips

You can simulate coin flips instead of die rolls by coding “heads” as 1 and “tails” as 0. Use the die roll instructions with the following changes: For Minimum value, enter 0. For Maximum value, enter 1.

image
Figure 5.9: FIGURE 9 Random draws in Minitab.

SPSS

Simulating 100 Die Rolls

  • Step 1 Select the header of the first column, and click Edit > Insert Variable. Highlight between 1 and 30 rows and click Edit > Insert Cases. More cases can be added by selecting more rows and choosing Edit > Insert Cases again.
  • Step 2 Go to Variable View. Name the first column Roll1.
  • Step 3 Click Transform > Compute Variable…. For Target Variable, put Roll1. Click in the Numeric Expression box, then under Function Group click Arithmetic, and under Functions and Special Variables double-click Rnd(1).
  • Step 4 Under Function Group, click Random Numbers, and under Functions and Special Variables double-click Rv.Uniform. Replace the two question marks in Numeric Expression with 1 and 6, as shown in Figure 10. Click OK and OK. Minimize the output window. The die rolls can be seen in the Data View tab.

    254

    image
    Figure 5.10: FIGURE 10 Random die rolls in SPSS

Simulating the Sum of Two Dice

  • Step 1 Select the header of the first column, and click Edit > Insert Variable. Repeat for the second and third column. Highlight between 1 and 30 rows, and click Edit > Insert Cases. More cases can be added by selecting more rows and choosing Edit > Insert Cases again.
  • Step 2 Go to Variable View. Name the first column Roll1, the second column Roll2, and the third column SumRolls.
  • Step 3 Generate 100 die rolls in Roll1 and another 100 die rolls in Roll2.
  • Step 4 Click Transform > Compute Variable. For Target Variable, put SumRolls. Click inside the Numeric Expression box, then double-click Roll1, click the plus sign, and double-click Roll2. Click OK and OK, and minimize the output window.

Simulating Coin Flips

You can simulate coin flips instead of die rolls by coding “heads” as 1 and “tails” as 0. Use the die roll instructions with the following changes: replace the two question marks with 0 and 1.

JMP

Simulating 100 Die Rolls

  • Step 1 Click File > New > Data Table. Click Rows > Add Rows…, and enter 100 rows.
  • Step 2 Select Column 1. Click Cols > Formula…. In the list under Functions(grouped), select Random > Random Integer.
  • Step 3 In the formula, replace n1 with 1,6, so the formula is Random Integer(1,6). Click OK.

Simulating the Sum of Two Dice

  • Step 1 Generate 100 die rolls in Column 1 and another 100 rolls in Column 2.
  • Step 2 Doubleclick the header of the third column, and select Column 3. Click Cols > Formula…. Select Column 1, the plus sign, then Column 2, as in Figure 11. Click OK.

Simulating Coin Flips

You can simulate coin flips instead of die rolls by coding “heads” as 1 and “tails” as 0. Use the die roll instructions, but change the formula to Random Integer(0,1).

image
Figure 5.11: FIGURE 11 Sum of two variables in JMP.