Unit 5 · Categories and non-parametrics
How to run a chi-square test in SPSS
Run a chi-square test of independence with Crosstabs in SPSS, check expected counts and report Cramér's V.
Quick answer: How do you run a chi-square test in SPSS?
- Click Analyze › Descriptive Statistics › Crosstabs.
- Put one categorical variable in Row(s) and the other in Column(s).
- Under Statistics… tick Chi-square and Phi and Cramer’s V; under Cells… tick Expected and Row percentages.
- Click OK and read the Pearson Chi-Square row.
Report it in APA style: Course and preference were related, χ²(2, N = 150) = 8.79, p = .012, V = .24.
What is a chi-square test of independence?
The chi-square (χ²) test of independence checks whether two categorical variables are related, for example whether course and preferred teaching format are linked. It compares the counts you observed in each cell of a crosstab with the counts you’d expect if the variables were unrelated.
When to use it
- Two categorical variables, each with two or more categories.
- Each person counted once, in one cell only.
- Expected counts are large enough; otherwise use Fisher’s exact test.
How it works
For each cell, the expected count is (row total × column total) ÷ grand total. χ² adds up (observed − expected)² ÷ expected across all cells, so big gaps between observed and expected produce a large χ². Degrees of freedom are (rows − 1) × (columns − 1). Cramér’s V (or phi for a 2 × 2 table) gives the effect size from 0 to 1.
Assumptions
- Independent observations: each person appears in only one cell.
- No more than 20% of cells with expected counts below 5, and none below 1.
- Data are counts (frequencies), not percentages or means.
Worked example
Course and teaching preference were related, χ²(2, N = 150) = 8.79, p = .012, V = .24. Only 28% of nursing students preferred online teaching, compared with 56% of psychology students.
Key terms
- Contingency table
- A crosstab of two categorical variables.
- Expected count
- The cell count if the variables were unrelated.
- Cramér’s V
- Effect size for chi-square.
- Standardised residual
- How far a cell is from expected; beyond ±1.96 stands out.
Common mistakes
- Running chi-square on percentages or means.
- Ignoring the expected-count footnote.
- Counting the same people more than once (use McNemar for repeated measures).
How to do it in SPSS
The SPSS syntax
Prefer typing to clicking? Open File › New › Syntax, paste this in, select it and choose Run › Selection. Every dialog's Paste button writes the same kind of code.
CROSSTABS
/TABLES=course BY preference
/STATISTICS=CHISQ PHI
/CELLS=COUNT EXPECTED ROW SRESID.Practice data
Download the file used in this lesson and run it yourself in SPSS: you should get the same results as the screens above.
- course_preference.savCourse and preferred teaching format (N = 150)
Now practise it interactively →
Reading is only half of it. Tap through the real SPSS menus, read the output and pick the right write-up in 7 quick questions, with instant feedback on every answer.
Practice for this lesson is part of Pro, with every unit, unlimited hearts and saved progress.