Chi-square goodness-of-fit
Tests whether the counts in the categories of one variable match the counts you expected — equal shares, or shares you specify (for example a known population split).
Menu: Analyze → Nonparametric Tests → Legacy Dialogs → Chi-square…
When should I use it?
- Is each answer option chosen equally often?
- Does the sample's ethnic or regional mix match the census proportions?
What are the assumptions?
- Independent observations, each case counted once.
- Expected count of at least 5 in most cells (the table footnote reports how many fall below 5).
How do I run it in StatLab?
- Move the categorical variable(s) to the test list.
- Keep 'All categories equal' or choose 'Values' and type the expected shares in ascending code order (e.g. 50 30 20).
How do I read the output?
| Output | Meaning |
|---|---|
| Observed N | Count in each category. |
| Expected N | Count expected under the null hypothesis. |
| Residual | Observed minus expected; large residuals show where the mismatch is. |
| Chi-Square, df, Asymp. Sig. | The test statistic, categories minus 1, and the p-value. |
Worked example
On the practice survey dataset (File → Sample dataset), this command — which the dialog's Paste button also produces — runs the procedure:
PROC npChiSquare /vars=(score age) /exp=equal.
Output tables: Wellbeing score · Age (years) · Test Statistics.
How would I report it in APA style?
A chi-square goodness-of-fit test compared the observed with the expected frequencies. Wellbeing score: χ²(148, N = 150) = 0.99, p = 1.000; Age (years): χ²(45, N = 150) = 31.55, p = .936.
Computed by StatLab's validated procedure code when this page was built. The example only illustrates the steps; choose variables that fit your own research question.
What are common mistakes?
- Typing expected values in a different order from the category codes.
- Using it for two variables — that is the crosstabs chi-square test of independence.