Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_stat_inv_cdf_f (g01fd)

## Purpose

nag_stat_inv_cdf_f (g01fd) returns the deviate associated with the given lower tail probability of the F$F$ or variance-ratio distribution with real degrees of freedom.

## Syntax

[result, ifail] = g01fd(p, df1, df2)
[result, ifail] = nag_stat_inv_cdf_f(p, df1, df2)

## Description

The deviate, fp${f}_{p}$, associated with the lower tail probability, p$p$, of the F$F$-distribution with degrees of freedom ν1${\nu }_{1}$ and ν2${\nu }_{2}$ is defined as the solution to
 fp P( F ≤ fp : ν1 ,ν2) = p = ( ν1 (1/2) ν1 ν2 (1/2) ν2 Γ (( ν1 + ν2 )/2) )/( Γ ((ν1)/2) Γ ((ν2)/2) ) ∫ F (1/2) (ν1 − 2) (ν2 + ν1F) − (1/2) (ν1 + ν2) dF, 0
$P ( F ≤ fp : ν1 ,ν2) = p = ν 1 12 ν1 ν 2 12 ν2 Γ ( ν1 + ν2 2 ) Γ ( ν1 2 ) Γ ( ν2 2 ) ∫ 0 fp F 12 (ν1-2) ( ν2 + ν1 F ) -12 ( ν1 + ν2 ) dF ,$
where ν1,ν2 > 0${\nu }_{1},{\nu }_{2}>0$; 0fp < $0\le {f}_{p}<\infty$.
The value of fp${f}_{p}$ is computed by means of a transformation to a beta distribution, Pβ(Bβ : a,b)${P}_{\beta }\left(B\le \beta :a,b\right)$:
 P(F ≤ f : ν1,ν2) = Pβ (B ≤ (ν1f)/(ν1f + ν2) : ν1 / 2,ν2 / 2) $P(F≤f:ν1,ν2)=Pβ (B≤ν1f ν1f+ν2 :ν1/2,ν2/2)$
and using a call to nag_stat_inv_cdf_beta (g01fe).
For very large values of both ν1${\nu }_{1}$ and ν2${\nu }_{2}$, greater than 105${10}^{5}$, a normal approximation is used. If only one of ν1${\nu }_{1}$ or ν2${\nu }_{2}$ is greater than 105${10}^{5}$ then a χ2${\chi }^{2}$ approximation is used; see Abramowitz and Stegun (1972).

## References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth

## Parameters

### Compulsory Input Parameters

1:     p – double scalar
p$p$, the lower tail probability from the required F$F$-distribution.
Constraint: 0.0p < 1.0$0.0\le {\mathbf{p}}<1.0$.
2:     df1 – double scalar
The degrees of freedom of the numerator variance, ν1${\nu }_{1}$.
Constraint: df1 > 0.0${\mathbf{df1}}>0.0$.
3:     df2 – double scalar
The degrees of freedom of the denominator variance, ν2${\nu }_{2}$.
Constraint: df2 > 0.0${\mathbf{df2}}>0.0$.

None.

None.

### Output Parameters

1:     result – double scalar
The result of the function.
2:     ifail – int64int32nag_int scalar
${\mathrm{ifail}}={\mathbf{0}}$ unless the function detects an error (see [Error Indicators and Warnings]).

## Error Indicators and Warnings

Note: nag_stat_inv_cdf_f (g01fd) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:
If on exit ${\mathbf{ifail}}={\mathbf{1}}$, 2${\mathbf{2}}$ or 4${\mathbf{4}}$, then nag_stat_inv_cdf_f (g01fd) returns 0.0$0.0$.

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

ifail = 1${\mathbf{ifail}}=1$
 On entry, p < 0.0${\mathbf{p}}<0.0$, or p ≥ 1.0${\mathbf{p}}\ge 1.0$.
ifail = 2${\mathbf{ifail}}=2$
 On entry, df1 ≤ 0.0${\mathbf{df1}}\le 0.0$, or df2 ≤ 0.0${\mathbf{df2}}\le 0.0$.
W ifail = 3${\mathbf{ifail}}=3$
The solution has not converged. The result should still be a reasonable approximation to the solution. Alternatively, nag_stat_inv_cdf_beta (g01fe) can be used with a suitable setting of the parameter tol.
ifail = 4${\mathbf{ifail}}=4$
The value of p is too close to 0$0$ or 1$1$ for the value of fp${f}_{p}$ to be computed. This will only occur when the large sample approximations are used.

## Accuracy

The result should be accurate to five significant digits.

For higher accuracy nag_stat_inv_cdf_beta (g01fe) can be used along with the transformations given in Section [Description].

## Example

```function nag_stat_inv_cdf_f_example
p = 0.9837;
df1 = 10;
df2 = 25.5;
[result, ifail] = nag_stat_inv_cdf_f(p, df1, df2)
```
```

result =

2.8366

ifail =

0

```
```function g01fd_example
p = 0.9837;
df1 = 10;
df2 = 25.5;
[result, ifail] = g01fd(p, df1, df2)
```
```

result =

2.8366

ifail =

0

```