A chi-square goodness of fit test is used with a single qualitative (categorical) variable. It checks whether the counts we observed across the categories are consistent with a hypothesised set of proportions.
Specify how many categories your single qualitative variable has. For example, a six-sided die has 6 categories (one for each face).
Number of categories \( (k) = \)
Error: The number of categories must be a whole number of at least 2.
The null hypothesis states the true proportion we expect in each category. Enter the null proportion for each category below — these must add up to 1. By default they are set to be equal across all categories (i.e. \( \tfrac{1}{k} \) each), which for a die is the "fair die" hypothesis of \( \tfrac{1}{6} \) per face.
The box model on the right represents this null hypothesis: it holds one labelled ticket per category, arranged so the proportion of each label matches the null proportion you specified.
Unlike some other tests, in a chi-square goodness of fit test there is no choice to make for the alternate hypothesis. The alternate hypothesis is simply that the null hypothesis is wrong — that is, at least one of the category proportions is not equal to its hypothesised value.
We write this as: at least one of the equalities in \( H_0 \) does not hold.
Null Hypothesis
Alternate Hypothesis
For the chi-square goodness of fit test to be valid, we need to check the following assumptions:
The first assumption is that the observations are independent of one another. This means that whether one observation falls into a particular category has no effect on the category any other observation falls into.
For example, if we roll a die 60 times, each roll is independent: the face that comes up on one roll tells us nothing about the face on the next roll. This assumption would be violated if, say, we counted the same set of observations twice, or if observations were selected in a way that let one influence another (for instance, asking a group of friends who tend to agree, rather than a random sample of people).
How do we check? We check by investigating the experimental setup — how the data was collected — rather than by looking at the numbers themselves. We ask whether each observation was gathered separately and at random, so that no observation could influence another.
The chi-square distribution is only a good approximation when the expected counts are not too small. Cochran's rule gives a common guideline, which holds when both of the following are true:
The expected count for a category is \( E_i = n \times p_i \), where \( p_i \) is that category's null proportion. The table below lists them:
The test statistic measures how far the observed counts are from the counts we would expect under the null hypothesis. It is calculated by working out, for each category, the quantity \( \frac{(O - E)^2}{E} \) (where \( O \) is the observed count and \( E \) is the expected count), and then summing across all categories:
$$\chi^2 = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i}$$The table below carries out this calculation. The final row sums each column; the sum of the last column is the test statistic.
One way to tell whether we accept or reject the null hypothesis is to observe whether our p-value is below or above the significance level.
Step 1) What is your significance level?
\( \alpha = \)
Error: The value for α must be between 0 and 1.
Step 2) Final Conclusion