Object Library > Applets > Goodness of Fit Experiment
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 in the die probability dialog boxes. Some special distributions available include
The density of the true distribution is shown in blue in the first graph; the density of the test distribution is shown in green. The significance level can be selected from a list box and the sample size n can be varied with a scroll bar.
The test statistic U has (approximately) the chi-square distribution with 5 degrees of freedom. The density of U and the critical values are shown in blue in the second graph.
On each update, the sample values are recorded in the first table and the sample density is shown in red in the first graph. The value of the test statistic U is shown in red in the second graph. Note that the null hypothesis is rejected if and only if U falls outside of the critical values. 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 last graph and is recorded in the last table. The values of U and I are recorded in the middle table on each update.
This experiment illustrates the chi-square goodness of fit test in a familiar setting (dice). More generally, the experiment illustrates the concept of a hypothesis test, including null and alternative hypotheses, significance level, and test statistic. For a more detailed mathematical analysis, see
Click on the link below to download the Java archive file:
To add the applet to your web page, insert the following in the html file, at the point where you want the applet to appear:
<applet code="edu.uah.math.experiments.ChiSquareFitExperiment.class"
archive="ChiSquareFitExperiment.jar" width="650" height="400"></applet>
The jar file and the html file must be in the same folder.
This width and height dimensions are simply suggestions and can be varied. Generally, components such as graphs and tables expand and contract proportionally, while components such as buttons, scrollbars, dice, and coins are fixed in size.
Copyright © 2001-2003 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.
If you are interested in the Java source code or the Java documentation and object model for this applet, please visit ChiSquareFitExperiment in the Object section of the Library.