Chi-Square Goodness of Fit Calculator

The chi-square goodness-of-fit test checks whether the counts in the categories of one variable match an expected pattern. For example: is a die fair, do customers choose equally among five products, or do blood types follow known population proportions? Enter the observed counts and either assume equal frequencies or supply expected proportions or counts.

Three ways to specify what you expect

  • Equal in every category: the null hypothesis is that all categories are equally likely, as with a fair die.
  • Proportions or percentages: enter the expected share of each category, such as 45, 40, 11 and 4 for blood types O, A, B and AB. They don’t need to add up to exactly 1 or 100. They are rescaled for you.
  • Expected counts: enter the counts you expected. They are rescaled to match your total if necessary.

Formula

χ² = Σ (Oᵢ − Eᵢ)² ÷ Eᵢ, df = k − 1, Cohen’s w = √(χ² ÷ N)

Worked example

A die rolled 120 times shows 22, 17, 21, 20, 25 and 15 for faces 1 to 6. Each face is expected 20 times. The contributions add up to χ²(5) = 3.2, p = .669, so there is no evidence the die is unfair. The table of contributions shows that faces 5 and 6 depart most from 20, but not by more than chance would explain.

Frequently asked questions

What if some expected counts are below 5?

The chi-square approximation becomes unreliable. Combine adjacent or similar categories so that each expected count is at least 5, or use an exact multinomial test.

What is the difference from the test of independence?

Goodness of fit compares one categorical variable with a fixed expected distribution. The test of independence compares two categorical variables with each other.