Uniform distribution


Story

Outcomes are restricted to a given continuous range and every outcome in that range has equal probability.


Example

Anything in which all possibilities are equally likely. This is, perhaps surprisingly, rarely encountered.


Parameters

The Uniform distribution is not defined on an infinite or semi-infinite domain, so finite lower and upper bounds, \(\alpha\) and \(\beta\), respectively, are necessary parameters.


Support

The Uniform distribution is supported on the interval \([\alpha, \beta]\).


Probability density function

\[\begin{split}\begin{align} f(y;\alpha, \beta) = \left\{\begin{array}{ccl}\displaystyle{\frac{1}{\beta-\alpha}}&&\alpha\le y\le\beta\\[0.5em] 0 && \text{otherwise.}\end{array}\right. \end{align}\end{split}\]

Cumulative distribution function

\[\begin{split}\begin{align} F(y; \alpha, \beta) = \left\{\begin{array}{ccl} 0 && y < a \\[0.5em]\displaystyle{\frac{y-\alpha}{\beta-\alpha}}&&\alpha\le y\le\beta\\[0.5em] 1 && y > \beta\end{array}\right. \end{align}\end{split}\]

Moments

Mean: \(\displaystyle{\frac{\alpha + \beta}{2}}\)

Variance: \(\displaystyle{\frac{(\beta - \alpha)^2}{12}}\)


Usage

Package

Syntax

NumPy

rng.uniform(alpha, beta)

SciPy

scipy.stats.uniform(alpha, beta - alpha)

Distributions.jl

Uniform(alpha, beta)

Stan

uniform(alpha, beta)



PDF and CDF plots