Chi-square goodness-of-fit calculator guide
Pearson’s chi-square goodness-of-fit test compares observed category counts with counts expected under a prespecified distribution. Expected ratios are normalized to the observed total before each squared difference is divided by its expected count.
The p-value uses the upper tail of the chi-square distribution. Because that distribution is an approximation for category counts, review expected frequencies, sampling independence, category definitions, and any parameters estimated from the same data.
How to run a chi-square goodness-of-fit calculation
- Enter observed counts: Enter non-negative whole-number counts in category order.
- Enter expected ratios: Enter positive ratios in the same category order. They do not have to sum to 1 or to the observed total.
- Adjust degrees of freedom: Enter the number of model parameters estimated from these same binned data; use zero for a fully specified expected distribution.
- Review the approximation: Inspect the low-expected-count warning before interpreting the upper-tail p-value.
Formula and variables
Oi is the observed count and Ei is the expected count in category i. k is the number of categories and m is the number of distribution parameters estimated from these same observations.
χ² = Σ[(Oi − Ei)² / Ei], df = k − 1 − m- Oi — Observed frequency
- Whole-number count observed in category i.
- Ei — Expected frequency
- Observed total multiplied by category i’s expected-ratio share.
- k — Categories
- Number of mutually exclusive categories.
- m — Estimated parameters
- Distribution parameters estimated from this data set.
Counts compared with a 3:2:1 distribution
Sixty observations fall into three categories with counts 29, 20, and 11; the null distribution has ratio 3:2:1.
- Observed
- 29, 20, 11
- Expected ratios
- 3, 2, 1
- Estimated parameters
- 0
- Expected counts are 30, 20, and 10.
- χ² = (29−30)²/30 + (20−20)²/20 + (11−10)²/10.
- df = 3 − 1 = 2.
Result: χ² ≈ 0.1333 with 2 degrees of freedom and p ≈ 0.9355.
The observed differences are small relative to the expected counts; the data do not provide evidence against the specified ratio at conventional significance levels.
Understanding your results
Chi-square and p-value
The statistic accumulates squared observed-minus-expected differences after scaling by expected counts. The p-value is the probability, under the null model and approximation, of a chi-square value at least this large.
Cohen’s w
Cohen’s w is sqrt(χ²/N), a sample effect-size summary. Interpret practical importance in the subject-matter context instead of relying only on generic thresholds.
Assumptions
- Observations are independent.
- Categories are mutually exclusive and collectively cover the outcomes being analyzed.
- Observed entries are frequency counts rather than percentages or measurements.
- Expected ratios are specified by the null model, with degrees of freedom reduced for parameters estimated from the same data.
- Expected counts are sufficiently large for the chi-square approximation.
Limitations
- The calculator does not select bins or categories for continuous raw data.
- It does not provide exact multinomial tests or combine sparse categories automatically.
- Changing category boundaries after seeing the data can change the test and invalidate a prespecified interpretation.
- A non-significant result does not prove the null distribution is true.
- The p-value calculation depends on the asymptotic chi-square approximation.
Common mistakes
- Entering percentages as observed counts.
- Using expected values in a different category order.
- Forgetting to subtract parameters estimated from the analyzed data.
- Treating a small p-value as an effect-size measure.
- Combining categories only because the original result was inconvenient.
Practical use cases
Specified proportions
Compare survey, genetics, quality-control, or experimental category counts with a prespecified probability pattern.
Distribution checks
Compare binned observations with expected counts from a fully specified or fitted probability model, with the proper degree-of-freedom adjustment.
Planning and decision guide
Specify categories and ratios first
Define category boundaries, expected probabilities, parameter estimation, and the significance level before inspecting the observed deviations.
Frequently asked questions
Do expected ratios have to add to 1?
No. The calculator normalizes any positive ratios to the observed total.
Why are parameters subtracted from degrees of freedom?
Estimating distribution parameters from the same data uses information and reduces the independent variation available for the test.
What if an expected count is below 5?
The chi-square approximation may be inaccurate. Combine categories only when substantively defensible or use an appropriate exact method.
Is this the chi-square test of independence?
No. This calculator compares one set of category counts with a specified distribution; independence uses a two-way contingency table.
What does a large p-value mean?
It means the observed discrepancies are not unusual under the entered null distribution and approximation. It does not prove the model is correct.
Sources and review
- Chi-Square Goodness-of-Fit Test — NIST/SEMATECH e-Handbook of Statistical Methods. Accessed 2026-08-29.
- Chi-square goodness-of-fit test — NIST/SEMATECH e-Handbook of Statistical Methods. Accessed 2026-08-29.
Reviewed 2026-08-29.