IMSL_GAMMACDF

Syntax | Return Value | Arguments | Keywords | Discussion | Example | Errors | Version History

The IMSL_GAMMACDF function evaluates the gamma distribution function.

Note
This routine requires an IDL Advanced Math and Stats license. For more information, contact your ITT Visual Information Solutions sales or technical support representative.

Syntax

Result = IMSL_GAMMACDF(x, a [, /DOUBLE] )

Return Value

The probability that a gamma random variable takes a value less than or equal to x.

Arguments

a

Shape parameter of the gamma distribution. This parameter must be positive.

x

Argument for which the gamma distribution function is to be evaluated.

Keywords

DOUBLE

If present and nonzero, double precision is used.

Discussion

The IMSL_GAMMACDF function evaluates the distribution function, F, of a gamma random variable with shape parameter a; that is:

IMSL_GAMMACDF-19.jpg

where Γ(¥) is the gamma function. (The gamma function is the integral from 0 to infinity of the same integrand as above.) The value of the distribution function at the point x is the probability that the random variable takes a value less than or equal to x.

The gamma distribution is often defined as a two-parameter distribution with a scale parameter b (which must be positive) or even as a three-parameter distribution in which the third parameter c is a location parameter. In the most general case, the probability density function over (c, infinity) is as follows:

IMSL_GAMMACDF-20.jpg

If T is such a random variable with parameters a, b, and c, the probability that T t0 can be obtained from IMSL_GAMMACDF by setting x = (t0c ) / b.

If x is less than a or if x is less than or equal to 1.0, IMSL_GAMMACDF uses a series expansion; otherwise, a continued fraction expansion is used. (See Abramowitz and Stegun, 1964.)

Example

Let X be a gamma random variable with a shape parameter of 4. (In this case, it has an Erlang distribution, since the shape parameter is an integer.) This example finds the probability that X is less than 0.5 and the probability that X is between 0.5 and 1.0.

a = 4 
x = .5 
p = IMSL_GAMMACDF(x, a) 
PM, p, Title = 'The probability that X is less ' + $ 
   'than .5 is:' 
 
The probability that X is less than .5 is: 0.00175162 
 
x = 1 
p = IMSL_GAMMACDF(x, a) - p 
PM, p, Title = 'The probability that X is between .5 and 1 is:' 
 
The probability that X is between .5 and 1 is: 0.0172365 

Errors

Informational Errors

STAT_LESS_THAN_ZERO—Input argument, x, is less than zero.

Fatal Errors

STAT_X_AND_A_TOO_LARGE—Function overflows because x and a are too large.

Version History

6.4

Introduced