betaIncomplete

Evaluates the real regularized incomplete beta function.

Synopsis

betaIncomplete (x, a, b)

Required Arguments

float x (Input)
Argument at which the regularized incomplete beta function is to be evaluated.
float a (Input)
First shape parameter.
float b (Input)
Second shape parameter.

Return Value

The value of the regularized incomplete beta function.

Description

The regularized incomplete beta function \(I_x(a,b)\) is defined

\[I_x(a,b) = B_x(a,b) / B(a,b)\]

where

\[B_x(a,b) = \int_0^x t^{a-1} (1-t)^{b-1} dt\]

is the incomplete beta function,

\[B(a,b) = B_1(a,b) = \frac{\mathit{\Gamma}(a) \mathit{\Gamma}(b)}{\mathit{\Gamma}(a+b)}\]

is the (complete) beta function, and \(\mathit{\Gamma} (a)\) is the gamma function.

The regularized incomplete beta function betaIncomplete (x, a, b) is identical to the beta probability distribution function betaCdf (x, a, b) which represents the probability that a beta random variable X with shape parameters a and b takes on a value less than or equal to x. The regularized incomplete beta function requires that 0 ≤ x ≤ 1, a > 0, and b > 0 and it underflows for sufficiently small x and large a. This underflow is not reported as an error. Instead, the value zero is returned.

Example

Suppose X is a beta random variable with shape parameters 12 and 12 (X has a symmetric distribution). This example finds the probability that X is less than 0.6 and the probability that X is between 0.5 and 0.6. (Since X is a symmetric beta random variable, the probability that it is less than 0.5 is 0.5.)

from __future__ import print_function
from numpy import *
from pyimsl.math.betaIncomplete import betaIncomplete

x = 0.5
a = 0.2
b = 1.0
ans = betaIncomplete(x, a, b)
print("betaIncomplete(%f,%f,%f) = %f" % (x, a, b, ans))

Output

betaIncomplete(0.500000,0.200000,1.000000) = 0.870551