What Is a Chi-Square Test? Goodness of Fit and Independence
What Is a Chi-Square Test?
The chi-square test is a nonparametric test that judges how far observed frequencies deviate from expected frequencies using the chi-square statistic. Unlike the t-test and ANOVA, it works on frequencies (categories) rather than means.
When Do You Use a Chi-Square Test?
Use it when both variables are categorical (nominal or ordinal) and you want to examine differences in proportions between groups or an association between two variables. Testing the association between gender and party support is a typical example.
What Types of Chi-Square Tests Are There?
There are three, distinguished by purpose.
| Type | Purpose |
|---|---|
| Goodness-of-fit test | Does the observed distribution match the expected one |
| Test of independence | Are two categorical variables independent |
| Test of homogeneity | Do several groups share the same distribution |
How Do You Run a Chi-Square Test?
Work in order from the crosstabulation to interpretation.
Step 1: Build the Crosstabulation
Organize the observed frequencies for each combination of categories into a crosstabulation.
Step 2: Compute Expected Frequencies
Calculate the expected frequency for each cell and check what proportion falls below 5.
Step 3: Compute the Chi-Square Statistic and p-Value
Obtain the chi-square value, degrees of freedom, and p-value. A p-value below the threshold (usually .05) indicates a significant association.
Step 4: Report Effect Size
Report the strength of the association with Cramer's V or the phi (φ) coefficient.
What If Expected Frequencies Are Below 5?
If more than 20 percent of cells have expected frequencies below 5, the chi-square approximation becomes unreliable. Merge categories or use Fisher's exact test instead.
What Should You Be Careful About?
The chi-square test tells you only whether an association exists, not its direction or whether it is causal. With very large samples even trivial differences become significant, so an effect size must always be interpreted alongside the p-value.
Summary
The chi-square test examines association between categorical variables through crosstabulation, expected frequencies, the chi-square statistic, and effect size. Use Fisher's exact test when expected frequencies are small, and report association strength with Cramer's V. For group comparisons on a continuous outcome, see the t-test and ANOVA.