Uniform Distribution¶
Table of contents
Density Function¶
The density function of the Uniform distribution:
Methods for scalar input, as well as for list input, are listed below.
Scalar Input¶
- pystats.dunif(x: float, min: float = 0.0, max: float = 1.0, log: bool = False) float
Density function of the Uniform distribution.
Example
>>> pystats.dunif(0.5, -1.0, 2.0) 0.3333333333333333
- Parameters
x (float) – A real-valued input.
min (float) – The lower limit of the distribution, a real-valued input.
max (float) – The upper limit of the distribution, a real-valued input.
log (bool) – Return the log-density or the true form.
- Returns
The density function evaluated at x.
List Input¶
- pystats.dunif(x: List[float], min: float = 0.0, max: float = 1.0, log: bool = False) List[float]
Density function of the Uniform distribution.
Example
>>> pystats.dunif([-2.0, 0.0, 2.0], -1.0, 3.0) [0.0, 0.25, 0.25]
- Parameters
x (List[float]) – A standard list input.
min (float) – The lower limit of the distribution, a real-valued input.
max (float) – The upper limit of the distribution, a real-valued input.
log (bool) – Return the log-density or the true form.
- Returns
A list of density values corresponding to the elements of x.
Cumulative Distribution Function¶
The cumulative distribution function (CDF) of the Uniform distribution:
Methods for scalar input, as well as for list input, are listed below.
Scalar Input¶
- pystats.punif(p: float, min: float = 0.0, max: float = 1.0, log: bool = False) float
Distribution function of the Uniform distribution.
Example
>>> pystats.punif(0.5, -1.0, 2.0) 0.5
- Parameters
p (float) – A real-valued input.
min (float) – The lower limit of the distribution, a real-valued input.
max (float) – The upper limit of the distribution, a real-valued input.
log (bool) – Return the log-density or the true form.
- Returns
The cumulative distribution function evaluated at p.
List Input¶
- pystats.punif(p: List[float], min: float = 0.0, max: float = 1.0, log: bool = False) List[float]
Distribution function of the Uniform distribution.
Example
>>> pystats.punif([-2.0, 0.0, 2.0], -1.0, 3.0) [0.0, 0.25, 0.75]
- Parameters
p (List[float]) – A standard list input.
min (float) – The lower limit of the distribution, a real-valued input.
max (float) – The upper limit of the distribution, a real-valued input.
log (bool) – Return the log-density or the true form.
- Returns
A list of CDF values corresponding to the elements of p.
Quantile Function¶
The quantile function of the Uniform distribution:
Methods for scalar input, as well as for list input, are listed below.
Scalar Input¶
- pystats.qunif(q: float, min: float = 0.0, max: float = 1.0) float
Quantile function of the Uniform distribution.
Example
>>> pystats.qunif(0.75, -1.0, 2.0) 1.25
- Parameters
q (float) – A real-valued input.
min (float) – The lower limit of the distribution, a real-valued input.
max (float) – The upper limit of the distribution, a real-valued input.
- Returns
The quantile function evaluated at q.
List Input¶
- pystats.qunif(q: List[float], min: float = 0.0, max: float = 1.0) List[float]
Quantile function of the Uniform distribution.
Example
>>> pystats.qunif([0.3, 0.5, 0.9], -1.0, 3.0) [0.2, 1.0, 2.6]
- Parameters
q (List[float]) – A standard list input.
min (float) – The lower limit of the distribution, a real-valued input.
max (float) – The upper limit of the distribution, a real-valued input.
- Returns
A list of quantiles values corresponding to the elements of q.
Random Sampling¶
Random sampling for the Uniform distribution is achieved via the uniform_real_distribution
class from the C++ standard library, imported from <random>
.
Scalar Output¶
- pystats.runif(min: float = 0.0, max: float = 1.0) float
Random sampling function for the Uniform distribution.
Example
>>> pystats.runif(-1.0, 2.0) 1.0599044629461352
- Parameters
min (float) – The lower limit of the distribution, a real-valued input.
max (float) – The upper limit of the distribution, a real-valued input.
- Returns
A pseudo-random draw from the Uniform distribution.
List Output¶
- pystats.runif(n: int, min: float = 0.0, max: float = 1.0) List[float]
Random sampling function for the Uniform distribution.
Example
>>> pystats.runif(3, -1.0, 2.0) [1.0552953561528309, 0.81837699091385, 0.17769962603787082]
- Parameters
n (int) – The number of output values.
min (float) – The lower limit of the distribution, a real-valued input.
max (float) – The upper limit of the distribution, a real-valued input.
- Returns
A list of pseudo-random draws from the Uniform distribution.