Chi-Square Test: Is There a Relationship Between Categorical Variables?

Learn the logic and reporting format of the chi-square test, used to check whether two categorical variables are related.

When is this test used?

It’s used to test whether a relationship (dependency) exists between two categorical variables — for example, examining whether gender is related to a purchase decision.

How it works

First, a contingency (cross-tab) table is built and the observed frequencies are recorded. Then, assuming no relationship exists between the two variables, “expected” frequencies are calculated. The larger the gap between observed and expected frequencies, the larger the chi-square statistic — pointing toward an existing relationship.

Assumptions

  • Observations must be independent of each other.
  • Each cell in the contingency table should generally have an expected frequency of at least 5.
  • Data must be entered as counts (frequencies), not as proportions or percentages.

How to report the result

Example: If you find χ²(1, N=200) = 6.42, p = 0.011, you conclude there’s a statistically significant relationship between the two categorical variables. You should also report the strength of that relationship using an effect-size measure such as Cramér’s V.

When expected cell frequencies drop below 5 (especially in small samples), Fisher’s exact test should be used instead of the chi-square test.