Uniform distribution#

The PDF of the uniform distribution is constant on the interval \([a,b]\), where \(a\) and \(b\) denote the lower and upper bounds of plausible values, respectively.

In the following, let \(X\) be a random variable that follows a uniform distribution with parameters \(a\) and \(b\), and let \(x\) denote a particular outcome of \(X\).

import fesslix as flx
flx.load_engine()

import numpy as np
import fesslix.plot as flx_plot
import matplotlib.pyplot as plt
%matplotlib inline
Random Number Generator: MT19937 - initialized with rand()=54482010;
Random Number Generator: MT19937 - initialized with 1000 initial calls.

Syntax#

property uniform#

Uniform distribution

uniform is a distribution type (flx_rv_type) for Random variables in Fesslix.

Parametrization:

Parameters of the distribution can be specified as additional key-value pairs in an object of type flx_rv_config. The following combinations of parameters are accepted:

  • a, b

The interpretation of the parameters is:

  • a (flxPara): lower bound

  • b (flxPara): upper bound; value must be larger than a

Example:

rv = flx.rv({'name':'rv_1', 'type':'uniform', 'a':0., 'b':1. })

Properties#

Notation

\(X\sim\mathcal{U}(a,b)\)

Parameters

\(-\infty<a<b<\infty\)

Support

\(x\in[a,b]\)

Mean

\(\mu_X = \frac{1}{2}(a+b)\)

Standard deviation

\(\sigma_X = \frac{1}{\sqrt{12}}(b-a)\)

Median

\(\mu_X\)

Mode

\(\mu_X\)

Skewness

zero

Excess kurtosis

\(-\frac{6}{5}\)

Entropy

\(\ln(b-a)\)

PDF#

The PDF \(f_X(x)\) of the \emph{uniform} distribution is:

\[f_X(x) = \frac{1}{b-a}\;, \quad a \le x \le b\]

CDF#

The CDF \(F_X(x)\) of the \emph{uniform} distribution is defined as:

\[F_X(x) = \frac{x-a}{b-a}\]

Quantile function#

The quantile function of the uniform distribution is:

\[F_X^{-1}(p) = p\cdot(b-a) + a \;, \quad p\in(0,1)\]

Parametrization in terms of \(\mu_X\) and \(\sigma_X\)#

If the mean and standard deviation are given, the parameters \(a\) and \(b\) can be derived as:

\[a = \mu_X - \sigma_X \sqrt{3}\]
\[b = \mu_X + \sigma_X \sqrt{3}\]