TOPICS
Search

Chi-Squared Distribution


If Y_i have normal independent distributions with mean 0 and variance 1, then

 chi^2=sum_(i=1)^rY_i^2
(1)

is distributed as chi^2 with r degrees of freedom. This makes a chi^2 distribution a gamma distribution with theta=2 and alpha=r/2, where r is the number of degrees of freedom.

More generally, if chi_i^2 are independently distributed according to a chi^2 distribution with r_1, r_2, ..., r_k degrees of freedom, then

 sum_(j=1)^kchi_j^2
(2)

is distributed according to chi^2 with r=sum_(j=1)^(k)r_j degrees of freedom.

ChiSquaredChiSquarePlots

The probability density function for the chi^2 distribution with r degrees of freedom is given by

 P_r(x)=(x^(r/2-1)e^(-x/2))/(Gamma(1/2r)2^(r/2))
(3)

for x in [0,infty), where Gamma(x) is a gamma function. The cumulative distribution function is then

D_r(chi^2)=int_0^(chi^2)(t^(r/2-1)e^(-t/2)dt)/(Gamma(1/2r)2^(r/2))
(4)
=1-(Gamma(1/2r,1/2chi^2))/(Gamma(1/2r))
(5)
=(gamma(1/2r,1/2chi^2))/(Gamma(1/2r))
(6)
=P(1/2r,1/2chi^2),
(7)

where gamma(a,x) is an incomplete gamma function and P(a,z) is a regularized gamma function.

The chi-squared distribution is implemented in the Wolfram Language as ChiSquareDistribution[n].

For r<=2, P_r(x) is monotonic decreasing, but for r>=3, it has a maximum at

 x=r-2,
(8)

where

 (dP_r)/(dx)=((r-x-2)x^((r-4)/2))/(2^(1+r/2)e^(x/2)Gamma(1/2r))=0.
(9)

The nth raw moment for a distribution with r degrees of freedom is

mu_n^'=2^n(Gamma(n+1/2r))/(Gamma(1/2r))
(10)
=r(r+2)...(r+2n-2),
(11)

giving the first few as

mu_1^'=r
(12)
mu_2^'=r(r+2)
(13)
mu_3^'=r(r+2)(r+4)
(14)
mu_4^'=r(r+2)(r+4)(r+6).
(15)

The nth central moment is given by

 mu_n=2^nU(-n,1-n-1/2r,-1/2r),
(16)

where U(a,b,x) is a confluent hypergeometric function of the second kind, giving the first few as

mu_2=2r
(17)
mu_3=8r
(18)
mu_4=12r(r+4)
(19)
mu_5=32r(12+5r).
(20)

The cumulants can be found via the characteristic function

phi(t)=int_0^infty(2^(-r/2)e^(-x/2)x^((r-2)/2))/(Gamma(1/2r))dx
(21)
=(1-2it)^(-r/2).
(22)

Taking the natural logarithm of both sides gives

 lnphi=-1/2rln(1-2it).
(23)

But this is simply a Mercator series

 ln(1-x)=-sum_(n=1)^infty(x^n)/n
(24)

with x=2it, so from the definition of cumulants, it follows that

 sum_(n=0)^inftykappa_n((it)^n)/(n!)=1/2rsum_(n=1)^infty((2it)^n)/n,
(25)

giving the result

 kappa_n=2^(n-1)(n-1)!r.
(26)

The first few are therefore

kappa_1=r
(27)
kappa_2=2r
(28)
kappa_3=8r
(29)
kappa_4=48r.
(30)

The moment-generating function of the chi^2 distribution is

M(t)=(1-2t)^(-r/2)
(31)
R(t)=lnM(t)
(32)
=-1/2rln(1-2t)
(33)
R^'(t)=r/(1-2t)
(34)
R^('')(t)=(2r)/((1-2t)^2),
(35)

so

mu=R^'(0)
(36)
=r
(37)
sigma^2=R^('')(0)
(38)
=2r
(39)
gamma_1=2sqrt(2/r)
(40)
gamma_2=(12)/r.
(41)

If the mean is not equal to zero, a more general distribution known as the noncentral chi-squared distribution results. In particular, if X_i are independent variates with a normal distribution having means mu_i and variances sigma_i^2 for i=1, ..., n, then

 1/2chi^2=sum_(i=1)^n((x_i-mu_i)^2)/(2sigma_i^2)
(42)

obeys a gamma distribution with alpha=n/2, i.e.,

 P(y)dy=1/(Gamma(1/2n))e^(-y)y^((n/2)-1)dy.
(43)

where y=chi^2/2.


See also

Chi Distribution, Inverse Chi-Squared Distribution, Noncentral Chi-Squared Distribution, Normal Distribution, Snedecor's F-Distribution, Statistical Distribution

Explore with Wolfram|Alpha

References

Abramowitz, M. and Stegun, I. A. (Eds.). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables, 9th printing. New York: Dover, pp. 940-943, 1972.Beyer, W. H. CRC Standard Mathematical Tables, 28th ed. Boca Raton, FL: CRC Press, p. 535, 1987.Kenney, J. F. and Keeping, E. S. "The Chi-Square Distribution." §5.3 in Mathematics of Statistics, Pt. 2, 2nd ed. Princeton, NJ: Van Nostrand, pp. 98-100, 1951.Press, W. H.; Flannery, B. P.; Teukolsky, S. A.; and Vetterling, W. T. "Incomplete Gamma Function, Error Function, Chi-Square Probability Function, Cumulative Poisson Function." §6.2 in Numerical Recipes in FORTRAN: The Art of Scientific Computing, 2nd ed. Cambridge, England: Cambridge University Press, pp. 209-214, 1992.Spiegel, M. R. Theory and Problems of Probability and Statistics. New York: McGraw-Hill, pp. 115-116, 1992.

Referenced on Wolfram|Alpha

Chi-Squared Distribution

Cite this as:

Weisstein, Eric W. "Chi-Squared Distribution." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/Chi-SquaredDistribution.html

Subject classifications