Simulation

The simulation model is used to generate values from discrete probability distributions or frequency tables. Up to ten categories can be simulated and up to 10,000 numbers can be generated in each experiment. The number and percentage of occurrences of each category are displayed and the generation of the numbers can be viewed on a step-by-step basis.

In order to generate a simulation problem it is necessary to provide the number of categories for the data. In the following screen we show a screen with both the data and solution for a simulation of 10 categories.

The elements of data are:

The number of trials. This is the number of random numbers to be generated. Up to 10,000 trials can be generated.

Seed. When using simulation, a seed for the random number generator must be given. The default seed for the computer is 0. If you use the same seed or row or column two times, the same set of random numbers will be generated. In other words, to run different experiments you must reset the random number generation process by changing the seed.

NOTE: For Taylor or Render users the following random number generation method is available.

Random number generation method. There are two basic ways that the random numbers can be generated. It is possible to have the software generate random numbers and then convert them to the desired frequencies, or it is possible to use the random numbers from a table in a book.

Value. The values for the variables are given here. In the example they are 1 through 10 but they can be any set of values. They are used for the computation of the expected value.

Category frequencies. The frequencies for each category are entered here. These must be nonnegative but do not need to be integer, nor do they need to sum to anything special (such as 1 or 100), since the program will total this column and scale the results.

Example: Simulating a frequency table

In the preceding screen we display a 10-category problem and its solution. At the top, it can be seen that we asked for 50 trials, with the computer generating random numbers and the seed being 3. The solution includes the following:

Total. This is the total of the frequency column and as mentioned before, is used for scaling. In this case we will divide the frequencies by 39 in order to determine the relative frequencies or probabilities.

Probability. This column represents the scaled frequency for each category given by the frequency divided by the total frequency. For example, category 2 has a relative frequency of 8 divided by 39, or 20.51%.

Cumulative. The cumulative probability is needed to convert the uniform random number from the computer or book to the appropriate relative frequency. The cumulative probability is simply the running sum of probabilities. For example, the cumulative probability for category 3 is .0256 + .2051 + .0769 = .3077.

Value*frequency. This column is used to compute the weighted average or expected value of the given frequency distribution. In this example, the column total is 5.2051 which is the weighted average of the two columns or the expected value of the distribution.

Occurrences. This is the count of the number of times this category was generated. The individual occurrences can be seen by displaying the history. In this experiment category 4 was generated three times.

Percentages This is the occurrences divided by the total number of trials. For example, the three occurrences of category 4 represents 6% of the total of 50 trials.

Occurrences*value. This column is used to compute the weighted average of the simulated frequency distribution. In this example, the column total is 281, which divided by the 50 runs yields a weighted average of 5.62.

A list of the 50 individual numbers can be displayed.

The first uniform number generated was .37 and this falls between .3077 and .4103, the cumulative for category 4 so category 4 is chosen. The second random number generated was .5337 and this falls between .4615 and .5897, so category 6 is designated.