NAG FL Interface
g01gdf (prob_​f_​noncentral)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

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

2 Specification

Fortran Interface
Function g01gdf ( f, df1, df2, rlamda, tol, maxit, ifail)
Real (Kind=nag_wp) :: g01gdf
Integer, Intent (In) :: maxit
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: f, df1, df2, rlamda, tol
C Header Interface
#include <nag.h>
double  g01gdf_ (const double *f, const double *df1, const double *df2, const double *rlamda, const double *tol, const Integer *maxit, Integer *ifail)
The routine may be called by the names g01gdf or nagf_stat_prob_f_noncentral.

3 Description

The lower tail probability of the noncentral F-distribution with ν1 and ν2 degrees of freedom and noncentrality parameter λ, P(Ff:ν1,ν2;λ), is defined by
P(Ff:ν1,ν2;λ)=0xp(F:ν1,ν2;λ)dF,  
where
P(F : ν1,ν2;λ )=j= 0e-λ/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(·,·) is the beta function.
The probability is computed by means of a transformation to a noncentral beta distribution:
P(Ff:ν1,ν2;λ)=Pβ(Xx:a,b;λ),  
where x= ν1f ν1f+ν2 and Pβ(Xx:a,b;λ) is the lower tail probability integral of the noncentral beta distribution with parameters a, b, and λ.
If ν2 is very large, greater than 106, then a χ2 approximation is used.

4 References

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

5 Arguments

1: f Real (Kind=nag_wp) Input
On entry: f, the deviate from the noncentral F-distribution.
Constraint: f>0.0.
2: df1 Real (Kind=nag_wp) Input
On entry: the degrees of freedom of the numerator variance, ν1.
Constraint: 0.0<df1106.
3: df2 Real (Kind=nag_wp) Input
On entry: the degrees of freedom of the denominator variance, ν2.
Constraint: df2>0.0.
4: rlamda Real (Kind=nag_wp) Input
On entry: λ, the noncentrality parameter.
Constraint: 0.0rlamda-2.0log(U) where U is the safe range parameter as defined by x02amf.
5: 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 10×machine precision (see x02ajf), the value of 10×machine precision is used instead.
6: maxit Integer Input
On entry: the maximum number of iterations to be used.
Suggested value: 500. See g01gcf and g01gef for further details.
Constraint: maxit1.
7: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of -1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value -1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value -1 is recommended since useful values can be provided in some output arguments even when ifail0 on exit. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
Note: in some cases g01gdf may return useful information.
If on exit ifail=1 or 3, then g01gdf returns 0.0.
ifail=1
On entry, df1=value.
Constraint: 0.0<df1106.
On entry, df1=value.
Constraint: df1>0.0.
On entry, df2=value.
Constraint: df2>0.0.
On entry, f=value.
Constraint: f>0.0.
On entry, maxit=value.
Constraint: maxit1.
On entry, rlamda=value.
Constraint: 0.0rlamda-2.0×log(U), where U is the safe range parameter as defined by x02amf.
ifail=2
The solution has failed to converge in value iterations. Consider increasing maxit or tol.
ifail=3
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).
ifail=4
The required accuracy was not achieved when calculating the initial value of the central F or χ2 probability. You should try a larger value of tol. If the χ2 approximation is being used then g01gdf returns zero otherwise the value returned should be an approximation to the correct value.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface 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

g01gdf is not threaded in any implementation.

9 Further Comments

When both ν1 and ν2 are large a Normal approximation may be used and when only ν1 is large a χ2 approximation may be used. In both cases λ is required to be of the same order as ν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)