Chi-Square Goodness-of-Fit
VerifiedCategorical
Run this test straight away on a free built-in teaching dataset — no data of your own needed — or bring your own. Either opens the guided workspace: variable setup, assumption diagnostics, results with effect sizes and confidence intervals, figures, and APA-ready reporting.
Loading teaching datasets…
Or use your own dataset
Loading your datasets…
Tests whether the observed frequency distribution of a single categorical variable matches a hypothesised expected distribution (uniform / equiprobable by default, or a benchmark from prior literature
, or a theoretical distribution). Compares observed cell counts O_i to expected cell counts E_i = n × p_i via χ² = Σ (O_i − E_i)² / E_i with df = k − 1. Reports the χ² statistic, p, Cohen's w effect size, and per-cell standardised residuals to localise discrepancy. Auto-falls-back to exact multinomial / Monte-Carlo p when Cochran's expected-count rule is violated.
Worked example
Are the four car colours bought in the expected equal proportions?
The colours of 200 cars sold were compared against an expected 25/25/25/25 split with a chi-square goodness-of-fit test.
The observed split departed from equal, χ²(3, N = 200) = 10.1, p = .018 — white was over-represented.
A chi-square goodness-of-fit test showed the colour distribution differed from equal proportions, χ²(3, N = 200) = 10.1, p = .018.
Try it yourself: Load this ready-made sample and follow the run above.
When to use it
- One-sample categorical frequencies vs hypothesised distribution100 colour-blind subjects classified into 5 colour-vision categories; researcher tests whether the distribution matches the population benchmark distribution.
- Fairness / equiprobability test (default uniform)Roll a die 600 times; observed counts (105, 90, 110, 95, 100, 100).
When NOT to — use instead
- Two categorical variables (cross-tab)GoF is for ONE categorical variable. → Chi-Square Test of Independence
- Continuous DVGoF is for categorical data. → Linear Regression \u2014 OLS (continuous y + predictors)
- Sparse cells violating Cochran's ruleAsymptotic χ² breaks down. → Fisher's Exact Test
- Single binary outcome with hypothesised proportionFor a 2-category GoF the exact binomial test is more appropriate and exact. → Binomial Test (one-proportion exact)
Hypotheses
Parameter tested: population proportions {pᵢ} across the k categories
Assumptions (and what to do if they fail)
Check: Inspect the expected-count column; all values ≥ 5 → assumption met.
If violated: With small expected counts the χ² statistic no longer follows a χ² distribution; the asymptotic p-value is unreliable.
Check: n ≥ 30 × k → adequate power for detecting medium effects.
If violated: Under-powered tests produce wide CIs on Cohen's w and poor detection of true departures.
Check: Document the source of each expected proportion.
If violated: A poorly chosen null makes the test uninformative even at significance.
Ready to run a Chi-Square Goodness-of-Fit on your own data?
Guided setup, automatic assumption checks, effect sizes, figures and an APA write-up.
Run this test →