This is an old version, view current version.

## 15.7 Discrete range distribution

### 15.7.1 Probability mass functions

If $$l, u \in \mathbb{Z}$$ are lower and upper bounds ($$l \le u$$), then for any integer $$y \in \{l,\ldots,u\}$$, $\text{DiscreteRange}(y ~|~ l, u) = \frac{1}{u - l + 1}.$

### 15.7.2 Sampling statement

y ~ discrete_range(l, u)

Increment the target log probability density with discrete_range_lupmf(y | l, u) dropping constant additive terms.
Available since 2.26

### 15.7.3 Stan functions

All of the discrete range distributions are vectorized so that the outcome y and the bounds l, u can be a single integer (type int) or an array of integers (type array[] int).

real discrete_range_lpmf(ints y | ints l, ints u)
The log probability mass function with outcome(s) y in $$l:u$$.
Available since 2.26

real discrete_range_lupmf(ints y | ints l, ints u)
The log probability mass function with outcome(s) y in $$l:u$$ dropping constant additive terms.
Available since 2.26

real discrete_range_cdf(ints y, ints l, ints u)
The discrete range cumulative distribution function for the given y, lower and upper bounds.
Available since 2.26

real discrete_range_lcdf(ints y | ints l, ints u)
The log of the discrete range cumulative distribution function for the given y, lower and upper bounds.
Available since 2.26

real discrete_range_lccdf(ints y | ints l, ints u)
The log of the discrete range complementary cumulative distribution function for the given y, lower and upper bounds.
Available since 2.26

int discrete_range_rng(ints l, ints u)
Generate a discrete variate between the given lower and upper bounds; may only be used in transformed data and generated quantities blocks.
Available since 2.26