gammaInverseCdf

Evaluates the inverse of the gamma distribution function.

Synopsis

gammaInverseCdf (p, a)

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 gammaInverseCdf evaluates the inverse distribution function of a gamma random variable with shape parameter a, that is, it determines x (=gammaInverseCdf (p, a)), such that

\[P = \frac{1}{\mathit{\Gamma}(a)} \int_0^x e^{-t} t^{a-1} dt\]

where Γ(⋅) is the gamma function. In other words:

\[F^{-1}(P|a) = x\]

The probability that the random variable takes a value less than or equal to x is P. See the documentation for function gammaCdf for further discussion of the gamma distribution.

Function gammaInverseCdf uses bisection and modified regula falsi to invert the distribution function, which is evaluated using function gammaCdf.

Example

In this example, we find the 95-th percentage point for a gamma random variable with shape parameter of 4.

from __future__ import print_function
from numpy import *
from pyimsl.stat.gammaInverseCdf import gammaInverseCdf

p = 0.95
a = 4.0
x = gammaInverseCdf(p, a)
print("The 0.05 gamma(4) critical value is %6.4f" % x)

Output

The 0.05 gamma(4) critical value is 7.7537