G01FAF (PDF version)
G01 Chapter Contents
G01 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

G01FAF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

G01FAF returns the deviate associated with the given probability of the standard Normal distribution, via the routine name.

2  Specification

FUNCTION G01FAF ( TAIL, P, IFAIL)
REAL (KIND=nag_wp) G01FAF
INTEGER  IFAIL
REAL (KIND=nag_wp)  P
CHARACTER(1)  TAIL

3  Description

The deviate, xp associated with the lower tail probability, p, for the standard Normal distribution is defined as the solution to
PXxp=p=-xpZXdX,
where
ZX=12πe-X2/2,   -<X< .
The method used is an extension of that of Wichura (1988). p is first replaced by q=p-0.5.
(a) If q0.3, xp is computed by a rational Chebyshev approximation
xp=sAs2 Bs2 ,
where s=2πq and A, B are polynomials of degree 7.
(b) If 0.3<q0.42, xp is computed by a rational Chebyshev approximation
xp=signq Ct Dt ,
where t=q-0.3 and C, D are polynomials of degree 5.
(c) If q>0.42, xp is computed as
xp=signq Eu Fu +u ,
where u = -2 × log minp,1-p  and E, F are polynomials of degree 6.
For the upper tail probability -xp is returned, while for the two tail probabilities the value xp* is returned, where p* is the required tail probability computed from the input value of p.

4  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

5  Parameters

1:     TAIL – CHARACTER(1)Input
On entry: indicates which tail the supplied probability represents.
TAIL='L'
The lower probability, i.e., PXxp.
TAIL='U'
The upper probability, i.e., PXxp.
TAIL='S'
The two tail (significance level) probability, i.e., PXxp+PX-xp.
TAIL='C'
The two tail (confidence interval) probability, i.e., PXxp-PX-xp.
Constraint: TAIL='L', 'U', 'S' or 'C'.
2:     P – REAL (KIND=nag_wp)Input
On entry: p, the probability from the standard Normal distribution as defined by TAIL.
Constraint: 0.0<P<1.0.
3:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
If on exit IFAIL0, then G01FAF returns 0.0.
IFAIL=1
On entry,TAIL'L', 'U', 'S' or 'C'.
IFAIL=2
On entry,P0.0,
orP1.0.

7  Accuracy

The accuracy is mainly limited by the machine precision.

8  Further Comments

None.

9  Example

Four values of TAIL and P are input and the deviates calculated and printed.

9.1  Program Text

Program Text (g01fafe.f90)

9.2  Program Data

Program Data (g01fafe.d)

9.3  Program Results

Program Results (g01fafe.r)


G01FAF (PDF version)
G01 Chapter Contents
G01 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012