Chi-Square Goodness of Fit Calculator
Test whether observed category counts match an expected distribution. Enter one count per category, comma or newline-separated. Expected counts will be automatically scaled to match the observed total.
Frequently asked questions
What does the chi-square goodness of fit test actually test?
It tests whether a set of observed category counts is consistent with a hypothesized distribution. The null hypothesis is that the data follow the expected distribution; the alternative is that at least one category differs. It does not tell you which category drives the departure. To find that, inspect the individual (O − E)²/E contributions or use post-hoc comparisons.
Why must expected counts be at least 5?
The chi-square approximation relies on the sampling distribution of the test statistic being approximately chi-square distributed. With very small expected counts in any cell, this approximation breaks down and the p-value becomes unreliable. A common rule of thumb is that all expected counts should be at least 5. If this is violated, consider combining categories or using Fisher's exact test.
What are the degrees of freedom?
For a goodness of fit test, df = k − 1 where k is the number of categories. One degree of freedom is lost because the expected values are scaled to match the observed total. If you estimated additional parameters from the data (for example, fitting a Poisson rate or a normal mean), subtract one additional df per estimated parameter.
Can I use proportions instead of raw counts in the expected field?
Yes. The calculator rescales expected values to match the observed total, so entering equal proportions like 0.2, 0.2, 0.2, 0.2, 0.2 for a uniform hypothesis is equivalent to entering equal counts. The important thing is that the ratios between expected values reflect your hypothesis, not the absolute values.
How is this different from a chi-square test of independence?
The goodness of fit test works with a single categorical variable compared against a theoretical distribution. The test of independence (or association) works with a two-way contingency table to assess whether two categorical variables are related. Both use the same chi-square statistic but different degrees of freedom and data structures.
