Stan Math Library
4.9.0
Automatic Differentiation
|
double stan::math::discrete_range_lpmf | ( | const T_y & | y, |
const T_lower & | lower, | ||
const T_upper & | upper | ||
) |
Return the log PMF of a discrete range for the given y, lower and upper bound (all integers).
\begin{eqnarray*} y &\sim& \mbox{\sf{discrete\_range}}(lower, upper) \\ \log(p (y \, |\, lower, upper)) &=& \log \left( \frac{1}{upper - lower + 1} \right) \\ &=& -\log (upper - lower + 1) \end{eqnarray*}
lower
and upper
can each be a scalar or a one-dimensional container. Any container arguments must be the same size.
T_y | type of scalar, either int or std::vector<int> |
T_lower | type of lower bound, either int or std::vector<int> |
T_upper | type of upper bound, either int or std::vector<int> |
y | integer random variable |
lower | integer lower bound |
upper | integer upper bound |
std::domain_error | if upper is smaller than lower. |
std::invalid_argument | if non-scalar arguments are of different sizes. |
Definition at line 46 of file discrete_range_lpmf.hpp.