G01 Chapter Contents
G01 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentG01GDF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

G01GDF returns the probability associated with the lower tail of the noncentral $F$ or variance-ratio distribution, via the routine name.

## 2  Specification

 FUNCTION G01GDF ( F, DF1, DF2, RLAMDA, TOL, MAXIT, IFAIL)
 REAL (KIND=nag_wp) G01GDF
 INTEGER MAXIT, IFAIL REAL (KIND=nag_wp) F, DF1, DF2, RLAMDA, TOL

## 3  Description

The lower tail probability of the noncentral $F$-distribution with ${\nu }_{1}$ and ${\nu }_{2}$ degrees of freedom and noncentrality parameter $\lambda$, $P\left(F\le f:{\nu }_{1},{\nu }_{2}\text{;}\lambda \right)$, is defined by
 $PF≤f:ν1,ν2;λ=∫0xpF:ν1,ν2;λdF,$
where
 $PF : ν1,ν2;λ =∑j= 0∞e-λ/2 λ/2jj! ×ν1+ 2jν1+ 2j/2 ν2ν2/2 Bν1+ 2j/2,ν2/2$
 $×uν1+2j-2/2ν2+ν1+2ju -ν1+2j+ν2/2$
and $B\left(·,·\right)$ is the beta function.
The probability is computed by means of a transformation to a noncentral beta distribution:
 $PF≤f:ν1,ν2;λ=PβX≤x:a,b;λ,$
where $x=\frac{{\nu }_{1}f}{{\nu }_{1}f+{\nu }_{2}}$ and ${P}_{\beta }\left(X\le x:a,b\text{;}\lambda \right)$ is the lower tail probability integral of the noncentral beta distribution with parameters $a$, $b$, and $\lambda$.
If ${\nu }_{2}$ is very large, greater than ${10}^{6}$, then a ${\chi }^{2}$ approximation is used.

## 4  References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications

## 5  Parameters

1:     $\mathrm{F}$ – REAL (KIND=nag_wp)Input
On entry: $f$, the deviate from the noncentral $F$-distribution.
Constraint: ${\mathbf{F}}>0.0$.
2:     $\mathrm{DF1}$ – REAL (KIND=nag_wp)Input
On entry: the degrees of freedom of the numerator variance, ${\nu }_{1}$.
Constraint: $0.0<{\mathbf{DF1}}\le {10}^{6}$.
3:     $\mathrm{DF2}$ – REAL (KIND=nag_wp)Input
On entry: the degrees of freedom of the denominator variance, ${\nu }_{2}$.
Constraint: ${\mathbf{DF2}}>0.0$.
4:     $\mathrm{RLAMDA}$ – REAL (KIND=nag_wp)Input
On entry: $\lambda$, the noncentrality parameter.
Constraint: $0.0\le {\mathbf{RLAMDA}}\le -2.0\mathrm{log}\left(U\right)$ where $U$ is the safe range parameter as defined by X02AMF.
5:     $\mathrm{TOL}$ – REAL (KIND=nag_wp)Input
On entry: the relative accuracy required by you in the results. If G01GDF is entered with TOL greater than or equal to $1.0$ or less than  (see X02AJF), then the value of  is used instead.
6:     $\mathrm{MAXIT}$ – INTEGERInput
On entry: the maximum number of iterations to be used.
Suggested value: $500$. See G01GCF and G01GEF for further details.
Constraint: ${\mathbf{MAXIT}}\ge 1$.
7:     $\mathrm{IFAIL}$ – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if ${\mathbf{IFAIL}}\ne {\mathbf{0}}$ on exit, the recommended value is $-1$. When the value $-\mathbf{1}\text{​ or ​}1$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Note: G01GDF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
If on exit ${\mathbf{IFAIL}}={\mathbf{1}}$ or ${\mathbf{3}}$, then G01GDF returns $0.0$.
${\mathbf{IFAIL}}=1$
 On entry, ${\mathbf{DF1}}\le 0.0$, or ${\mathbf{DF1}}>{10}^{6}$, or ${\mathbf{DF2}}\le 0.0$, or ${\mathbf{F}}\le 0.0$, or ${\mathbf{RLAMDA}}<0.0$, or ${\mathbf{MAXIT}}<1$, or ${\mathbf{RLAMDA}}>-2.0\mathrm{log}\left(U\right)$, where $U=\text{}$ safe range parameter as defined by X02AMF.
${\mathbf{IFAIL}}=2$
The solution has failed to converge in MAXIT iterations. You should try a larger value of MAXIT or TOL.
${\mathbf{IFAIL}}=3$
The required probability cannot be computed accurately. This may happen if the result would be very close to $0.0$ or $1.0$. Alternatively the values of DF1 and F may be too large. In the latter case you could try using a normal approximation; see Abramowitz and Stegun (1972).
${\mathbf{IFAIL}}=4$
The required accuracy was not achieved when calculating the initial value of the central $F$ (or ${\chi }^{2}$) probability. You should try a larger value of TOL. If the ${\chi }^{2}$ approximation is being used then G01GDF returns zero otherwise the value returned should be an approximation to the correct value.
${\mathbf{IFAIL}}=-99$
See Section 3.8 in the Essential Introduction for further information.
${\mathbf{IFAIL}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
${\mathbf{IFAIL}}=-999$
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

## 7  Accuracy

The relative accuracy should be as specified by TOL. For further details see G01GCF and G01GEF.

## 8  Parallelism and Performance

Not applicable.

When both ${\nu }_{1}$ and ${\nu }_{2}$ are large a Normal approximation may be used and when only ${\nu }_{1}$ is large a ${\chi }^{2}$ approximation may be used. In both cases $\lambda$ is required to be of the same order as ${\nu }_{1}$. See Abramowitz and Stegun (1972) for further details.

## 10  Example

This example reads values from, and degrees of freedom for, $F$-distributions, computes the lower tail probabilities and prints all these values until the end of data is reached.

### 10.1  Program Text

Program Text (g01gdfe.f90)

### 10.2  Program Data

Program Data (g01gdfe.d)

### 10.3  Program Results

Program Results (g01gdfe.r)