Statistics & Probability
Chi-Square Categorical Goodness-of-Fit Calculator
Compare observed category counts with a supplied probability distribution using Pearson’s chi-square statistic.
How the calculation works
Expected count i = total × supplied probability i. Pearson statistic = Σ(observed − expected)²/expected. The upper-tail probability uses a chi-square distribution with k − 1 − estimated-parameter degrees of freedom.
Worked example
Example inputs — Observed nonnegative whole counts: 20, 30, 50; Expected category probabilities, summing to 1: 0.2, 0.3, 0.5; Number of model parameters estimated from these counts: 0. Expected results — Total observations: 100; Pearson chi-square statistic: 0; Degrees of freedom: 2; Upper-tail chi-square probability: 1; Smallest expected count: 20; Expected-count diagnostic: All expected counts are at least 5.
Assumptions and limits
Counts must be independent, mutually exclusive category observations; supplied positive probabilities must sum to one. Degrees of freedom = categories − 1 − number of estimated parameters, and the parameter adjustment is appropriate only for suitable estimation from the binned counts. The chi-square reference distribution is an approximation; small expected counts and complex survey/design dependence can invalidate it. The five-count diagnostic is a heuristic, not a guarantee. Does not automatically merge categories or fit distributions.
Reference and further reading
Read the underlying subject reference. Calculith is an independent implementation; the reference does not endorse or certify this tool.
Related calculators
- Sample & Population Variance Calculator
- Quartiles, IQR & Tukey Fences Calculator
- Adjusted Skewness & Excess Kurtosis Calculator
- Z-Score & Normal Percentile Calculator
- Normal Interval Probability & Quantile Calculator
Example values are editable. Results are estimates where assumptions apply. Calculations run in your browser. Updated 2026-11-16.