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

# iccdf

Mixture.iccdf(p, /, *, method=None)

  Inverse complementary cumulative distribution function.

  The inverse complementary cumulative distribution function (“inverse CCDF”), denoted \(G^{-1}(p)\), is the argument \(x\) for which the complementary cumulative distribution function \(G(x)\) evaluates to \(p\).

  \[G^{-1}(p) = x \quad \text{s.t.} \quad G(x) = p\]

  When a strict “inverse” of the complementary cumulative distribution function does not exist (e.g. discrete random variables), the “inverse CCDF” is defined by convention as the smallest value within the support \(\chi\) for which \(G(x)\) is no greater than \(p\).

  \[G^{-1}(p) = \min_\chi \quad \text{s.t.} \quad G(x) ≤ p\]

  `iccdf` accepts p for \(p \in [0, 1]\).

  Parameters:
    p array_like

      The argument of the inverse CCDF.

    method{None, ‘formula’, ‘complement’, ‘inversion’}

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

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

      - `'complement'`: evaluate the inverse CDF at the complement of p

      - `'inversion'`: solve numerically for the argument at which the CCDF is equal to p

      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 inverse CCDF evaluated at the provided argument.

  See also

  `icdf`
  `ilogccdf`

  Notes

  Suppose a probability distribution has support \([l, r]\). The inverse CCDF returns its minimum value of \(l\) at \(p = 1\) and its maximum value of \(r\) at \(p = 0\). Because the CCDF has range \([0, 1]\), the inverse CCDF is only defined on the domain \([0, 1]\); for \(p < 0\) and \(p > 1\), `iccdf` returns `nan`.

  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 inverse CCDF at the desired argument:

      >>> X.iccdf(0.25)
      0.25
      >>> np.allclose(X.iccdf(0.25), X.icdf(1-0.25))
      True

  This function returns NaN when the argument is outside the domain.

      >>> X.iccdf([-0.1, 0, 1, 1.1])
      array([ nan,  0.5, -0.5,  nan])