gamma_inverse_cdf
Evaluates the inverse of the gamma distribution function.
Synopsis
#include <imsls.h>
float imsls_f_gamma_inverse_cdf (float p, float a)
The type double function is imsls_d_gamma_inverse_cdf.
Required Arguments
float p (Input)
Probability for which the inverse of the gamma distribution function is to be evaluated. p must be in the open interval (0.0, 1.0).
float a (Input)
The shape parameter of the gamma distribution. This parameter must be positive.
Return Value
The probability that a gamma random variable takes a value less than or equal to the returned value is p.
Description
Function imsls_f_gamma_inverse_cdf evaluates the inverse distribution function of a gamma random variable with shape parameter a, that is, it determines x (=imsls_f_gamma_inverse_cdf (p, a)), such that
where Γ(⋅) is the gamma function. In other words:
The probability that the random variable takes a value less than or equal to
x is
P. See the documentation for function
imsls_f_gamma_cdf for further discussion of the gamma distribution.
Function imsls_f_gamma_inverse_cdf uses bisection and modified regula falsi to invert the distribution function, which is evaluated using function imsls_f_gamma_cdf.
Example
In this example, we find the 95-th percentage point for a gamma random variable with shape parameter of 4.
#include <imsls.h>
#include <stdio.h>
int main()
{
float p = .95, a = 4.0, x;
x = imsls_f_gamma_inverse_cdf(p,a);
printf("The %4.2f gamma(%1.0f) critical value is %6.4f\n",
1.0 - p, a, x);
}
Output
The 0.05 gamma(4) critical value is 7.7537