17.6 Gamma distribution
17.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) . \]
17.6.2 Sampling statement
y ~
gamma
(alpha, beta)
Increment target log probability density with gamma_lupdf(y | alpha, beta)
.
17.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
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
real
gamma_cdf
(reals y, reals alpha, reals beta)
The cumulative gamma distribution function of y given shape alpha and
inverse scale beta
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
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
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.