PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_stat_inv_cdf_f_vector (g01td)
Purpose
nag_stat_inv_cdf_f_vector (g01td) returns a number of deviates associated with given probabilities of the or variance-ratio distribution with real degrees of freedom.
Syntax
[
f,
ivalid,
ifail] = g01td(
tail,
p,
df1,
df2, 'ltail',
ltail, 'lp',
lp, 'ldf1',
ldf1, 'ldf2',
ldf2)
[
f,
ivalid,
ifail] = nag_stat_inv_cdf_f_vector(
tail,
p,
df1,
df2, 'ltail',
ltail, 'lp',
lp, 'ldf1',
ldf1, 'ldf2',
ldf2)
Description
The deviate,
, associated with the lower tail probability,
, of the
-distribution with degrees of freedom
and
is defined as the solution to
where
;
.
The value of
is computed by means of a transformation to a beta distribution,
:
and using a call to
nag_stat_inv_cdf_beta_vector (g01te).
For very large values of both
and
, greater than
, a Normal approximation is used. If only one of
or
is greater than
then a
approximation is used; see
Abramowitz and Stegun (1972).
The input arrays to this function are designed to allow maximum flexibility in the supply of vector arguments by re-using elements of any arrays that are shorter than the total number of evaluations required. See
Vectorized Routines in the G01 Chapter Introduction for further information.
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:
– cell array of strings
-
Indicates which tail the supplied probabilities represent. For
, for
:
- The lower tail probability, i.e., .
- The upper tail probability, i.e., .
Constraint:
or , for .
- 2:
– double array
-
, the probability of the required
-distribution as defined by
tail with
,
.
Constraints:
- if , ;
- otherwise .
Where and .
- 3:
– double array
-
, the degrees of freedom of the numerator variance with , .
Constraint:
, for .
- 4:
– double array
-
, the degrees of freedom of the denominator variance with , .
Constraint:
, for .
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the array
tail.
The length of the array
tail.
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the dimension of the array
p.
The length of the array
p.
Constraint:
.
- 3:
– int64int32nag_int scalar
-
Default:
the dimension of the array
df1.
The length of the array
df1.
Constraint:
.
- 4:
– int64int32nag_int scalar
-
Default:
the dimension of the array
df2.
The length of the array
df2.
Constraint:
.
Output Parameters
- 1:
– double array
-
The dimension of the array
f will be
, the deviates for the -distribution.
- 2:
– int64int32nag_int array
-
The dimension of the array
ivalid will be
indicates any errors with the input arguments, with
- No error.
On entry, | invalid value supplied in tail when calculating . |
On entry, | invalid value for . |
On entry, | , |
or | . |
- The solution has not converged. The result should still be a reasonable approximation to the solution.
- The value of is too close to or for the result to be computed. This will only occur when the large sample approximations are used.
- 3:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Note: nag_stat_inv_cdf_f_vector (g01td) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
- W
-
On entry, at least one value of
tail,
p,
df1,
df2 was invalid, or the solution failed to converge.
Check
ivalid for more information.
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
The result should be accurate to five significant digits.
Further Comments
For higher accuracy
nag_stat_inv_cdf_beta_vector (g01te) can be used along with the transformations given in
Description.
Example
This example reads the lower tail probabilities for several -distributions, and calculates and prints the corresponding deviates.
Open in the MATLAB editor:
g01td_example
function g01td_example
fprintf('g01td example results\n\n');
tail = {'L'};
p = [0.984; 0.9; 0.534];
df1 = [10; 1; 20.25];
df2 = [25.5; 1; 1];
[f, ivalid, ifail] = g01td( ...
tail, p, df1, df2);
fprintf(' tail p df1 df2 f ivalid\n');
ltail = numel(tail);
lp = numel(p);
ldf1 = numel(df1);
ldf2 = numel(df2);
len = max ([ltail, lp, ldf1, ldf2]);
for i=0:len-1
fprintf('%5s%7.3f%8.3f%8.3f%8.3f%7d\n', tail{mod(i, ltail)+1}, ...
p(mod(i,lp)+1), df1(mod(i,ldf1)+1), df2(mod(i,ldf2)+1), ...
f(i+1), ivalid(i+1));
end
g01td example results
tail p df1 df2 f ivalid
L 0.984 10.000 25.500 2.847 0
L 0.900 1.000 1.000 39.863 0
L 0.534 20.250 1.000 2.498 0
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015