Skip to main content

betainccinv

Function betainccinv 

Source
pub fn betainccinv(a: f64, b: f64, y: f64) -> f64
Expand description

Inverse of the complement of the regularized incomplete Beta function, $y = 1 - \I_x(a, b)$

Computes $x \in [0, 1]$ such that 1:

$$ y = 1 - \I_x(a, b) = \I_{1-x}(b, a) , $$

for $0 \le y \le 1$ and $a,b > 0$, with $\I_x(a, b)$ the regularized incomplete Beta function.

This function is the inverse survival function of the Beta distribution.

§Notes

This function uses the incbi Cephes routine 2 for the root of $\I_{1-x}(b, a) = y$, refined by safeguarded Newton steps, whereas scipy.special.betainccinv wraps the Boost ibetac_inv routine 3. For example, with $10^{-3} \le a, b \le 10^5$, the relative error is up to 4e-13, for $a = 10^{-3}$, where the root is ill-conditioned. Where $1 - \I_x(a, b)$ rounds to $y$ over a range of $x$, e.g. for a subnormal $y$, the result can be anywhere in that range.

§See also


  1. NIST Digital Library of Mathematical Functions, https://dlmf.nist.gov/8.17.E4. ↩

  2. Cephes Math Library Release 2.4. ↩

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