Goodness of Fit Test

1 min read Last updated Sat Jun 27 2026 08:46:52 GMT+0000 (Coordinated Universal Time)

Used to check whether a set of observed categorical data follows a theoretical distribution such as uniform or Poisson.

Hypotheses

H0H_0: Data follow the specified distribution.

H1H_1: Data do not follow the specified distribution.

Test Statistic

χ2=i=1k(OiEi)2Eiχν2\chi^2 = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i} \quad \sim \chi^2_\nu

Here:

  • OiO_i: observed frequency for class ii
  • EiE_i: expected frequency for class ii under H0H_0
  • kk: number of non-empty classes

Degrees of Freedom

ν=kp1\nu = k - p - 1

Here:

  • pp: number of parameters estimated from the data

Decision Rule

Reject H0H_0 if χ2>χν,α2\chi^2 > \chi^2_{\nu, \alpha} (right-tail test).

Small Expected Frequencies

When any Ei<5E_i < 5, merge adjacent classes until all Ei5E_i \geq 5. Recalculate kk and ν\nu after merging.

Was this helpful?