{ } Raw JSON

bundles / scipy 1.17.1 / scipy / stats / _probability_distribution / _ProbabilityDistribution / cdf

function

scipy.stats._probability_distribution:_ProbabilityDistribution.cdf

source: /scipy/stats/_probability_distribution.py :1021

Signature

def   cdf ( self x y / method )

Summary

Cumulative distribution function

Extended Summary

The cumulative distribution function ("CDF"), denoted , is the probability the random variable will assume a value less than or equal to :

A two-argument variant of this function is also defined as the probability the random variable will assume a value between and .

cdf accepts x for and y for .

Parameters

x, y : array_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

out : array

The CDF evaluated at the provided argument(s).

Notes

Suppose a continuous probability distribution has support . The CDF is related to the probability density function by:

The two argument version is:

The CDF evaluates to its minimum value of for and its maximum value of for .

Suppose a discrete probability distribution has support . The CDF is related to the probability mass function by:

The CDF evaluates to its minimum value of for and its maximum value of for .

The CDF is also known simply as the "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)
Evaluate the cumulative probability between two arguments:
X.cdf(-0.25, 0.25) == X.cdf(0.25) - X.cdf(-0.25)

See also

ccdf
logcdf

Aliases

  • scipy.stats._distribution_infrastructure._ProbabilityDistribution.cdf