Skip to content

betainc

specfun · scripts/specfun/betainc.m

: i = betainc (x, a, b)
: i = betainc (x, a, b, tail)

Regularized incomplete beta function I_x(a,b) = 1/B(a,b) * integral_0^x t^(a-1) (1-t)^(b-1) dt.

tail is "lower" (default) or "upper"; the upper tail 1 - I_x(a,b) is evaluated without cancellation. x must lie in [0, 1], a and b must be non-negative; the arguments must have the same size or be scalars. The result is single if any argument is single.

For parameters below 12 a continued fraction is used; for larger parameters the integral is evaluated by Gauss-Legendre quadrature anchored at x, which stays accurate for arbitrarily large parameters.