Skip to main content
`Ctrl`+`K`

# scipy.special.betaincc

scipy.special.betaincc(a, b, x, out=None) = <ufunc 'betaincc'>

  Complement of the regularized incomplete beta function.

  Computes the complement of the regularized incomplete beta function, defined as [1]:

  \[\bar{I}_x(a, b) = 1 - I_x(a, b) = 1 - \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)} \int_0^x t^{a-1}(1-t)^{b-1}dt,\]

  for \(0 \leq x \leq 1\).

  Parameters:
    a, b array_like

      Positive, real-valued parameters

    x array_like

      Real-valued such that \(0 \leq x \leq 1\), the upper limit of integration

    out ndarray, optional

      Optional output array for the function values

  Returns:
    scalar or ndarray

      Value of the regularized incomplete beta function

  See also

  `betainc`

    regularized incomplete beta function

  `betaincinv`

    inverse of the regularized incomplete beta function

  `betainccinv`

    inverse of the complement of the regularized incomplete beta function

  `beta`

    beta function

  `scipy.stats.beta`

    beta distribution

  Notes

  Added in version 1.11.0.

  This function wraps the `ibetac` routine from the Boost Math C++ library [2].

  References

  [1]

  NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/8.17

  [2]

  The Boost Developers. “Boost C++ Libraries”. https://www.boost.org/.

  Examples

      >>> from scipy.special import betaincc, betainc

  The naive calculation `1 - betainc(a, b, x)` loses precision when the values of `betainc(a, b, x)` are close to 1:

      >>> 1 - betainc(0.5, 8, [0.9, 0.99, 0.999])
      array([2.0574632e-09, 0.0000000e+00, 0.0000000e+00])

  By using `betaincc`, we get the correct values:

      >>> betaincc(0.5, 8, [0.9, 0.99, 0.999])
      array([2.05746321e-09, 1.97259354e-17, 1.96467954e-25])