# Dice Experiment

## Description and Use

The experiment consists of rolling n dice, each governed by the same probability distribution. You can specify the die distribution by clicking on the die probability button; this button bring up the die probability dialog box. You can define your own distribution by typing probabilities into the text fields of the dialog box, or you can click on one of the buttons in the dialog box to specify one of the following special distributions:

• fair: each face has probability 1/6
• 1-6 flat: faces 1 and 6 have probability 1/4 each; faces 2, 3, 4, and 5 have probability 1/8 each.
• 2-5 flat: faces 2 and 5 have probability 1/4 each; faces 1, 3, 4, and 6 have probability 1/8 each.
• 3-4 flat: faces 3 and 4 have probability 1/4 each; faces 1, 2, 5, and 6 have probability 1/8 each.
• skewed left: face i has probability i / 21 for i = 1, 2, 3, 4, 5, 6.
• skewed right: face i has probability (7 - i) / 21 for i = 1, 2, 3, 4, 5, 6.

The following random variables are recorded on each update:

• The sum of the scores Y.
• The average score M.
• The minimum score U.
• The maximum score V.
• The number of aces (1's) Z.

Any one of these variables can be selected with a list box. The density and moments of the selected variable are shown in blue in the distribution graph and are recorded in the distribution table. When the simulation runs, the empirical density and moments are shown in red in the distribution graph and are recorded in the distribution table. The parameter n can be varied with a scroll bar.

This experiment uses the die as a metaphor for a random variable taking a finite set of values, and involves a number of standard transformations. Thus, the experiment illustrates the central limit theorem, the law of large numbers, the distribution of the sample mean, and the distribution of the extreme order statistics.

• August, 2003

### Authors

• Kyle Siegrist
• Dawn Duehring

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details.

## The Dice Experiment

Figure 1 shows a screen shot of the Dice Experiment, a typical applet in the library.

• If your browser supports Java (version 1.4 or later), you can click on Figure 1 to open a new web page with the live applet.
• If you need to install the Java plug-in for your browser, visit Java.com. ### Figure 1. A typical view of the Dice Experiment

The Dice Experiment applet is a virtual random experiment that rolls dice, collects data, and displays the data in tables and a graph. Specifically, the basic experiment is to roll n dice and record the values of the following random variables:

• Y: the sum of the n dice scores
• M: the average of the n dice scores
• U: the minimum of the n dice scores
• V: the maximum of the n dice scores
• Z: the number of aces (1's) among the n dice scores

The simulation is controlled by the buttons and selection boxes in the main toolbar (Figure 2) at the top. ### Figure 2. The main toolbar

• The first button runs the experiment one time -- the dice are rolled one at a time, with audible feedback, and then the tables and graphs are updated.
• The second button runs the experiment repeatedly. In this mode,
• the dice are rolled all at once on each run of the experiment,
• the tables and graphs are updated periodically, according to the number in the Update setting, and
• the simulation stops after the number of runs specified in the Stop setting.
• The third button in the main toolbar can be used to stop the simulation at any time -- the data in the tables and graphs are preserved.
• The fourth button in the main toolbar clears the data in the tables and graphs and restores the applet to its initial state.

The table on the left records the values of the five random variables on each update. The table on the right gives the probability mass function, mean, and standard deviation of a selected random variable in the distribution column, and the relative frequency function, empirical mean, and empirical standard deviation in the data column. The graph on the right gives exactly the same information as the table on the right, but in graphical form rather than numerical form. Information about the theoretical distribution is displayed in blue, and information about the empirical data is displayed in red. The choice of the random variable to display in the table and graph is made with the drop-down box in the second toolbar (Figure 3). ### Figure 3. Selection of random variable

The number of dice can be varied from 1 to 30 with the scroll bar. Clicking on the die icon brings up a dialog box (Figure 4) for specifying the probabilities that govern each die: ### Figure 4. The die probabilities dialog box

The buttons along the top of this dialog box specify six "pre-packaged" die distributions. The first gives uniform probabilities (corresponding to a fair die), and the others give various non-uniform distributions for a crooked die. Additionally, the student can specify the probabilities directly in the text boxes.

Information about each component in the applet is given in a tool tip that appears when the student rests the cursor on the component. Basic information about the applet is also given in a help box that pops up when the student clicks on the information button in the main toolbar.

In the next section I will cover the nuts and bolts of how you could include this applet in your own Web-based course materials. Then I will return to the more interesting discussion of pedagogical issues.