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 presented below.

Describe the possible outcomes.

Link each outcome to one or more random numbers.

Choose a source of random numbers.

Choose a random number.

Based on the random number, note the "simulated" outcome.

Repeat steps 4 and 5 multiple times; preferably, until the
outcomes show a stable pattern.

Analyze the simulated outcomes and report results.

Note: When it comes to choosing a source of random numbers
(Step 3 above), you have many options. Flipping a coin and
rolling dice are low-tech but effective. Tables of random numbers
(often found in the
appendices of statistics texts) are another option. And good
random number generators can be found on the internet.

Random Number Generator

When you need random numbers, coin flipping, dice rolling, and random number tables can be cumbersome, particularly
with large samples. As an alternative, use Stat Trek's Random Number
Generator. With the Random Number Generator, you can select up to 1000 random
numbers quickly and easily. The Random Number Generator is free. It can found in the Stat Trek
main menu under the Stat Tools tab. Or you can tap the button below.

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, and suppose he gets exactly two "at bats" in every game.
Using simulation, estimate the likelihood that the
player will hit 2 home runs in a single game.

Solution

Earlier we described seven steps required to produce a useful
simulation. Let's apply those steps to this problem.

Describe the possible outcomes. For this problem, there are
two outcomes - the player hits a home run or he doesn't.

Link each outcome to one or more random numbers. Since the
player hits a home run in 10% of his at bats, 10% of the
random numbers should represent a home run. For this problem,
let's say that the digit "2" represents a home run and
any other digit represents a different outcome.

Choose a source of random numbers. For this problem,
we used Stat Trek's
Random Number Generator
to produce a list of 500 two-digit numbers (see below).

Choose a random number. The list below shows the random
numbers that we generated.

Based on the random number, note the "simulated" outcome.
In this example, each 2-digit number represents two "at-bats" in a single game.
Since the digit "2" represents a home run, the number "22"
represents two home runs in a single game. Any other 2-digit number
represents a failure to hit consecutive home runs in the game.

Repeat steps 4 and 5 multiple times; preferably, until the
outcomes show a stable pattern. In this example, the list
of random numbers consists of 500 2-digit pairs; i.e., 500
repetitions of steps 4 and 5.

Analyze the simulated outcomes and report results. In the
list, we found 6 occurrences of "22", which are highlighted in red in
the table. In this simulation, each occurrence of "22"
represents a game in which the player hit consecutive home runs.

The simulation predicts that this particular player will hit consecutive home
runs 6 times in 500 games. Thus, the simulation suggests that
there is a 1.2% chance that he will hit two home runs in a single game.
The actual probability, based on the
multiplication rule, states that there is a 1.0% chance that this player
will hit consecutive home runs in a game. 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.