Chi-Square Goodness of Fit Calculator

The chi-square goodness-of-fit test asks whether counts in categories are consistent with a set of expected proportions, such as a fair die, a genetic ratio or a planned market share.

Also called: Chi-square test for given proportions · Pearson chi-square test

  • Last updated
  • Formula tested against reference values

Your numbers

One count per category, separated by commas, spaces or new lines.

In the same order. Ratios or percentages are scaled to the observed total. Leave blank for equal proportions.

Usually 0. Enter 1 if, for example, you estimated a Poisson mean from these same counts.

Result

χ² statistic
—

Calculating…

Degrees of freedom
—
p-value (right-tailed)
—
p-value, full precision
—
Critical value at α
—
Decision
—
Smallest expected count
—
Full table

How to use this calculator

  1. Enter or choose observed counts.
  2. Enter or choose expected counts or ratios (optional).
  3. Enter or choose parameters estimated from the data.
  4. Enter or choose significance level (α).
  5. The χ² statistic updates as you type. Use Copy result or Share to keep it.

Method

χ² = Σ (O − E)² ÷ E; df = categories − 1 − estimated parameters; p = P(χ²_df ≥ observed χ²)

O
observed count in a category
E
expected count = total × expected proportion
df
degrees of freedom

Worked example

  1. Total = 556. Expected for 9:3:3:1 = 312.75, 104.25, 104.25, 34.75.
  2. χ² = 2.25²/312.75 + 3.75²/104.25 + 3.25²/104.25 + 2.75²/34.75 = 0.016 + 0.135 + 0.101 + 0.218 = 0.470.
  3. With 3 degrees of freedom, P(χ² ≥ 0.470) = 0.925, far above 0.05; the 5% critical value is 7.815.

Mendel’s pea counts fit the 9:3:3:1 ratio very well: χ² = 0.47 with 3 df, p = 0.93.

What the result means

A small p-value means the counts are unlikely under the expected proportions. A large p-value does not prove the proportions are right, only that the data cannot rule them out. The table shows which categories contribute most to the statistic.

Assumptions and limits

  • Observations are independent and each falls into exactly one category.
  • Expected counts are at least 5 in every category (a common rule for the chi-square approximation).
  • The test is right-tailed: only large χ² values count against the null hypothesis.
  • Enter raw counts, not percentages or averages; the statistic depends on the actual sample size.
  • For small expected counts use an exact multinomial test or merge categories.

Questions

How many degrees of freedom?

Categories minus one, minus one more for each parameter you estimated from the same data to build the expected counts.

Is this the same as the chi-square test of independence?

No. Independence uses a two-way table and df = (rows − 1)(columns − 1). This test compares one set of counts with fixed proportions.