Interactive module guide

Chi Square Goodness of Fit Calculator — Free & Interactive

This chi square goodness of fit calculator compares observed category counts with a pre-specified expected frequency distribution.

Open calculator

Free · No sign-up · Calculations stay in your browser

The chi-square goodness-of-fit test compares one set of observed categorical counts with a fully specified set of expected counts.

It differs from a chi-square independence test, which starts from a two-variable contingency table.

Each category contributes (O−E)²/E to the total, so the contribution table shows where the largest discrepancies occur.

Use the chi square goodness of fit calculator to compare observed counts for one categorical variable with an expected frequency pattern specified before inspecting deviations. Enter actual mutually exclusive counts, align observed and expected categories, confirm equal totals, and inspect expected frequencies plus category contributions before trusting the asymptotic p-value. If parameters were estimated from these same observations, adjust the method and degrees of freedom with specialist software. Document missing categories, structural zeros, regrouping decisions, and the external source of the expected pattern so the result can be independently reproduced. The overall statistic does not identify direction by itself, so retain the observed and expected lists, examine category-level contributions, and apply planned multiplicity control if formal follow-up comparisons are made.

When to use this chi square goodness of fit calculator

Use it when

  • Use it for one categorical variable with mutually exclusive categories and expected proportions or counts specified independently of the observed deviations.
  • Use counts, not percentages or raw measurements, and ensure each observational unit contributes to exactly one category.
  • The procedure is appropriate for a planned multinomial pattern such as equal allocation, a Mendelian ratio, or proportions established by an external baseline. The expected model must determine a count for every analyzed category after multiplying any planned proportions by the observed total sample size.

Choose another method when

  • Do not use it to test association between two categorical variables; use the independence calculator for a contingency table.
  • Avoid the asymptotic result when expected counts are sparse. Consider defensible category combinations or an exact multinomial method.
  • Do not use fitted probabilities from the same observations without reducing degrees of freedom for estimated parameters. This calculator assumes zero fitted parameters. Time series counts, clustered choices, repeated responses, and survey-weighted totals also violate the simple independent multinomial reference and need a design-aware analysis.

Interactive tool

The calculator loads as you approach this section so the guide remains fast on mobile connections.

Example preview

Equal die-face frequencies

Inputs
Observed counts 8, 9, 11, 10, 12, 10 versus six expected counts of 10.
Representative result
χ²=1 with df=5; inspect each face’s contribution before interpreting the p-value.

Illustrative only. Load the interactive tool to enter your own values and review assumptions.

Watch the explanation

1:45 min

The player loads only after you press play. You can also watch on YouTube.

Read the complete transcript

Chi-Square Goodness-of-Fit. A chi-square goodness-of-fit test asks whether one categorical count pattern matches a pre-specified model.

For a fair die, sixty rolls imply ten expected counts for each of six faces. The observed counts are eight, nine, eleven, ten, twelve, and ten. Signed differences show direction, but the test statistic needs nonnegative, scaled discrepancies.

Each category contributes observed minus expected, squared, then divided by its expected count. A two-count miss contributes zero point four when ten outcomes were expected. Here the six contributions are zero point four, zero point one, zero point one, zero, zero point four, and zero. Adding them gives chi-square equals one point zero.

With six fixed categories and no fitted parameters, the reference degrees of freedom equal five. The p-value is the upper-tail area beyond the observed chi-square under the expected model. For chi-square one with five degrees of freedom, that tail area is about zero point nine six three. Because this exceeds alpha point zero five, the data do not show a detectable mismatch.

That conclusion does not prove the die is fair; many alternative patterns could also look compatible in sixty rolls. Check that categories match, totals agree, observations are independent, and every expected count is adequate. If model parameters came from these same data, degrees of freedom must be reduced outside this calculator. Report the full counts, signed differences, contributions, chi-square, degrees of freedom, and p-value.

Try it free at Distri Scope dot com.

How to read the result

A small p-value supports a mismatch with the expected distribution, but the contribution table is needed to describe where the mismatch occurs.

A large p-value means the observed differences are not unusually large under the model; it does not prove the expected distribution is correct.

Contribution values should be paired with signed observed-minus-expected differences because contributions alone show magnitude but not direction. Report the total sample size, all category counts, expected specification, χ², df, p, alpha, and any sparse-count warning so another analyst can reconstruct the calculation.

How to use the chi square goodness of fit calculator

Enter observed counts and expected counts in the same category order. The two lists must have equal length and equal totals.

Observed values must be non-negative whole numbers; expected values must be positive. This page treats expected counts as fixed and does not subtract degrees of freedom for fitted parameters.

Category names are implicit positions: the first observed count is compared with the first expected count, and so on. Preserve a separate category key in your notes. Expected totals must match observed totals within a small numerical tolerance; rescale planned proportions before entry rather than asking the calculator to guess an intention.

Formula, hypotheses, and assumptions

χ2=i(OiEi)2Eiχ² = \sum_i \frac{(O_i-E_i)^2}{E_i}

Conditions to review

  • Observations are independent counts in mutually exclusive categories
  • Expected counts are supplied before inspecting the observed deviations
  • Expected frequency is preferably at least 5 in every category

Calculator parameters

  • Significance Level (α): default 0.05.

What the method is doing

Pearson’s statistic sums squared observed-minus-expected differences scaled by expected count. With k fixed categories and no estimated parameters, df=k−1.

The p-value is the upper-tail probability of a chi-square reference statistic at least as large as observed under the specified distribution.

Squaring removes the sign of each deviation, while division by E puts discrepancies on a scale related to their null variability. A difference of five counts contributes much more when five were expected than when five hundred were expected. Contributions add exactly to the displayed Pearson statistic.

Worked example: checking equal die outcomes

A die is rolled 60 times. Observed face counts are 8, 9, 11, 10, 12, 10 and a fair die implies expected counts of 10 in each category.

  1. 1Enter the six observed counts and six expected counts in matching face order.
  2. 2Confirm totals both equal 60 and df=5.
  3. 3Inspect each contribution before interpreting the total chi-square and p-value.

Interpretation

Failing to reject would mean these deviations are compatible with equal probabilities at the chosen alpha, not that physical fairness has been proved.

Common mistakes

  • Entering expected proportions that sum to one instead of expected counts causes a total mismatch.
  • Reordering only one list compares the wrong categories.
  • Choosing expected ratios after seeing the data invalidates the reference question.

Limits and independent validation

The calculator does not estimate expected-distribution parameters, perform exact multinomial tests, or combine sparse categories automatically.

The approximation warning must be taken seriously when expected frequencies are below five.

No confidence intervals, standardized residuals, multiple-comparison adjustments, exact p-values, or power calculations are provided. The calculator cannot decide whether categories may be combined without changing the scientific question. Post-hoc merging solely to remove a warning can conceal a real departure and invalidates a pre-specified analysis.

Before using the result

  • Confirm categories are independent, exclusive, exhaustive, and ordered identically in both lists.
  • Verify the contribution sum, df, and upper-tail p-value in an independent implementation.
  • Reconstruct expected counts from the documented probabilities and total, then check that they are all positive and sum correctly. Investigate data provenance for the largest signed deviations, but do not delete categories or observations merely to increase the p-value. Record any exclusions before comparing with external software.
  • As a final audit, calculate one contribution by hand and confirm that categories with observed counts above and below expectation both increase χ². This catches order mistakes, percentage inputs, and accidental use of deviations instead of squared scaled deviations.

See every option in the Statistical Hypothesis Test Calculator or review the DistriScope methodology. Educational information; last reviewed 2026-08-09. Verify consequential calculations independently.