Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ gamma_lpdf() [1/3]

template<bool propto, typename T_y_cl , typename T_shape_cl , typename T_inv_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_shape_cl, T_inv_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_shape_cl, T_inv_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_shape_cl, T_inv_scale_cl > stan::math::gamma_lpdf ( const T_y_cl &  y,
const T_shape_cl &  alpha,
const T_inv_scale_cl &  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*}

Template Parameters
T_y_cltype of scalar
T_shape_cltype of shape
T_inv_scale_cltype of inverse scale
Parameters
yA scalar variable.
alphaShape parameter.
betaInverse scale parameter.
Exceptions
std::domain_errorif alpha is not greater than 0.
std::domain_errorif beta is not greater than 0.
std::domain_errorif y is not greater than or equal to 0.

Definition at line 47 of file gamma_lpdf.hpp.