Unit 5 · Categories and non-parametrics
How to run a chi-square goodness of fit test in SPSS
Run a chi-square goodness of fit test in SPSS with equal or custom expected values, read the residuals and report it in APA style.
Quick answer: How do you run a chi-square goodness of fit test in SPSS?
- Click Analyze › Nonparametric Tests › Legacy Dialogs › Chi-square.
- Move the categorical variable into Test Variable List.
- Keep All categories equal, or enter your own Expected Values, then click OK.
Report it in APA style: Study-time preferences were not evenly split, χ²(2, N = 90) = 12.60, p = .002.
What is a chi-square goodness-of-fit test?
The goodness-of-fit test compares the counts in one categorical variable with the proportions you’d expect, such as equal numbers in each category or known population figures.
When to use it
- One categorical variable.
- You have expected proportions: equal, or from theory or a population.
- Example: are students equally likely to prefer morning, afternoon or evening study?
How it works
For each category, expected count = N × expected proportion. χ² sums (observed − expected)² ÷ expected. Degrees of freedom are the number of categories minus 1. Residuals (observed − expected) show which categories are over- or under-represented.
Assumptions
- Independent observations.
- Expected counts of at least 5 in each category (or at least 80% of them).
Worked example
Of 90 students, 18 preferred morning, 27 afternoon and 45 evening, against 30 expected in each. Preferences weren’t equal, χ²(2, N = 90) = 12.60, p = .002, with evening over-represented.
Key terms
- Observed count
- How many cases actually fall in a category.
- Expected count
- How many would fall there if the expected proportions were true.
Common mistakes
- Confusing it with the test of independence, which needs two variables.
- Entering expected values in the wrong category order.
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.
* Equal expected proportions.
NPAR TESTS /CHISQUARE=study_time /EXPECTED=EQUAL.
* Your own expected proportions, in category order (here 50%, 30%, 20%).
NPAR TESTS /CHISQUARE=study_time /EXPECTED=50 30 20.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.
- study_time.savPreferred study time (N = 90)
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 6 quick questions, with instant feedback on every answer.
Practice for this lesson is part of Pro, with every unit, unlimited hearts and saved progress.