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_normal (g01fa)

Purpose

nag_stat_inv_cdf_normal (g01fa) returns the deviate associated with the given probability of the standard Normal distribution.

Syntax

[result, ifail] = g01fa(p, 'tail', tail)
[result, ifail] = nag_stat_inv_cdf_normal(p, 'tail', tail)
Note: the interface to this routine has changed since earlier releases of the toolbox:
Mark 23: tail now optional (default 'l')
.

Description

The deviate, xpxp associated with the lower tail probability, pp, for the standard Normal distribution is defined as the solution to
xp
P(Xxp) = p = Z(X)dX,
P(Xxp)=p=-xpZ(X)dX,
where
Z(X) = 1/(sqrt(2π))eX2 / 2,   < X < .
Z(X)=12πe-X2/2,   -<X< .
The method used is an extension of that of Wichura (1988). pp is first replaced by q = p0.5q=p-0.5.
(a) If |q|0.3|q|0.3, xpxp is computed by a rational Chebyshev approximation
xp = s(A(s2))/(B(s2)),
xp=sA(s2) B(s2) ,
where s = sqrt(2π)qs=2πq and AA, BB are polynomials of degree 77.
(b) If 0.3 < |q|0.420.3<|q|0.42, xpxp is computed by a rational Chebyshev approximation
xp = signq ((C(t))/(D(t))) ,
xp=signq (C(t) D(t) ) ,
where t = |q|0.3t=|q|-0.3 and CC, DD are polynomials of degree 55.
(c) If |q| > 0.42|q|>0.42, xpxp is computed as
xp = signq [((E(u))/(F(u))) + u] ,
xp=signq [ (E(u) F(u) )+u] ,
where u = sqrt( 2 × log(min (p,1p)) ) u = -2 × log( min(p,1-p) )  and EE, FF are polynomials of degree 66.
For the upper tail probability xp-xp is returned, while for the two tail probabilities the value xp*xp* is returned, where p*p* is the required tail probability computed from the input value of pp.

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:     p – double scalar
pp, the probability from the standard Normal distribution as defined by tail.
Constraint: 0.0 < p < 1.00.0<p<1.0.

Optional Input Parameters

1:     tail – string (length ≥ 1)
Indicates which tail the supplied probability represents.
tail = 'L'tail='L'
The lower probability, i.e., P(Xxp)P(Xxp).
tail = 'U'tail='U'
The upper probability, i.e., P(Xxp)P(Xxp).
tail = 'S'tail='S'
The two tail (significance level) probability, i.e., P(X|xp|) + P(X|xp|)P(X|xp|)+P(X-|xp|).
tail = 'C'tail='C'
The two tail (confidence interval) probability, i.e., P(X|xp|)P(X|xp|)P(X|xp|)-P(X-|xp|).
Default: 'L''L'
Constraint: tail = 'L'tail='L', 'U''U', 'S''S' or 'C''C'.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

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

Error Indicators and Warnings

Errors or warnings detected by the function:
If on exit ifail0ifail0, then nag_stat_inv_cdf_normal (g01fa) returns 0.00.0.
  ifail = 1ifail=1
On entry,tail'L'tail'L', 'U''U', 'S''S' or 'C''C'.
  ifail = 2ifail=2
On entry,p0.0p0.0,
orp1.0p1.0.

Accuracy

The accuracy is mainly limited by the machine precision.

Further Comments

None.

Example

function nag_stat_inv_cdf_normal_example
p = 0.975;
[result, ifail] = nag_stat_inv_cdf_normal(p)
 

result =

    1.9600


ifail =

                    0


function g01fa_example
p = 0.975;
[result, ifail] = g01fa(p)
 

result =

    1.9600


ifail =

                    0



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–2013