Skip to main content
`Ctrl`+`K`
scipy.stats.Uniform.

# ccdf

Uniform.ccdf(x, y=None, /, *, method=None)

  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, y array_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.

      - `'formula'`: use a formula for the CCDF itself

      - `'logexp'`: evaluate the log-CCDF and exponentiate

      - `'complement'`: evaluate the CDF and take the complement

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

      The two-argument form chooses between:

      - `'formula'`: use a formula for the CCDF itself

      - `'addition'`: compute the CDF at x and the CCDF at y, then add

      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 CCDF evaluated at the provided argument(s).

  See also

  `cdf`
  `logccdf`

  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\).

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

  \[G(x) = \sum_{u=\lfloor x + 1 \rfloor}^{r} f(u)\]

  The CCDF evaluates to 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

  [1]

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

  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