18.6 Gamma distribution
18.6.1 Probability density function
If \(\alpha \in \mathbb{R}^+\) and \(\beta \in \mathbb{R}^+\), then for \(y \in \mathbb{R}^+\), \[ \text{Gamma}(y|\alpha,\beta) = \frac{\beta^{\alpha}} {\Gamma(\alpha)} \, y^{\alpha - 1} \exp(-\beta \, y) . \]
18.6.2 Sampling statement
y ~
gamma
(alpha, beta)
Increment target log probability density with gamma_lupdf(y | alpha, beta)
.
Available since 2.0
18.6.3 Stan functions
real
gamma_lpdf
(reals y | reals alpha, reals beta)
The log of the gamma density of y given shape alpha and inverse scale
beta
Available since 2.12
real
gamma_lupdf
(reals y | reals alpha, reals beta)
The log of the gamma density of y given shape alpha and inverse scale
beta dropping constant additive terms
Available since 2.25
real
gamma_cdf
(reals y, reals alpha, reals beta)
The cumulative gamma distribution function of y given shape alpha and
inverse scale beta
Available since 2.0
real
gamma_lcdf
(reals y | reals alpha, reals beta)
The log of the cumulative gamma distribution function of y given shape
alpha and inverse scale beta
Available since 2.12
real
gamma_lccdf
(reals y | reals alpha, reals beta)
The log of the complementary cumulative gamma distribution function of
y given shape alpha and inverse scale beta
Available since 2.12
R
gamma_rng
(reals alpha, reals beta)
Generate a gamma variate with shape alpha and inverse scale beta; may
only be used in transformed data and generated quantities blocks.
For a description of argument and return types, see section
vectorized PRNG functions.
Available since 2.18