### The Dice Goodness of Fit Experiment

#### Description

The experiment is to select a random sample from a specified distribution and perform the chi-square goodness of fit test to another specified distribution, at a specified level of significance. The distributions are discrete distributions on \(\{1, 2, 3, 4, 5, 6\}\), and thus the experiment corresponds to rolling \(n\) dice, each governed by the same distribution.

The true distribution and test distribution can be specified with the list boxes. The following distributions can be chosen:

- fair: each face has probability \(\frac{1}{6}\).
- 1-6 flat: faces 1 and 6 have probability \(\frac{1}{4}\) each; faces 2, 3, 4, and 5 have probability \(\frac{1}{8}\).
- 2-5 flat: faces 2 and 5 have probability \(\frac{1}{4}\) each; faces 1, 3, 4, and 6 have probability \(\frac{1}{8}\) each.
- 3-4 flat: faces 3 and 4 have probability \(\frac{1}{4}\) each; faces 1, 2, 5, and 6 have probability \(\frac{1}{8}\) each.
- skewed left: face \(i\) has probability \(\frac{i}{21}\) for \(i \in \{1, 2, 3, 4, 5, 6\}\).
- skewed left: face \(i\) has probability \(\frac{7 - i}{21}\) for \(i \in \{1, 2, 3, 4, 5, 6\}\).

The probability density function of the true distribution is shown in blue in the first graph; the probability density function of the test distribution is shown in green. The significance level and the sample size can be varied with input controls.

The test statistic \(V\) has (approximately) the chi-square distribution with 5 degrees of freedom. The probability density function of \(V\) and the critical value are shown in blue in the second graph.

On each run, the sample density function is shown in red in the first graph. The value of the test statistic \(V\) is shown in red in the second graph. Note that the null hypothesis is rejected if and only if \(V\) falls outside of the critical values. Random variable \(I\) indicates the event that the null hypothesis is rejected. On each update, the empirical density of \(I\) is shown in red in the distribution graph and is recorded in the distribution table. The values of \(V\) and \(I\) and the \( P \)-value are recorded in the data table on each run. The goodness of fit table shows the expected frequencies, and on each run, the observed frequencies.