Skip to content

GammaDistribution ​

The Gamma distribution with shape kk and scale θ\theta.

GammaDistribution(k, theta)an inert distribution object with shape kk and scale θ\theta.
GammaDistribution(k)scale defaults to 11. NOT a Wolfram call form — GammaDistribution[alpha] alone errors there (GammaDistribution::argbu, confirmed against wolframscript); this is our own convenience.
Typed signatures
TypePackageApplies
(real<0..>, real<0..>?) -> distributionstatisticsalways

Domain: Statistics

Details
  • PDF(x)=xk−1e−x/θθk Γ(k)PDF(x) = \dfrac{x^{k-1}e^{-x/\theta}}{\theta^k\,\Gamma(k)}, via Gamma. No domain clamp outside x≥0x \ge 0.
  • CDF(x)=1−Q(k,x/θ)CDF(x) = 1 - Q(k, x/\theta) via the native two-argument GammaRegularized (not the three-argument generalized form @enumeratio/analytic adds — this has no dependency on that package), clamped to 00 below x=0x=0.
  • Mean=kθMean = k\theta, Variance=kθ2Variance = k\theta^2, both exact.
  • RandomVariate samples via Marsaglia–Tsang (shape ≥1\ge 1; boosted via a Gamma(k+1)Gamma(k+1) draw scaled by U1/kU^{1/k} below 11) — see RandomVariate for the seeded-PRNG divergence from Wolfram.

Examples

Basic #

≈0.16734762011132237\approx 0.16734762011132237, cross-checked against wolframscript's N[PDF[GammaDistribution[2,2],3]]

live ↗
InPDF⁡(GammaDistribution(2,2),3)\operatorname{PDF}(\mathrm{GammaDistribution}(2, 2), 3)Out34Γ(2)exp⁡(32)\frac{3}{4Γ(2)\exp(\frac{3}{2})}

≈0.44217459962892543\approx 0.44217459962892543, cross-checked against wolframscript's N[CDF[GammaDistribution[2,2],3]] = 0.4421745996289253

live ↗
InCDF⁡(GammaDistribution(2,2),3)\operatorname{CDF}(\mathrm{GammaDistribution}(2, 2), 3)Out1−52exp⁡(32)1-\frac{5}{2\exp(\frac{3}{2})}
live ↗
Inmean(GammaDistribution(2,2))\mathrm{mean}(\mathrm{GammaDistribution}(2, 2))Out44
live ↗
InVariance(GammaDistribution(2,2))\mathrm{Variance}(\mathrm{GammaDistribution}(2, 2))Out88
Scope #
live ↗
InGammaDistribution(2)\mathrm{GammaDistribution}(2)OutGammaDistribution(2,1)\mathrm{GammaDistribution}(2, 1)
Possible issues #
live ↗
InN(CDF⁡(GammaDistribution(2,2),−1))N(\operatorname{CDF}(\mathrm{GammaDistribution}(2, 2), -1))Out0.00.0
About
Examples6

See also: BetaDistribution, PDF, CDF, RandomVariate