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_lpdf(y | alpha, beta)
dropping constant additive terms.
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_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.