Statistics

Chi-Square Goodness-of-Fit Test

Enter your observed counts and the expected counts under the null distribution. The test statistic χ² = Σ (O − E)²/E is compared against the chi-square distribution with df = k − 1, giving the p-value and the reject / fail-to-reject conclusion at your chosen α.

Chi-Square Goodness-of-Fit Test

Compare observed and expected frequencies — χ², df, p-value.

Try:
Answerχ² = 7.5, df = 4, p = 0.111709, fail to reject H₀
  1. Observed15, 15, 20, 30, 20
  2. Expected20, 20, 20, 20, 20
  3. Per-cell terms(15−20)²/20 = 1.25; (15−20)²/20 = 1.25; (20−20)²/20 = 0; (30−20)²/20 = 5; (20−20)²/20 = 0
  4. Test statisticχ² = Σ (O − E)²/E = 7.5
  5. Degrees of freedomdf = k − 1 = 4
  6. p-valueP(χ² > 7.5 | df = 4) = 0.111709
  7. Critical valueχ²_crit at α = 0.05, df = 4: 9.48773
  8. Conclusionχ² ≤ χ²_crit (p ≥ α) — fail to reject H₀; the data are consistent with the expected distribution.

Frequently asked questions

What does the null hypothesis say?

That the observed counts are consistent with the expected distribution — i.e. the proposed model fits the data.

How small can the expected counts be?

A common rule of thumb is that every expected count should be at least 5; otherwise the chi-square approximation degrades and an exact test is preferred.

How are degrees of freedom set?

For a basic goodness-of-fit test, df = k − 1, where k is the number of categories. If you estimate parameters from the data, subtract one further degree of freedom per estimated parameter.