Simulation from independent model with all joint probabilities 1/9

This page uses a simulation to show that the 'obvious' test statistic, , has a distribution that depends on the sample size, but that the distribution of the χ2 statistic depends only on the size of the contingency table (assuming independence).

Poor statistic

With the 'poor' test statistic, take a few samples and observe the variability in the differences and their sum of squares. Increase the sample size and repeat. The differences and their sum of squares are higher.

Chi-squared statistic

Now selecct Chi-squared statistic from the pop-up menu at the top of the page.

Click Accumulate and build up the distribution of the χ2 statistic.

Repeat with different sample sizes and with different marginal probabilities and observe that:

The distribution of χ2 remains the same (approx).