NAG CL Interface
g01fac (inv_​cdf_​normal)

1 Purpose

g01fac returns the deviate associated with the given probability of the standard Normal distribution.

2 Specification

#include <nag.h>
double  g01fac (Nag_TailProbability tail, double p, NagError *fail)
The function may be called by the names: g01fac, nag_stat_inv_cdf_normal or nag_deviates_normal.

3 Description

The deviate, xp associated with the lower tail probability, p, for the standard Normal distribution is defined as the solution to
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.
  1. (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.
  2. (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.
  3. (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

NIST Digital Library of Mathematical Functions
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 Arguments

1: tail Nag_TailProbability Input
On entry: indicates which tail the supplied probability represents.
The lower probability, i.e., PXxp.
The upper probability, i.e., PXxp.
The two tail (significance level) probability, i.e., PXxp+PX-xp.
The two tail (confidence interval) probability, i.e., PXxp-PX-xp.
Constraint: tail=Nag_LowerTail, Nag_UpperTail, Nag_TwoTailSignif or Nag_TwoTailConfid.
2: p double Input
On entry: p, the probability from the standard Normal distribution as defined by tail.
Constraint: 0.0<p<1.0.
3: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

If on exit fail.code= NE_NOERROR, then g01fac returns 0.0.
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument value had an illegal value.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
On entry, p=value.
Constraint: p<1.0.
On entry, p=value.
Constraint: p>0.0.

7 Accuracy

The accuracy is mainly limited by the machine precision.

8 Parallelism and Performance

g01fac is not threaded in any implementation.

9 Further Comments


10 Example

Four values of tail and p are input and the deviates calculated and printed.

10.1 Program Text

Program Text (g01face.c)

10.2 Program Data

Program Data (g01face.d)

10.3 Program Results

Program Results (g01face.r)