g01ef returns the lower or upper tail probability of the gamma distribution, with parameters α and β.

Syntax

C#
public static double g01ef(
	string tail,
	double g,
	double a,
	double b,
	out int ifail
)
Visual Basic
Public Shared Function g01ef ( _
	tail As String, _
	g As Double, _
	a As Double, _
	b As Double, _
	<OutAttribute> ByRef ifail As Integer _
) As Double
Visual C++
public:
static double g01ef(
	String^ tail, 
	double g, 
	double a, 
	double b, 
	[OutAttribute] int% ifail
)
F#
static member g01ef : 
        tail : string * 
        g : float * 
        a : float * 
        b : float * 
        ifail : int byref -> float 

Parameters

tail
Type: System..::..String
On entry: indicates whether an upper or lower tail probability is required.
tail="L"
The lower tail probability is returned, that is PGg:α,β.
tail="U"
The upper tail probability is returned, that is PGg:α,β.
Constraint: tail="L" or "U".
g
Type: System..::..Double
On entry: g, the value of the gamma variate.
Constraint: g0.0.
a
Type: System..::..Double
On entry: the parameter α of the gamma distribution.
Constraint: a>0.0.
b
Type: System..::..Double
On entry: the parameter β of the gamma distribution.
Constraint: b>0.0.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Return Value

g01ef returns the lower or upper tail probability of the gamma distribution, with parameters α and β.

Description

The lower tail probability for the gamma distribution with parameters α and β, PGg, is defined by:
PGg;α,β=1βαΓα0gGα-1e-G/βdG,  α>0.0, ​β>0.0.
The mean of the distribution is αβ and its variance is αβ2. The transformation Z=Gβ is applied to yield the following incomplete gamma function in normalized form,
PGg;α,β=PZg/β:α,1.0=1Γα0g/βZα-1e-ZdZ.
This is then evaluated using s14ba.

References

Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth

Error Indicators and Warnings

Errors or warnings detected by the method:
If ifail=123 or 4 on exit, then g01ef returns 0.0.
ifail=1
On entry,tail"L" or "U".
ifail=2
On entry,g<0.0.
ifail=3
On entry,a0.0,
orb0.0.
ifail=4
The solution did not converge in 600 iterations. See s14ba. The probability returned should be a reasonable approximation to the solution.
ifail=-9000
An error occured, see message report.

Accuracy

The result should have a relative accuracy of machine precision. There are rare occasions when the relative accuracy attained is somewhat less than machine precision but the error should not exceed more than 1 or 2 decimal places. Note also that there is a limit of 18 decimal places on the achievable accuracy, because constants in s14ba are given to this precision.

Parallelism and Performance

None.

Further Comments

The time taken by g01ef varies slightly with the input parameters g, a and b.

Example

This example reads in values from a number of gamma distributions and computes the associated lower tail probabilities.

Example program (C#): g01efe.cs

Example program data: g01efe.d

Example program results: g01efe.r

See Also