scipy.stats.Uniform.

cdf#

Uniform.cdf(x, y=None, /, *, method=None)[source]#

Cumulative distribution function

The cumulative distribution function (β€œCDF”), denoted \(F(x)\), is the probability the random variable \(X\) will assume a value less than or equal to \(x\):

\[F(x) = P(X ≀ x)\]

A two-argument variant of this function is also defined as the probability the random variable \(X\) will assume a value between \(x\) and \(y\).

\[F(x, y) = P(x ≀ X ≀ y)\]

cdf accepts x for \(x\) and y for \(y\).

Parameters:
x, yarray_like

The arguments of the CDF. x is required; y is optional.

method{None, β€˜formula’, β€˜logexp’, β€˜complement’, β€˜quadrature’, β€˜subtraction’}

The strategy used to evaluate the CDF. By default (None), the one-argument form of the function chooses between the following options, listed in order of precedence.

  • 'formula': use a formula for the CDF itself

  • 'logexp': evaluate the log-CDF and exponentiate

  • 'complement': evaluate the CCDF and take the complement

  • 'quadrature': numerically integrate the PDF (or, in the discrete case, sum the PMF)

In place of 'complement', the two-argument form accepts:

  • 'subtraction': compute the CDF at each argument and take the difference.

Not all method options are available for all distributions. If the selected method is not available, a NotImplementedError will be raised.

Returns:
outarray

The CDF evaluated at the provided argument(s).

See also

logcdf
ccdf

Notes

Suppose a continuous probability distribution has support \([l, r]\). The CDF \(F(x)\) is related to the probability density function \(f(x)\) by:

\[F(x) = \int_l^x f(u) du\]

The two argument version is:

\[F(x, y) = \int_x^y f(u) du = F(y) - F(x)\]

The CDF evaluates to its minimum value of \(0\) for \(x ≀ l\) and its maximum value of \(1\) for \(x β‰₯ r\).

Suppose a discrete probability distribution has support \([l, r]\). The CDF \(F(x)\) is related to the probability mass function \(f(x)\) by:

\[F(x) = \sum_{u=l}^{\lfloor x \rfloor} f(u)\]

The CDF evaluates to its minimum value of \(0\) for \(x < l\) and its maximum value of \(1\) for \(x β‰₯ r\).

The CDF is also known simply as the β€œdistribution function”.

References

[1]

Cumulative distribution function, Wikipedia, https://en.wikipedia.org/wiki/Cumulative_distribution_function

Examples

Instantiate a distribution with the desired parameters:

>>> from scipy import stats
>>> X = stats.Uniform(a=-0.5, b=0.5)

Evaluate the CDF at the desired argument:

>>> X.cdf(0.25)
0.75

Evaluate the cumulative probability between two arguments:

>>> X.cdf(-0.25, 0.25) == X.cdf(0.25) - X.cdf(-0.25)
True