# Chi-square Distribution

A variable from a chi-square distribution with n degrees of freedom is the sum of the squares of n independent standard normal variables (z).

[chi (Greek χ) is pronounced ki as in kind]

A chi-square variable with one degree of freedom is equal to the square of the standard normal variable. A chi-square with many degrees of freedom is approximately equal to the standard normal variable, as the central limit theorem dictates.

The so called "linear constraint" property of chi-square explains its application in many statistical methods: Suppose we consider one sub-set of all possible outcomes of n random variables (z). The sub-set is defined by a linear constraint:

- where a and k are constants. Here the sum of the squares of z follows a chi-square distribution with n-1 degrees of freedom. If there are m linear constraints then the total degrees of freedom is n-m. The number of linear constraints associated with the design of contingency tables explains the number of degrees of freedom used in contingency table tests (Bland, 2000).

Another important relationship of chi-square is as follows: the sums of squares about the mean for a normal sample of size n will follow the distribution of the sample variance times chi-square with n-1 degrees of freedom. As the expected value of chi-square is n-1 here, the sample variance is estimated as the sums of squares about the mean divided by n-1.

Technical Validation

StatsDirect calculates the probability associated with a chi-square random variable with n degrees of freedom, for this a reliable approach to the incomplete gamma integral is used (Shea, 1988). Chi-square quantiles are calculated for n degrees of freedom and a given probability using the Taylor series expansion of Best and Roberts (1975) when P ≤ 0.999998 and P ≥ 0.000002, otherwise a root finding algorithm is applied to the incomplete gamma integral.

Stat Direct agrees fully with all of the double precision reference values quoted by Shea (1988).

Function Definition

The distribution function F(x) of a chi-square random variable x with n degrees of freedom is:

Γ(*) is the gamma function: