info prev up next book cdrom email home

Chi-Squared Test

Let the probabilities of various classes in a distribution be $p_1$, $p_2$, ..., $p_k$. The expected frequency

{\chi_s}^2=\sum_{i=1}^k {(m_i-Np_i)^2\over Np_i}

is a measure of the deviation of a sample from expectation. Karl Pearson proved that the limiting distribution of ${\chi_s}^2$ is $\chi^2$ (Kenney and Keeping 1951, pp. 114-116).
$\displaystyle \mathop{\rm Pr}(\chi^2\geq {\chi_s}^2)$ $\textstyle =$ $\displaystyle \int_{{\chi_s}^2}^\infty f(\chi^2)\,d(\chi^2)$  
  $\textstyle =$ $\displaystyle {1\over 2}\int_{{\chi_s}^2}^\infty {\left({\chi^2\over 2}\right)^{(k-3)/2}\over \Gamma\left({k-1\over 2}\right)}e^{-\chi^2/2}\,d(\chi^2)$  
  $\textstyle =$ $\displaystyle 1-{\Gamma\left({{\textstyle{1\over 2}}{\chi_s}^2, {\textstyle{k-1\over 2}}}\right)\over \Gamma\left({k-1\over 2}\right)}$  
  $\textstyle =$ $\displaystyle 1-I\left({{{\chi_s}^2\over \sqrt{2(k-1)}} , {k-3\over 2}}\right),$  

where $I(x,n)$ is Pearson's Function. There are some subtleties involved in using the $\chi^2$ test to fit curves (Kenney and Keeping 1951, pp. 118-119).

When fitting a one-parameter solution using $\chi^2$, the best-fit parameter value can be found by calculating $\chi^2$ at three points, plotting against the parameter values of these points, then finding the minimum of a Parabola fit through the points (Cuzzi 1972, pp. 162-168).


Cuzzi, J. The Subsurface Nature of Mercury and Mars from Thermal Microwave Emission. Ph.D. Thesis. Pasadena, CA: California Institute of Technology, 1972.

Kenney, J. F. and Keeping, E. S. Mathematics of Statistics, Pt. 2, 2nd ed. Princeton, NJ: Van Nostrand, 1951.

© 1996-9 Eric W. Weisstein