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.

Free tutorialPro practiceAbout 5 minutes6 practice questions

Quick answer: How do you run a chi-square goodness of fit test in SPSS?

  1. Click Analyze › Nonparametric Tests › Legacy Dialogs › Chi-square.
  2. Move the categorical variable into Test Variable List.
  3. 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.

Last updated November 2026 · Not sure this is the right test? Try the Which statistical test? tool.

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

Chi-square goodness of fit

Tests whether the counts in one categorical variable match what you’d expect, such as whether students prefer morning, afternoon and evening study equally.

Chi-square Test
Variables
Participant ID [id]
Course [course]
▶
Test Variable List:1
Preferred study time [study_time]
Expected Values2
✓All categories equal
Values:
Exact…Options…
OKPasteResetCancelHelp
  1. 1
    Test Variable ListOne categorical variable. Found under Analyze › Nonparametric Tests › Legacy Dialogs › Chi-square.
  2. 2
    Expected ValuesAll categories equal tests a 1/3, 1/3, 1/3 split. Choose Values to enter your own, such as national figures, in category order.

Reading goodness-of-fit output

Compare observed and expected counts, then read the test.

Output1 [Document1] – SPSS Statistics Viewer
FileEditViewDataTransformAnalyzeGraphsUtilitiesExtensionsWindowHelp
Output
Log
NPar Tests
Chi-Square Test
Frequencies
Test Statistics
study_time
Observed NExpected NResidual
Morning1830.0−12.0
Afternoon2730.0−3.0
Evening4530.015.01
Total90
Test Statistics
study_time
Chi-Square12.600a2
df2
Asymp. Sig..0023

a. 0 cells (0.0%) have expected frequencies less than 5. The minimum expected cell frequency is 30.0.

  1. 1
    ResidualObserved minus expected. Evening has 15 more students than an equal split predicts.
  2. 2
    Chi-Squareχ² = 12.60 with df = categories − 1 = 2.
  3. 3
    Asymp. Sig..002 is below .05, so preferences aren’t equally split.

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.

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.

More in Categories and non-parametrics