A Guide to Chi-Squared Tests for Inference

Differences Between the Tests

Category Goodness of Fit Test for Independence Test for Homogeneity
Number of Categorical Variables 1 2 2
Number of Samples 1 1 2+
Data for Input Observed + Expected Observed Only Observed Only
Null Hypothesis H0: Observed values equal the expected values H0: Variables are independent H0: There is no difference in the distributions
Alternative Hypothesis Ha: Observed values do not equal the expected values Ha: Variables are not independent Ha: There is a difference in the distributions

“State” Step

In the state step, you must include the null hypothesis, alternative hypothesis, and the alpha value. The alpha value is just like in the other tests, usually ranging from 0.01 to 0.10 (for reasonable alpha values). The hypotheses, however, are different depending on which chi-squared test you are performing, so you should refer to the table above.



“Plan” Step

In the plan step, you must first state the name of the test you are performing. Then, you must check all of the conditions necessary for the test in order to proceed to the next steps.



“Do” Step

In the do step, you calculate the test statistic, degrees of freedom, and the p-value of such a test.

Degrees of Freedom (df):

Test Statistic:

To get the test statistic, first subtract the observed value minus the expected value, square it, and then divide by the expected value. Then, add all of these values together for all cells to get the test statistic.

P-Value:

To get the p-value, use the degrees of freedom and the test statistic in a chi-squared distribution table or a calculator.

To see an interactive chi-squared distribution graph, you can visit Stapplet’s Chi-Squared Distribution Graph that allows you to visualize what the graph looks like with different degrees of freedom.



“Conclude” Step

To conclude the test, you must compare your p-value to your alpha much like in other tests. Reject the null if the p-value is lower than the alpha, and fail to reject it if the p-value is higher than the alpha. Make sure you state your conclusion in context.



“Follow-Up” Step

If you reject the null hypothesis, you must state the cell that most significantly contributed to your chi-squared test statistic. With this, you must also state the observed value of this cell and whether it was higher/lower than the expected value. This is not necessary if you fail to reject the null hypothesis.



Related Calculators

Now, you can try your hand at the chi-squared tests on your own and use these calculators to check your work!