# NAG CL Interfaceg01gdc (prob_​f_​noncentral)

Settings help

CL Name Style:

## 1Purpose

g01gdc returns the probability associated with the lower tail of the noncentral $F$ or variance-ratio distribution.

## 2Specification

 #include
 double g01gdc (double f, double df1, double df2, double lambda, double tol, Integer max_iter, NagError *fail)
The function may be called by the names: g01gdc, nag_stat_prob_f_noncentral or nag_prob_non_central_f_dist.

## 3Description

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
 $P(F≤f:ν1,ν2;λ)=∫0xp(F:ν1,ν2;λ)dF,$
where
 $P(F : ν1,ν2;λ )=∑j= 0∞e-λ/2 (λ/2)jj! ×(ν1+2j)(ν1+2j)/2 ν2ν2/2 B((ν1+2j)/2,ν2/2)$
 $×u(ν1+2j-2)/2[ν2+(ν1+2j)u] -(ν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:
 $P(F≤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.

## 4References

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

## 5Arguments

1: $\mathbf{f}$double Input
On entry: $f$, the deviate from the noncentral $F$-distribution.
Constraint: ${\mathbf{f}}>0.0$.
2: $\mathbf{df1}$double Input
On entry: the degrees of freedom of the numerator variance, ${\nu }_{1}$.
Constraint: $0.0<{\mathbf{df1}}\le {10}^{6}$.
3: $\mathbf{df2}$double Input
On entry: the degrees of freedom of the denominator variance, ${\nu }_{2}$.
Constraint: ${\mathbf{df2}}>0.0$.
4: $\mathbf{lambda}$double Input
On entry: $\lambda$, the noncentrality parameter.
Constraint: $0.0\le {\mathbf{lambda}}\le -2.0\mathrm{log}\left(U\right)$ where $U$ is the safe range parameter as defined by X02AMC.
5: $\mathbf{tol}$double Input
On entry: the relative accuracy required by you in the results. If g01gdc is entered with tol greater than or equal to $1.0$ or less than (see X02AJC), the value of is used instead.
6: $\mathbf{max_iter}$Integer Input
On entry: the maximum number of iterations to be used.
Suggested value: $500$. See g01gcc and g01gec for further details.
Constraint: ${\mathbf{max_iter}}\ge 1$.
7: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

If on exit ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_INT_ARG_LT, NE_PROB_F, NE_REAL_ARG_CONS or NE_REAL_ARG_LE, then g01gdc returns $0.0$.
NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_CONV
The solution has failed to converge in $⟨\mathit{\text{value}}⟩$ iterations. Consider increasing max_iter or tol.
NE_INT_ARG_LT
On entry, ${\mathbf{max_iter}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{max_iter}}\ge 1$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_PROB_F
The required probability cannot be computed accurately. This may happen if the result would be very close to zero or one. 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).
NE_PROB_F_INIT
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 g01gdc returns zero otherwise the value returned should be an approximation to the correct value.
NE_REAL_ARG_CONS
On entry, ${\mathbf{df1}}=⟨\mathit{\text{value}}⟩$.
Constraint: $0.0<{\mathbf{df1}}\le {10}^{6}$.
On entry, ${\mathbf{df1}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{df1}}>0.0$.
On entry, ${\mathbf{lambda}}=⟨\mathit{\text{value}}⟩$.
Constraint: $0.0\le {\mathbf{lambda}}\le -2.0×\mathrm{log}\left(U\right)$, where $U$ is the safe range parameter as defined by X02AMC.
NE_REAL_ARG_LE
On entry, ${\mathbf{df2}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{df2}}>0.0$.
On entry, ${\mathbf{f}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{f}}>0.0$.

## 7Accuracy

The relative accuracy should be as specified by tol. For further details see g01gcc and g01gec.

## 8Parallelism and Performance

g01gdc is not threaded in any implementation.

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.

## 10Example

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.1Program Text

Program Text (g01gdce.c)

### 10.2Program Data

Program Data (g01gdce.d)

### 10.3Program Results

Program Results (g01gdce.r)