A thesis contained 27 cross-tabulations, each followed by “χ² = …, p < 0.05, therefore there is an association”. The examiners asked: in the 5 × 4 table of occupation by satisfaction, which groups differ from which? The author could not say, because the overall chi-square test only tells you there is a difference somewhere, not where.
The chi-square test is simple and useful for two categorical variables. Using it well means knowing what it compares, which conditions make it unreliable, and how to read beyond the p-value.
What the test compares
The test of independence compares observed counts in each cell with expected counts under the assumption that the two variables are unrelated. A cell’s expected count is its row total times its column total, divided by the overall sample size.
A hypothetical example: 200 students, 100 online and 100 in person; 152 passed and 48 did not.
| Pass | Fail | Total | |
|---|---|---|---|
| Online | 70 (expected 76) | 30 (expected 24) | 100 |
| In person | 82 (expected 76) | 18 (expected 24) | 100 |
| Total | 152 | 48 | 200 |
Each cell contributes (observed − expected)² / expected. The two pass cells contribute 36/76 ≈ 0.47 each; the two fail cells contribute 36/24 = 1.5 each. Total χ² ≈ 3.95 with 1 degree of freedom, p ≈ 0.047. Notice that the fail cells contribute more despite the same absolute gap, because their expected counts are smaller.
Assumptions concern expected counts, not observed ones
The chi-square approximation becomes unreliable when expected counts are small. A common rule: no cell with an expected count below 1, and no more than 20% of cells below 5. Many people wrongly check observed counts. Software such as SPSS prints a footnote on how many cells have expected counts below 5; read it.
When the condition fails:
- For a 2 × 2 table, use Fisher’s exact test.
- For larger tables, merge small categories that are close in meaning (“very dissatisfied” with “dissatisfied”), or use an exact or Monte Carlo test if your software offers one.
- Never merge categories just to reach significance; decide on substantive grounds and say so.
Yates’ continuity correction for 2 × 2 tables is debated because it is conservative; many statisticians suggest Fisher for small samples and no correction for large ones. Whatever you choose, state it.
Beyond the p-value: which cells drive the difference?
For tables larger than 2 × 2, a significant overall test is only a starting point. The most useful tool is the adjusted standardised residual for each cell. Absolute values above roughly 2 indicate a cell with notably more or fewer cases than expected. When scanning many cells, use a stricter threshold or correct for multiple comparisons.
In SPSS, tick “Adjusted standardized” under Cells in Crosstabs. In R, the result of chisq.test contains a stdres component.
Effect size: Cramér’s V and phi
With large samples, very weak associations still produce small p-values. Report an effect size:
- Phi for 2 × 2 tables.
- Cramér’s V for larger tables: the square root of χ² divided by n times (the smaller of rows or columns minus 1).
In the example, Cramér’s V = √(3.95 / 200) ≈ 0.14, a weak association. For a 2 × 2 table, the clearest presentation is often the difference in proportions with a confidence interval: 70% versus 82%, a 12-point gap.
When not to use the independence chi-square test
| Situation | Use instead |
|---|---|
| The same people measured twice (before/after) on a yes/no outcome | McNemar’s test |
| One variable is ordinal and you want to test a trend | A trend test (Cochran–Armitage) or ordinal regression |
| You need to adjust for other variables | Logistic regression or Cochran–Mantel–Haenszel |
| The data are percentages or means, not counts | Not χ²; convert to counts or choose another test |
| Respondents could tick several options in one question | Observations are not independent; analyse each option separately or use specialised methods |
Do not run 27 tables and report the significant ones
Running dozens of cross-tabs and reporting only those with p < 0.05 is a form of p-hacking. With 27 independent tests, around one will be “significant” by chance alone. Decide in advance which associations your research questions require, report all of those fully, and treat the rest as exploratory.
In practice: presenting one cross-tab
- Show counts and percentages by row (or column, depending on the question), and say which direction the percentages run.
- Check expected counts; choose χ² or Fisher and give the reason.
- Report χ², degrees of freedom, n, p and Cramér’s V.
- For larger tables, name the cells with notable adjusted residuals.
- Write one interpretive sentence using proportions, not just “there is an association”.
Sample sentence: “The pass rate was higher for in-person students than online students (82% vs 70%; χ²(1, N = 200) = 3.95; p = 0.047; phi = 0.14).”
Next step: take the largest cross-tab in your paper, switch on adjusted standardised residuals and see which cells actually drive the result. Rewrite your interpretation so readers know exactly which groups differ.
Câu hỏi thường gặp
When should I use a chi-square test?
When testing the association between two categorical variables with independent observations, using counts, and with large enough expected counts in the cells.
What if expected counts are below 5?
For a 2 × 2 table use Fisher’s exact test. For larger tables, consider merging categories that are close in meaning, or use an exact or Monte Carlo method if available.
How do I interpret a significant chi-square result?
It tells you there is an association somewhere in the table. Use adjusted standardised residuals to find which cells differ from expectation, and report an effect size such as Cramér’s V.
What counts as a strong Cramér’s V?
Benchmarks depend on degrees of freedom and field. Interpret it alongside concrete differences in proportions rather than relying on a strong or weak label.
Can I use chi-square for before-and-after data on the same people?
No, because the observations are not independent. For a yes/no outcome measured twice on the same people, use McNemar’s test.