ccdf — SciPy v1.15.3 Manual (original) (raw)

scipy.stats.Mixture.

Mixture.ccdf(x, y=None, /, *, method=None)[source]#

Complementary cumulative distribution function

The complementary cumulative distribution function (“CCDF”), denoted\(G(x)\), is the complement of the cumulative distribution function\(F(x)\); i.e., probability the random variable \(X\) will assume a value greater than \(x\):

\[G(x) = 1 - F(x) = P(X > x)\]

A two-argument variant of this function is:

\[G(x, y) = 1 - F(x, y) = P(X < x \text{ or } X > y)\]

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

Parameters:

x, yarray_like

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

method{None, ‘formula’, ‘logexp’, ‘complement’, ‘quadrature’, ‘addition’}

The strategy used to evaluate the CCDF. By default (None), the infrastructure chooses between the following options, listed in order of precedence.

The two-argument form chooses between:

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

Returns:

outarray

The CCDF evaluated at the provided argument(s).

Notes

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

\[G(x) = \int_x^r f(u) du\]

The two argument version is:

\[G(x, y) = \int_l^x f(u) du + \int_y^r f(u) du\]

The CCDF returns its minimum value of \(0\) for \(x ≥ r\)and its maximum value of \(1\) for \(x ≤ l\).

The CCDF is also known as the “survival function”.

References

Examples

Instantiate a distribution with the desired parameters:

import numpy as np from scipy import stats X = stats.Uniform(a=-0.5, b=0.5)

Evaluate the CCDF at the desired argument:

X.ccdf(0.25) 0.25 np.allclose(X.ccdf(0.25), 1-X.cdf(0.25)) True

Evaluate the complement of the cumulative probability between two arguments:

X.ccdf(-0.25, 0.25) == X.cdf(-0.25) + X.ccdf(0.25) True