Discrete Uniform distribution
Story
A set of discrete outcomes that can be indexed with sequential integers, and each outcome has equal probability, like rolling a fair die.
Example
A monkey can choose from any of \(n\) bananas with equal probability.
Parameters
The distribution is parametrized by the high and low allowed values, respectively \(y_\mathrm{high}\) and \(y_\mathrm{low}\).
Support
The Discrete Uniform distribution is supported on the set of integers ranging from \(y_\mathrm{low}\) and \(y_\mathrm{high}\), inclusive.
Probability mass function
Cumulative distribution function
The CDF evaluated at integer \(y\) is
Moments
Mean: \(\displaystyle{\frac{y_\mathrm{low} + y_\mathrm{high}}{2}}\)
Variance: \(\displaystyle{\frac{(y_\mathrm{high} - y_\mathrm{low} + 1)^2 - 1}{12}}\)
Usage
Package |
Syntax |
---|---|
NumPy |
|
SciPy |
|
Distributions.jl |
|
Stan |
|
Notes
This distribution is not included in Stan. Instead, use a Categorical distribution with equal probailities.
In SciPy, this distribution is known as
scipy.stats.randint
. The high parameter is not inclusive; i.e., the set of allowed values includes the low parameter, but not the high. The same is true forrng.integers()
, unless you use theendpoint=True
keyword argument, in which case the high parameter is inclusive.