- You have rolled a die a number of times and have observed how many times each of the possible outcomes has occurred. You want to test the hypothesis that the die is a fair die. To do this you compute the chi-squared value using the numbers you observed and their expected value if the die is fair. You then want to get some idea about how large this chi-squared value should be to reject the hypothesis that the die is fair. To do this you repeat this experiment many times computing each time the chi-squared value. You then plot a distribution of these observed chi-squared values. This program carried out this simulation. You specify a "Number of rolls" for the die and also a "Number of trials" for the simulation.

The source.

ChiSquareGraph.java