A Chi-Square goodness of fit test is used to determine whether or not a categorical variable follows a hypothesized distribution.
The following step-by-step example shows how to perform a Chi-Square goodness of fit test by hand.
Chi-Square Goodness of Fit Test By Hand
Suppose we believe that a certain dice is fair. In other words, we believe the dice is equally likely to land on a 1, 2, 3, 4, 5, or 6 on a given roll.
To test this, we we roll it 60 times and record the number that it lands on each time. The results are as follows:
- 1: 8 times
- 2: 12 times
- 3: 18 times
- 4: 9 times
- 5: 7 times
- 6: 6 times
Use the following steps to perform a Chi-Square goodness of fit test to determine if the dice is fair.
Step 1: Define the Null and Alternative Hypotheses
- H0 (null): The dice is equally likely to land on each number.
- H1 (alternative) : The dice is not equally likely to land on each number.
Step 2: Calculate the Observed and Expected Frequencies
Next, let’s create a table of observed and expected frequencies for each number on the dice:
Note: If we believe the dice is fair, this means we expect it to land on each number an equal amount of times – in this case, 10 times each.
Step 3: Calculate the Test Statistic
The Chi-Square test statistic, X2, is calculated as:
- X2 = Σ(O-E)2 / E
The following table shows how to calculate this test statistic:
In this case, X2 turns out to be 9.8.
Step 4: Find the Critical Value
Next, we need to find the critical value in the Chi-Square distribution table that corresponds to α = .05 and df = (#categories – 1).
In this case, there are 6 categories, so we will use df = 6 – 1 = 5.
We can see that the critical value is 11.07.
Step 5: Reject or Fail to Reject the Null Hypothesis
Since our test statistic is less than the critical value, we fail to reject the null hypothesis. This means we do not have sufficient evidence to say that the dice is unfair.
The following resources offer additional information on the Chi-Square goodness of fit test:
Introduction to the Chi-Square Goodness of Fit Test
How to Perform a Chi-Square Goodness of Fit Test in R
Chi-Square Goodness of Fit Test Calculator