Chi-Square Goodness-of-Fit

Verified

Categorical

Independently verified. Every statistic this test reports has been re-derived against an independent reference — never the library the pipeline itself calls — the rendered output was read back in a browser, and the result is locked with a committed regression suite.

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.

Result

The observed split departed from equal, χ²(3, N = 200) = 10.1, p = .018 — white was over-represented.

How you'd report it (APA)

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 distribution
    100 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

Hypotheses

H₀: the population proportions equal the expected proportions (typically uniform 1/k unless otherwise specified).
Hₐ: at least one category's population proportion differs from expected.

Parameter tested: population proportions {pᵢ} across the k categories

Assumptions (and what to do if they fail)

All expected frequencies are ≥ 5high

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.

Total sample size n is adequate (typical rule: n ≥ 30 × k, or at minimum the Cochran rule)low

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.

The expected proportions represent a theoretically or empirically motivated nullhigh

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 →