PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_stat_inv_cdf_normal_vector (g01ta)
Purpose
nag_stat_inv_cdf_normal_vector (g01ta) returns a number of deviates associated with given probabilities of the Normal distribution.
Syntax
[
x,
ivalid,
ifail] = g01ta(
tail,
p,
xmu,
xstd, 'ltail',
ltail, 'lp',
lp, 'lxmu',
lxmu, 'lxstd',
lxstd)
[
x,
ivalid,
ifail] = nag_stat_inv_cdf_normal_vector(
tail,
p,
xmu,
xstd, 'ltail',
ltail, 'lp',
lp, 'lxmu',
lxmu, 'lxstd',
lxstd)
Description
The deviate,
associated with the lower tail probability,
, for the Normal distribution is defined as the solution to
where
The method used is an extension of that of
Wichura (1988).
is first replaced by
.
(a) |
If , is computed by a rational Chebyshev approximation
where and , are polynomials of degree . |
(b) |
If , is computed by a rational Chebyshev approximation
where and , are polynomials of degree . |
(c) |
If , is computed as
where and , are polynomials of degree . |
is then calculated from , using the relationsship .
For the upper tail probability is returned, while for the two tail probabilities the value is returned, where is the required tail probability computed from the input value of .
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
Wichura (1988) Algorithm AS 241: the percentage points of the Normal distribution Appl. Statist. 37 477–484
Parameters
Compulsory Input Parameters
- 1:
– cell array of strings
-
Indicates which tail the supplied probabilities represent. Letting
denote a variate from a standard Normal distribution, and
, then for
, for
:
- The lower tail probability, i.e., .
- The upper tail probability, i.e., .
- The two tail (confidence interval) probability, i.e., .
- The two tail (significance level) probability, i.e., .
Constraint:
, , or , for .
- 2:
– double array
-
, the probabilities for the Normal distribution as defined by
tail with
,
.
Constraint:
, for .
- 3:
– double array
-
, the means with , .
- 4:
– double array
-
, the standard deviations 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
xmu.
The length of the array
xmu.
Constraint:
.
- 4:
– int64int32nag_int scalar
-
Default:
the dimension of the array
xstd.
The length of the array
xstd.
Constraint:
.
Output Parameters
- 1:
– double array
-
The dimension of the array
x will be
, the deviates for the Normal 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, | , |
or | . |
-
- 3:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and 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,
xstd or
p was invalid.
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 accuracy is mainly limited by the
machine precision.
Further Comments
None.
Example
This example reads vectors of values for , and and prints the corresponding deviates.
Open in the MATLAB editor:
g01ta_example
function g01ta_example
fprintf('g01ta example results\n\n');
p = [0.9750; 0.0250; 0.9500; 0.0500];
xmu = [0; 0; 0; 0];
xstd = [1; 1; 1; 1];
tail = {'L'; 'U'; 'C'; 'S'};
[dev, ivalid, ifail] = g01ta( ...
tail, p, xmu, xstd);
fprintf('tail p xmu xstd deviate\n');
lp = numel(p);
lxmu = numel(xmu);
lxstd = numel(xstd);
ltail = numel(tail);
len = max ([lp, lxmu, lxstd, ltail]);
for i=0:len-1
fprintf(' %c%11.3f%16.4f%8.3f%13.6f\n', tail{mod(i,ltail)+1}, ...
p(mod(i,lp)+1), xmu(mod(i,lxmu)+1), xstd(mod(i,lxstd)+1), dev(i+1));
end
g01ta example results
tail p xmu xstd deviate
L 0.975 0.0000 1.000 1.959964
U 0.025 0.0000 1.000 1.959964
C 0.950 0.0000 1.000 1.959964
S 0.050 0.0000 1.000 1.959964
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015