StatLabStudent EditionUser guideGalleryFeaturesAbout

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?

What are the assumptions?

How do I run it in StatLab?

  1. Move the categorical variable(s) to the test list.
  2. 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?

OutputMeaning
Observed NCount in each category.
Expected NCount expected under the null hypothesis.
ResidualObserved 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?

Open StatLab   All guide topics