Categorical goodness-of-fit

Chi-Square Goodness-of-Fit Calculator

Test whether observed counts differ from expected category counts under a specified null model. Research Mode reports the chi-square statistic, degrees of freedom and a p-value for the goodness-of-fit workflow.

Open Chi-Square Calculator

What you can do

  • Input observed frequency counts by category.
  • Provide positive expected counts for the same categories.
  • Account for parameters estimated from data when determining degrees of freedom.
  • Read the statistic and p-value together with the null hypothesis.

Formula and interpretation

The Pearson goodness-of-fit statistic is χ² = Σ(Oᵢ−Eᵢ)²/Eᵢ, summing across categories. With k categories and p model parameters estimated from the observed counts, the usual degrees of freedom are k − 1 − p. The chi-square approximation depends on sufficiently large expected counts and a suitable sampling model.

Worked goodness-of-fit example

Let observed counts be [20,30,50] and expected counts be [25,25,50]. The statistic is (20−25)²/25 + (30−25)²/25 + (50−50)²/50 = 1 + 1 + 0 = 2. With three categories and no fitted parameters, df = 2; the upper-tail p-value is about 0.368.

How to use the workspace

  1. Open Research Mode and find Chi-square Goodness of Fit.
  2. Enter 20,30,50 and 25,25,50 in matching category order.
  3. Enter how many parameters were estimated using the same data, if any.
  4. Interpret the p-value against a previously chosen α without treating it as the probability that the null is true.

Assumptions and common errors

  • Counts, not percentages: use observed and expected frequencies on the same total.
  • Expected counts: small expected cells can make the approximation unreliable.
  • Test type: this workflow is goodness-of-fit, not a general contingency-table independence test.

Frequently asked questions

What does a large chi-square statistic mean?
It indicates a larger discrepancy between observed and expected counts relative to expected frequencies.
Can expected counts be zero?
No. A zero expected count makes the denominator undefined for that category.
Is a non-significant result proof that the model is correct?
No. It means the test did not find sufficient evidence of a discrepancy at the chosen threshold.

Related calculators and guides