The chi-square test of independence checks whether two categorical variables are related. In SPSS you run it through the Crosstabs procedure. Use it when both variables are categories, such as treatment group and whether a patient recovered.
When to use a chi-square test of independence
Use it when:
- Both variables are categorical (nominal or ordinal), for example gender and voting choice.
- You have counts of people or cases, not means or percentages typed in as scores.
- Each case appears in only one cell of the table.
If your outcome is continuous, you need a t test or ANOVA instead. Our which statistical test guide helps you decide. If the same people are classified twice (for example before and after), use McNemar's test rather than chi-square.
Assumptions and requirements
Independence
Each participant contributes to one cell only. Repeated measurements from the same people break this assumption.
Expected counts
The chi-square approximation needs large enough expected counts. A common rule, based on Cochran (1954), is:
- No expected count below 1, and
- No more than 20% of cells with an expected count below 5.
The expected count for a cell is (row total × column total) / N. SPSS reports how many cells fall below 5 in a footnote under the Chi-Square Tests table.
What to do if the expected count rule fails
- For a 2×2 table, report Fisher's exact test. SPSS gives it automatically for 2×2 tables.
- For larger tables, you can combine categories where this makes theoretical sense. If your licence includes the Exact Tests module, you can also request an exact p value through the Exact button.
How to run a chi-square test in SPSS
- Go to Analyze > Descriptive Statistics > Crosstabs.
- Move one variable into Row(s) and the other into Column(s). Put the independent variable (for example group) in the rows if you plan to use row percentages.
- Click Statistics. Tick Chi-square, and under Nominal tick Phi and Cramer's V. Click Continue.
- Click Cells. Under Counts, tick Observed and Expected. Under Percentages, tick Row (or Column, depending on your question). Optionally, under Residuals, tick Adjusted standardized. Click Continue.
- Click OK.
If your data are already summarised as counts (one row per cell with a frequency column), first use Data > Weight Cases and weight by the frequency variable.
How to read the output
SPSS produces three main tables.
| Table | What to look for |
|---|---|
| Crosstabulation | Observed counts, expected counts and row or column percentages |
| Chi-Square Tests | Pearson Chi-Square value, df and Asymptotic Significance (2-sided); the footnote on expected counts; Fisher's Exact Test for 2×2 tables |
| Symmetric Measures | Phi and Cramér's V with their approximate significance |
Which row of the Chi-Square Tests table?
- Pearson Chi-Square is the row you normally report.
- Continuity Correction (Yates) appears for 2×2 tables only. It is conservative, and many researchers do not report it.
- Likelihood Ratio is an alternative test that usually agrees with Pearson.
- Fisher's Exact Test is the one to report when the expected count rule fails in a 2×2 table.
- Linear-by-Linear Association is only meaningful when both variables are ordinal.
Degrees of freedom
df = (rows − 1) × (columns − 1). A 2×2 table has df = 1. A 3×4 table has df = 6.
Effect size: phi and Cramér's V
A significant chi-square tells you the variables are related, not how strongly. Report an effect size as well.
- Phi is used for 2×2 tables. Phi = √(χ² / N).
- Cramér's V works for any table size. For a 2×2 table it equals the absolute value of phi.
For df = 1, Cohen (1988) suggested .10, .30 and .50 as small, medium and large. For larger tables, those benchmarks shrink, so describe strength with care. See our effect size guide for details.
Worked example
Example (invented data). A researcher asks whether students who attended a study-skills workshop were more likely to pass a module. There are 120 students, 60 in each group.
| Group | Passed | Failed | Total |
|---|---|---|---|
| Workshop | 45 (75.0%) | 15 (25.0%) | 60 |
| No workshop | 30 (50.0%) | 30 (50.0%) | 60 |
| Total | 75 | 45 | 120 |
Expected counts
- Passed: (60 × 75) / 120 = 37.5 in each group
- Failed: (60 × 45) / 120 = 22.5 in each group
All expected counts are well above 5. The SPSS footnote would read: "0 cells (0.0%) have expected count less than 5. The minimum expected count is 22.50."
Chi-square value
Each cell differs from its expected count by 7.5.
- Passed cells: 7.5² / 37.5 = 1.50, twice = 3.00
- Failed cells: 7.5² / 22.5 = 2.50, twice = 5.00
- χ² = 3.00 + 5.00 = 8.00, df = 1, p = .005
The full SPSS table
| Test | Value | df | p (2-sided) |
|---|---|---|---|
| Pearson Chi-Square | 8.000 | 1 | .005 |
| Continuity Correction | 6.969 | 1 | .008 |
| Likelihood Ratio | 8.117 | 1 | .004 |
| Fisher's Exact Test | .008 | ||
| Linear-by-Linear Association | 7.933 | 1 | .005 |
Phi = √(8.00 / 120) = .26, so Cramér's V = .26. This is a small-to-medium association. Students who attended the workshop passed at a higher rate (75%) than those who did not (50%).
How to report a chi-square test in APA 7 style
Report χ² with its degrees of freedom and sample size, the exact p value, the effect size and the percentages that show the direction of the effect. Italicise statistical symbols in your final document.
A chi-square test of independence showed a significant association between workshop attendance and passing the module, χ²(1, N = 120) = 8.00, p = .005, φ = .26. Of students who attended the workshop, 75.0% passed, compared with 50.0% of those who did not.
If you used Fisher's exact test, write "Fisher's exact test, p = .008" instead and still give the percentages. Our APA results section guide shows how to present a crosstab as a table.
Common mistakes
- Running chi-square on percentages or means instead of raw counts.
- Ignoring the expected count footnote in the SPSS output.
- Reporting only p, with no percentages and no effect size, so the reader cannot see the direction.
- Using chi-square for paired data. Use McNemar's test instead.
- Explaining a significant result in a larger table without saying which cells drive it. Adjusted standardized residuals beyond about ±1.96 point to the cells that differ most from expectation.
- Reporting "p = .000". Write p < .001.
Getting help with chi-square and Crosstabs
If your tables have many sparse cells, or you are unsure whether to merge categories, our SPSS help service can run and check the analysis and explain each table. You stay in charge of the interpretation and write-up. To confirm that chi-square fits your research questions, start with a free methods check. Our descriptive statistics guide covers how to summarise categorical variables first.
FAQ
When should I use Fisher's exact test instead of chi-square?
Use Fisher's exact test for a 2×2 table when more than 20% of cells have an expected count below 5. SPSS prints it automatically for 2×2 tables in the Chi-Square Tests table. Many researchers also use it for any small 2×2 table, because it does not rely on a large-sample approximation.
Should I report the Pearson chi-square or the continuity correction?
Most researchers report the Pearson chi-square. The continuity correction is often too conservative, which makes it harder to detect real effects. If your department or journal expects the corrected value, follow that convention and say which one you used.
What is the difference between phi and Cramér's V?
Phi is designed for 2×2 tables. Cramér's V extends it to larger tables. For a 2×2 table they have the same absolute value, so either can be reported.
Can I use chi-square with a small sample?
You can if the expected count rule is met. With a small sample, it often is not, so check the footnote in the SPSS output. If it fails in a 2×2 table, report Fisher's exact test.
What is a chi-square goodness-of-fit test?
It compares the counts of one categorical variable with expected proportions, such as checking whether a sample matches known population percentages. In SPSS it is under Analyze > Nonparametric Tests, either through One Sample or Legacy Dialogs > Chi-square. It is a different test from the test of independence described here.
Need help with this analysis?
A statistician can run, check and explain it with you. Fixed quote before we start.