Stan Math Library
4.9.0
Automatic Differentiation
|
return_type_t< T_y_cl, T_dof_cl > stan::math::chi_square_lpdf | ( | const T_y_cl & | y, |
const T_dof_cl & | nu | ||
) |
The log of a chi-squared density for y with the specified degrees of freedom parameter.
The degrees of freedom parameter must be greater than 0. y must be greater than or equal to 0.
\begin{eqnarray*} y &\sim& \chi^2_\nu \\ \log (p (y \, |\, \nu)) &=& \log \left( \frac{2^{-\nu / 2}}{\Gamma (\nu / 2)} y^{\nu / 2 - 1} \exp^{- y / 2} \right) \\ &=& - \frac{\nu}{2} \log(2) - \log (\Gamma (\nu / 2)) + (\frac{\nu}{2} - 1) \log(y) - \frac{y}{2} \\ & & \mathrm{ where } \; y \ge 0 \end{eqnarray*}
T_y_cl | type of dependent variable |
T_dof_cl | type of degrees of freedom |
y | A dependent variable. |
nu | Degrees of freedom. |
std::domain_error | if nu is not greater than or equal to 0 |
std::domain_error | if y is not greater than or equal to 0. |
Definition at line 38 of file chi_square_lpdf.hpp.