Chi-Square Goodness of Fit Calculator NZ
This calculator computes the chi-square goodness-of-fit test statistic, which measures how well a set of observed frequencies matches what you expected. The goodness-of-fit test answers a common statistical question: do my observed counts differ from a theoretical or expected distribution by more than chance would explain? You might test whether a die is fair by comparing the counts of each face against an even spread, whether customers are evenly distributed across days, or whether observed outcomes fit a hypothesised proportion. The chi-square statistic captures the total discrepancy by summing, for each category, the squared difference between observed and expected, divided by the expected. A small statistic means the observed data fits the expected distribution well; a large one suggests a real difference. This tool calculates it. You enter your observed frequencies in one box and the expected frequencies in another, in the same order, and the calculator returns the chi-square statistic, the degrees of freedom (the number of categories minus one), the number of categories, and the total observed count. The results update as you type. Use it for statistics homework, for testing whether data fits a distribution, or as the first step of a goodness-of-fit test. To complete the test, you compare the statistic against a critical value from the chi-square distribution at your chosen significance level and the calculated degrees of freedom, or find the p-value; if the statistic exceeds the critical value, the difference is significant. This calculator gives the statistic and degrees of freedom, the parts that depend on your data, leaving the comparison against a chi-square table to you. Each expected frequency should be reasonably large, commonly at least five, for the test to be reliable.
Chi-square = sum of (observed - expected)² / expected. Degrees of freedom = categories - 1. Compare against a chi-square table to judge significance. Expected counts should be ~5 or more.
How it works
For each category, the calculator finds the difference between the observed and expected frequency, squares it, and divides by the expected frequency. Summing these across all categories gives the chi-square statistic. The degrees of freedom equal the number of categories minus one. A larger statistic indicates a greater discrepancy from the expected distribution.
Worked example
For observed counts 18, 22, 20, 18, 22 against an expected 20 in each of five categories, the squared differences are 4, 4, 0, 4 and 4, each divided by 20 giving 0.2, 0.2, 0, 0.2 and 0.2. The chi-square statistic is their sum, 0.8, with 4 degrees of freedom, a small value suggesting the data fits the expected distribution well.
Related calculators
- Chi-Square Calculator: chi-square tests.
- Normal Distribution: distributions.
- CI for a Proportion: proportions.
- Sample Size: plan a study.
- Magnetic Flux Calculator: Flux Through an Area (Phi = BA cos).
- Minecraft Circle Generator: Pixel Circle and Sphere Guide.