Gamma: Create a Gamma distribution

View source: R/Gamma.R

GammaR Documentation

Create a Gamma distribution


Several important distributions are special cases of the Gamma distribution. When the shape parameter is 1, the Gamma is an exponential distribution with parameter 1/β. When the shape = n/2 and rate = 1/2, the Gamma is a equivalent to a chi squared distribution with n degrees of freedom. Moreover, if we have X_1 is Gamma(α_1, β) and X_2 is Gamma(α_2, β), a function of these two variables of the form \frac{X_1}{X_1 + X_2} Beta(α_1, α_2). This last property frequently appears in another distributions, and it has extensively been used in multivariate methods. More about the Gamma distribution will be added soon.


Gamma(shape, rate = 1)



The shape parameter. Can be any positive number.


The rate parameter. Can be any positive number. Defaults to 1.


We recommend reading this documentation on, where the math will render with additional detail.

In the following, let X be a Gamma random variable with parameters shape = α and rate = β.

Support: x \in (0, ∞)

Mean: \frac{α}{β}

Variance: \frac{α}{β^2}

Probability density function (p.m.f):

f(x) = \frac{β^{α}}{Γ(α)} x^{α - 1} e^{-β x}

Cumulative distribution function (c.d.f):

f(x) = \frac{Γ(α, β x)}{Γ{α}}

Moment generating function (m.g.f):

E(e^(tX)) = \Big(\frac{β}{ β - t}\Big)^{α}, \thinspace t < β


A Gamma object.

See Also

Other continuous distributions: Beta(), Cauchy(), ChiSquare(), Erlang(), Exponential(), FisherF(), Frechet(), GEV(), GP(), Gumbel(), LogNormal(), Logistic(), Normal(), RevWeibull(), StudentsT(), Tukey(), Uniform(), Weibull()



X <- Gamma(5, 2)

random(X, 10)

pdf(X, 2)
log_pdf(X, 2)

cdf(X, 4)
quantile(X, 0.7)

cdf(X, quantile(X, 0.7))
quantile(X, cdf(X, 7))

distributions3 documentation built on Sept. 7, 2022, 5:07 p.m.