HuntsvilleEngineers mark

χ² Goodness-of-Fit

Compare observed counts against expected counts and get the χ² statistic, degrees of freedom, and p-value.

Inputχ² = Σ (Oᵢ − Eᵢ)² / Eᵢ , df = k − 1 − m , p = Q(df/2, χ²/2)

Your recent runs (stored only in your browser)

No calculations yet — results land here so you can compare runs.

The engineering

Pearson's χ² goodness-of-fit test asks whether a set of observed category counts is consistent with counts predicted by some hypothesized distribution. Each cell contributes its squared deviation scaled by the expected count; large total χ² means the model and data disagree. Reach for it when checking whether a die is fair, whether defects follow a Poisson model, or whether measured failures match a reliability distribution.

Degrees of freedom = categories − 1 − (parameters estimated from the same data). If you fit a Poisson rate or a normal μ,σ before binning, subtract those. The classic gotcha: the approximation degrades when any expected count drops below about 5 — pool sparse bins first. A small χ² is not proof of a good fit, only a failure to reject.

Where this math comes from

Karl Pearson introduced the χ² test in a 1900 paper in the Philosophical Magazine, working from the roulette records at Monte Carlo and biological data at his Biometric Laboratory in London. He wanted a rigorous way to say how surprised one should be by a discrepancy between theory and tallied counts, and he showed the sum of squared standardized deviations followed the χ² distribution.

Pearson originally used df = k − 1, but Ronald Fisher showed in 1922–1924 that estimating parameters from the data costs additional degrees of freedom — the correction that still trips up analysts today. The test became a staple of QA and reliability practice, codified in references like the NIST/SEMATECH e-Handbook of Statistical Methods.

  1. 1900Karl PearsonPublishes the χ² goodness-of-fit test in the Philosophical Magazine.
  2. 1922Ronald A. FisherCorrects the degrees-of-freedom rule for estimated parameters.
  3. 1973Cochran / textbook consensusThe 'expected count ≥ 5' rule of thumb becomes standard guidance.
  4. 2003NIST/SEMATECHe-Handbook of Statistical Methods pins the working procedure used here.

See the full timeline of the math behind every calculator →

Runs entirely in your browser — nothing you enter leaves this page. Your recent runs are stored only on your device.