CNL Stat : Utilities : beta_incomplete
beta_incomplete
Evaluates the real regularized incomplete beta function.
Synopsis
#include <imsls.h>
float imsls_f_beta_incomplete (float x, float a, float b)
The type double function is imsls_d_beta_incomplete.
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 Ix (ab) is defined
where
is the incomplete beta function,
is the (complete) beta function, and is the gamma function.
The regularized incomplete beta function imsls_f_beta_incomplete (x, a, b) is identical to the beta probability distribution function imsls_f_beta_cdf (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 a = b =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.)
 
 
#include <imsls.h>
#include <stdio.h>
 
int main()
{
    float  a = 12, b = 12, x = 0.6, p;
 
    p = imsls_f_beta_incomplete(x, a, b);
    printf("The probability that X is less than %3.1f is "
        "%6.4f\n", x, p);
    x = 0.5;
    p -= imsls_f_beta_incomplete(x, a, b);
    printf("The probability that X is between %3.1f and"
        " 0.6 is %6.4f\n", x, p);
}
Output
 
The probability that X is less than 0.6 is 0.8364
The probability that X is between 0.5 and 0.6 is 0.3364