hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_stat_inv_cdf_f (g01fd)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

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, fp, associated with the lower tail probability, p, of the F-distribution with degrees of freedom ν1 and ν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 ν1,ν2>0; 0fp<.
The value of fp is computed by means of a transformation to a beta distribution, PβBβ:a,b:
PFf:ν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 and ν2, greater than 105, a normal approximation is used. If only one of ν1 or ν2 is greater than 105 then a χ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, the lower tail probability from the required F-distribution.
Constraint: 0.0p<1.0.
2:     df1 – double scalar
The degrees of freedom of the numerator variance, ν1.
Constraint: df1>0.0.
3:     df2 – double scalar
The degrees of freedom of the denominator variance, ν2.
Constraint: df2>0.0.

Optional Input Parameters

None.

Output Parameters

1:     result – double scalar
The result of the function.
2:     ifail int64int32nag_int scalar
ifail=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 ifail=1, 2 or 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.

   ifail=1
On entry,p<0.0,
orp1.0.
   ifail=2
On entry,df10.0,
ordf20.0.
W  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.
   ifail=4
The value of p is too close to 0 or 1 for the value of fp to be computed. This will only occur when the large sample approximations are used.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

The result should be accurate to five significant digits.

Further Comments

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

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

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