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$ 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, ${f}_{p}$, associated with the lower tail probability, $p$, of the $F$-distribution with degrees of freedom ${\nu }_{1}$ and ${\nu }_{2}$ is defined as the solution to
 $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 ${\nu }_{1},{\nu }_{2}>0$; $0\le {f}_{p}<\infty$.
The value of ${f}_{p}$ is computed by means of a transformation to a beta distribution, ${P}_{\beta }\left(B\le \beta :a,b\right)$:
 $PF≤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 ${\nu }_{1}$ and ${\nu }_{2}$, greater than ${10}^{5}$, a normal approximation is used. If only one of ${\nu }_{1}$ or ${\nu }_{2}$ is greater than ${10}^{5}$ then a ${\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:     $\mathrm{p}$ – double scalar
$p$, the lower tail probability from the required $F$-distribution.
Constraint: $0.0\le {\mathbf{p}}<1.0$.
2:     $\mathrm{df1}$ – double scalar
The degrees of freedom of the numerator variance, ${\nu }_{1}$.
Constraint: ${\mathbf{df1}}>0.0$.
3:     $\mathrm{df2}$ – double scalar
The degrees of freedom of the denominator variance, ${\nu }_{2}$.
Constraint: ${\mathbf{df2}}>0.0$.

None.

### Output Parameters

1:     $\mathrm{result}$ – double scalar
The result of the function.
2:     $\mathrm{ifail}$int64int32nag_int scalar
${\mathbf{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}}$, ${\mathbf{2}}$ or ${\mathbf{4}}$, then nag_stat_inv_cdf_f (g01fd) returns $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.

${\mathbf{ifail}}=1$
 On entry, ${\mathbf{p}}<0.0$, or ${\mathbf{p}}\ge 1.0$.
${\mathbf{ifail}}=2$
 On entry, ${\mathbf{df1}}\le 0.0$, or ${\mathbf{df2}}\le 0.0$.
W  ${\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 argument tol.
${\mathbf{ifail}}=4$
The value of p is too close to $0$ or $1$ for the value of ${f}_{p}$ to be computed. This will only occur when the large sample approximations are used.
${\mathbf{ifail}}=-99$
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.

## 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 Description.

## Example

This example reads the lower tail probabilities for several $F$-distributions, and calculates and prints the corresponding deviates until the end of data is reached.
```function g01fd_example

fprintf('g01fd example results\n\n');

p   = [ 0.9837  0.9000   0.5342];
df1 = [10       1       20.25  ];
df2 = [25.5     1        1     ];
fp  = p;

fprintf('     p      df1     df2      f_p\n');
for j = 1:numel(p)
[fp(j), ifail] = g01fd( ...
p(j), df1(j), df2(j));
end

fprintf('%8.3f%8.3f%8.3f%8.3f\n', [p; df1; df2; fp]);

```
```g01fd example results

p      df1     df2      f_p
0.984  10.000  25.500   2.837
0.900   1.000   1.000  39.863
0.534  20.250   1.000   2.500
```

Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015