Chi-Square Calculator
Perform a chi-square goodness-of-fit test.
Enter observed and expected frequencies to calculate the chi-square statistic and p-value.
The chi-square goodness-of-fit test determines whether observed data matches an expected distribution. This calculator computes the chi-square statistic, degrees of freedom, and p-value for your data.
Formula:
χ² = Σ (Observed - Expected)² / Expected
Step-by-step method:
- For each category, subtract the expected count from the observed count.
- Square the difference.
- Divide by the expected count.
- Sum all the values to get the chi-square statistic (χ²).
What each variable means:
- Observed Values: the actual counts you measured or collected from your data.
- Expected Values: the counts you would expect if the null hypothesis is true. If left blank, the calculator assumes all categories should be equal (total / number of categories).
- Degrees of Freedom: equals the number of categories minus 1.
When to use this test: Use it when working with categorical data (counts or frequencies) and you want to test whether the observed distribution differs from what you expected. Common applications include testing whether a die is fair, whether customer preferences match predictions, or whether survey responses differ from expected proportions.
Practical example: You roll a die 60 times and get these results: 12, 8, 15, 10, 7, 8. Expected for a fair die: 10 each. χ² = (12-10)²/10 + (8-10)²/10 + (15-10)²/10 + (10-10)²/10 + (7-10)²/10 + (8-10)²/10 = 0.4 + 0.4 + 2.5 + 0 + 0.9 + 0.4 = 4.6. With df = 5, the p-value is 0.467. Since 0.467 > 0.05, we fail to reject the null hypothesis — the die appears fair.
Interpreting results:
- If p-value < 0.05, reject the null hypothesis: the observed distribution significantly differs from expected.
- If p-value ≥ 0.05, fail to reject the null: no significant difference detected.
Common mistakes: Each expected count should ideally be 5 or more for the test to be reliable. If you have very small expected counts, consider combining categories. The chi-square test works with counts, not percentages — always enter raw frequency data.