Skip to main content

betaincinv

Function betaincinv 

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

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

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

$$ y = \I_x(a, b) = {1 \over \B(a, b)} \int_0^x t^{a-1} (1-t)^{b-1} \dd t , $$

for $0 \le y \le 1$ and $a,b \ge 0$, with $\B(a, b)$ the Beta function.

This function is the quantile function (inverse CDF) of the Beta distribution.

§Notes

This function uses the incbi Cephes routine 2, making it less accurate than scipy.special.betaincinv, which wraps the Boost ibeta_inv routine 3. For example, with $10^3 < a < 10^5$ and $1/2 < b < 10$, the relative error is up to 5e-14 for $10^{-300} \le y < 10^{-5}$, but for $a = 10^{10}$ it can be as large as 6e-5.

§See also

  • betainc: Regularized incomplete Beta function $\I_x(a, b)$
  • betainccinv: Inverse of the complement of the regularized incomplete Beta function
  • beta: Beta function $\B(a, b)$
  • gamma: Gamma function $\Gamma(x)$
  • scipy.special.betaincinv: Corresponding function in SciPy

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

  2. Cephes Math Library Release 2.4. ↩

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