Stan Math Library
5.0.0
Automatic Differentiation
|
return_type_t< T_y, T_shape, T_inv_scale > stan::math::gamma_lpdf | ( | const T_y & | y, |
const T_shape & | alpha, | ||
const T_inv_scale & | beta | ||
) |
The log of a gamma density for y with the specified shape and inverse scale parameters.
Shape and inverse scale parameters must be greater than 0. y must be greater than or equal to 0.
\begin{eqnarray*} y &\sim& \mbox{\sf{Gamma}}(\alpha, \beta) \\ \log (p (y \, |\, \alpha, \beta) ) &=& \log \left( \frac{\beta^\alpha}{\Gamma(\alpha)} y^{\alpha - 1} \exp^{- \beta y} \right) \\ &=& \alpha \log(\beta) - \log(\Gamma(\alpha)) + (\alpha - 1) \log(y) - \beta y\\ & & \mathrm{where} \; y > 0 \end{eqnarray*}
T_y | type of scalar |
T_shape | type of shape |
T_inv_scale | type of inverse scale |
y | A scalar variable. |
alpha | Shape parameter. |
beta | Inverse scale parameter. |
std::domain_error | if alpha is not greater than 0. |
std::domain_error | if beta is not greater than 0. |
std::domain_error | if y is not greater than or equal to 0. |
Definition at line 52 of file gamma_lpdf.hpp.