Chi-Squared Distribution

Author

Eric W. Weisstein
December 22, 2003

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Statistics/Chi-SquaredDistribution.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Chi-SquaredDistribution.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Plots

<<Graphics`Colors`

Show[GraphicsArray[{
Plot[Evaluate[Table[PDF[ChiSquareDistribution[r],x],{r,10}]],{x,0,10},DisplayFunction->Identity,
PlotStyle->Hue/@Range[0,1,.09],AxesLabel->TraditionalForm/@{x,(Subscript[P, r])[x]}],
Plot[Evaluate[Table[CDF[ChiSquareDistribution[r],x],{r,10}]],{x,0,10},DisplayFunction->Identity,
PlotStyle->Hue/@Range[0,1,.09],AxesLabel->TraditionalForm/@{x,(Subscript[D, r])[x]}]
}]]

Show[GraphicsArray[ContourPlot[#[[1]][ChiSquareDistribution[r],x],{x,.01,10},{r,.01,10},ColorFunction->Hue,FrameLabel->TraditionalForm/@{x,r},
PlotLabel->TraditionalForm[#[[2]]],
PlotPoints->100,
DisplayFunction->Identity
]&/@{{PDF,(Subscript[P, r])[x]},{CDF,(Subscript[D, r])[x]}}
]]

Stats

Stats[ChiSquareDistribution[r],x]//StatsForm//TraditionalForm

Maximum

FullSimplify[D[PDF[ChiSquareDistribution[r],x],x]]

Simplify[PDF[ChiSquareDistribution[r],r-2]]

CDF

FullSimplify[Integrate[(((2^(-r/2)) (E^(-x/2)) (x^((r-2)/2)))/(Gamma[(r/2)])),{x,0,(χ^2)},Assumptions->{χ>0,r>1}]]

Moments

Raw Moments

Integrate[x^n PDF[ChiSquareDistribution[r],x],{x,0,Infinity},GenerateConditions->False]

FullSimplify[(((2^n) Gamma[n+(r/2)])/(Gamma[(r/2)])),(n|r)∈Integers]

mu[n_]:=2^n Gamma[n+r/2]/Gamma[r/2]

Simplify[Table[m[n],{n,5}],r ϵ Integers]

FullSimplify[Table[m[n],{n,5}],r ϵ Integers]

Central Moments

From Binomial Transform

FullSimplify[PowerExpand[FullSimplify[Sum[Binomial[n,k](-1)^(n-k)mu[k]mu[1]^(n-k),{k,0,n}]/.mu[0]:>1
]]]

Simplify[Table[(2^n) HypergeometricU[-n,1-n-(r/2),-(r/2)],{n,10}]]

Integrals for Explicit n

Factor/@FullSimplify[Table[Integrate[PDF[ChiSquareDistribution[r],x](x-r)^n,{x,0,Infinity},GenerateConditions->False],{n,10}]]

v4.2

This result is wrong

FullSimplify[Integrate[PDF[ChiSquareDistribution[r],x](x-r)^n,{x,0,Infinity},Assumptions->{(r|n)∈Integers}]]

i=(((-r))^n) ((2^(n+(r/2))) (((-(1/r)))^n) Gamma[n+(r/2)] Hypergeometric1F1[-n,1-n-(r/2),-(r/2)]+(1/(Gamma[-n]))((((-(1/r)))^(-r/2)) Gamma[-n-(r/2)] Gamma[(r/2)] Hypergeometric1F1[(r/2),1+n+(r/2),-(r/2)]));

Table[i,{n,5}]//Simplify

%/.r->5

V5.0

<<Stats`;

Integrate[PDF[ChiSquareDistribution[r],x](x-r)^n,{x,0,Infinity}]

Characteristic Function

ϕ=FourierTransform[(((2^(-r/2)) (E^(-x/2)) (x^((1/2) (-2+r))))/(Gamma[(r/2)]))UnitStep[x],x,t]

ser=PowerExpand[FullSimplify[ϕ]]

CharacteristicFunction[ChiSquareDistribution[r],t]

Cumulants

PowerExpand[Log[ser]]

Table[n!/I^n,{n,0,5}]CoefficientList[Simplify[Series[Log[ser],{t,0,5}]],t]

But taking the series is the Mercator series

Sum[-x^n/n,{n,∞}]

so

(∑_(n=0)^∞)(((Subscript[κ, n]) (((I t))^n))/(n!))==(1/2) r (∑_(n=1)^∞)((((2 I t))^n)/n)

and (Subscript[κ, n])is

Simplify[-(-r/2)(n-1)!2^n]

FullSimplify[SeriesTerm[-(1/2) r Log[1-2 I t],{t,0,n}],n>1]

Table[(2^(n-1))(n-1)!r,{n,5}]