Calculators
Home › Calculators › Goodness of Fit Test

Chi-Square Goodness of Fit Calculator

Counts in, fit verdict out: with the contributions that explain it.

Run a goodness-of-fit test

Equal expectations, your proportions, or your expected counts.

Quick answer: χ² = Σ(O−E)²/E on categories−1 df. The die example: χ²(5) = 13.0, p = 0.0234: one swollen face (20 rolls) contributes 10 of the 13.

Does the data fit the claimed distribution?

The goodness-of-fit test compares counts you observed against counts a hypothesis predicts: a fair die (equal sixths), last year's sales mix, Mendel's 9:3:3:1. Each category contributes (O − E)²/E to the statistic: big misses on small expected counts hurt most, because relative to what was promised, they are the loudest disagreements.

Goodness-of-fit statisticχ² = Σ (O − E)² ÷ E,   df = categories − 1
Worked example

Sixty rolls of a die: 20, 8, 10, 6, 9, 7 against 10 expected per face. The 20 alone contributes (20−10)²/10 = 10 of the total χ² = 13.0 (df 5, p = 0.0234). At 0.05 the verdict is: this die's rolls do not fit "fair". Read the contributions table before the p-value. One swollen category is a different story from a general misfit, and the statistic keeps them separate for you.

The expected-count rule

The chi-square approximation needs expected counts of roughly 5 or more per category. Starved categories should be merged with neighbours (fewer, fatter categories), or, for very small samples, an exact multinomial calculation used instead.

Watch out

Feeding percentages or proportions into a chi-square test. The statistic is built from counts; 60 rolls and 600 rolls with identical proportions are very different evidence, and only the counts know it.

Frequently asked questions

Why do small expected counts break the test?

The chi-square curve approximates the statistic's distribution, and the approximation is poor when a category's expected count is tiny: a single observation swings its contribution wildly.

Can I test against last year's proportions?

Yes. Choose the proportions mode and enter last year's shares. The calculator converts them to expected counts from your total.