Skip to main content

Chi-square goodness-of-fit test

Chi-square goodness-of-fit test checks whether observed counts across categories match a theoretically expected pattern. The test statistic sums squared relative deviations between observed and expected frequencies for every category.

Also known aschi-square test · goodness of fit

ByHoang TruongUpdated

FrameworkChi-squared test

See it move

Loading infographic...

A side-by-side table compares observed and expected frequencies for a die-roll experiment of 120 rolls. Observed counts for five of the six faces are 18, 23, 19, 24, and 17, whilst the fair-die null hypothesis assigns an expected count of 20 to each face. The resulting chi-square statistic of 2.0 (degrees of freedom = 5) lies well below the critical value of 11.07, so the fair-die claim is not rejected.

Where it fits
SubjectData Analysis & StatisticsAdvancedTopicCommon Significance TestsAdvanced

The formula

LaTeX
χ2=i=1k(OiEi)2Ei\chi^2 = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i}

Variables

chi-square test statistic
observed frequency in category i (count)
expected frequency in category i (count)
number of categories

Degrees of freedom = k − 1. Under H₀ the statistic follows a χ²(k − 1) distribution.

Chi-Square Goodness-of-Fit Test — definition