Skip to content

ChiSquareDistribution ​

The chi-square distribution with kk degrees of freedom — GammaDistribution(k/2,2)GammaDistribution(k/2, 2) under the hood.

ChiSquareDistribution(k)an inert distribution object — carries kk, unevaluated.
Typed signatures
TypePackageApplies
(real<0..>) -> distributionstatisticsalways

Domain: Statistics

Details
  • PDF(x)=xk/2−1e−x/2/(2k/2Γ(k/2))PDF(x) = x^{k/2-1} e^{-x/2} / (2^{k/2}\Gamma(k/2)) for x≥0x \geq 0 — no domain clamp on the PDF itself (same policy as GammaDistribution).
  • CDF(x)=P(k/2,x/2)CDF(x) = P(k/2, x/2), the regularized lower incomplete gamma, via GammaRegularized (compute-engine's native two-argument form is the upper tail), clamped to 00 below x=0x=0.
  • Mean=kMean = k, Variance=2kVariance = 2k, both exact.
  • RandomVariate samples via the same Marsaglia–Tsang GammaDistribution draw, shape k/2k/2, scale 22.

Examples

Basic #
live ↗
InPDF⁡(ChiSquareDistribution(3),2)\operatorname{PDF}(\mathrm{ChiSquareDistribution}(3), 2)Out12eΓ(32)\frac{1}{2e Γ(\frac{3}{2})}

Cross-checked against wolframscript's N[CDF[ChiSquareDistribution[3], 2]] = 0.427593...

live ↗
InCDF⁡(ChiSquareDistribution(3),2)\operatorname{CDF}(\mathrm{ChiSquareDistribution}(3), 2)Out1−GammaRegularized⁡(32,1)1-\operatorname{GammaRegularized}(\frac{3}{2}, 1)
live ↗
Inmean(ChiSquareDistribution(3))\mathrm{mean}(\mathrm{ChiSquareDistribution}(3))Out33
live ↗
InVariance(ChiSquareDistribution(3))\mathrm{Variance}(\mathrm{ChiSquareDistribution}(3))Out66
About
Examples4

See also: GammaDistribution, PDF, CDF