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

◆ uniform_lpdf() [1/3]

template<bool propto, typename T_y_cl , typename T_low_cl , typename T_high_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_low_cl, T_high_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_low_cl, T_high_cl > * = nullptr>
return_type_t< T_y_cl, T_low_cl, T_high_cl > stan::math::uniform_lpdf ( const T_y_cl &  y,
const T_low_cl &  alpha,
const T_high_cl &  beta 
)
inline

The log of a uniform density for the given y, lower, and upper bound.

\begin{eqnarray*} y &\sim& \mbox{\sf{U}}(\alpha, \beta) \\ \log (p (y \, |\, \alpha, \beta)) &=& \log \left( \frac{1}{\beta-\alpha} \right) \\ &=& \log (1) - \log (\beta - \alpha) \\ &=& -\log (\beta - \alpha) \\ & & \mathrm{ where } \; y \in [\alpha, \beta], \log(0) \; \mathrm{otherwise} \end{eqnarray*}

Template Parameters
T_y_cltype of scalar
T_low_cltype of lower bound
T_high_cl_cltype of upper bound
Parameters
yA scalar variable.
alphaLower bound.
betaUpper bound.
Exceptions
std::invalid_argumentif the lower bound is greater than or equal to the lower bound

Definition at line 42 of file uniform_lpdf.hpp.