nag_deviates_normal_dist (g01cec) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG C Library Manual

NAG Library Function Documentnag_deviates_normal_dist (g01cec)

1  Purpose

nag_deviates_normal_dist (g01cec) returns the deviate, ${x}_{p}$, associated with the given lower tail probability, $p$, of the standardized Normal distribution.

2  Specification

 #include #include
 double nag_deviates_normal_dist (double p, NagError *fail)

3  Description

${x}_{p}$ is calculated for the given $p$ such that
 $p = 1 2π ∫ -∞ x p e - u 2 / 2 du -∞ < x p < ∞ .$
The method used is an extension of that of Wichura (1988). $p$ is first replaced by $q=p-0.5$.
(a) If $\left|q\right|\le 0.3$, ${x}_{p}$ is computed by a rational Chebyshev approximation
 $x p = s A s 2 B s 2$
where $s=\sqrt{2\pi }q$ and $A$, $B$ are polynomials of degree 7.
(b) If $0.3<\left|q\right|\le 0.42$, ${x}_{p}$ is computed by a rational Chebyshev approximation
 $x p = sign⁡q C t D t$
where $t=\left|q\right|-0.3$ and $C$, $D$ are polynomials of degree 5.
(c) If $\left|q\right|>0.42$, ${x}_{p}$ is computed as
 $x p = sign⁡q E u F u + u$
where $u=\sqrt{-2\mathrm{log}\left(\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(p,1-p\right)\right)}$ and $E$, $F$ are polynomials of degree 6.

4  References

Wichura (1988) Algorithm AS 241: the percentage points of the Normal distribution Appl. Statist. 37 477–484

5  Arguments

1:     pdoubleInput
On entry: the probability, $p$, from the standardized Normal distribution.
Constraint: $0.0<{\mathbf{p}}<1.0$.
2:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_INTERNAL_ERROR
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.
NE_REAL_ARG_GE
On entry, p must not be greater than or equal to $1.0$: ${\mathbf{p}}=〈\mathit{\text{value}}〉$.
NE_REAL_ARG_LE
On entry, p must not be less than or equal to $0.0$: ${\mathbf{p}}=〈\mathit{\text{value}}〉$.

7  Accuracy

nag_deviates_normal_dist (g01cec) attempts to attain a relative precision of $5.0×{10}^{-13}$.

8  Further Comments

If $X$ is a Normal random variable with mean $\mu$ and variance ${\sigma }^{2}$, the deviate corresponding to a lower tail probability of $p$ is $\mu +\sigma {x}_{p}$, where ${x}_{p}$ is the standardized Normal deviate returned by nag_deviates_normal_dist (g01cec).

9  Example

The deviates corresponding to several lower tail probabilities from the standard Normal distribution are calculated and printed.

9.1  Program Text

Program Text (g01cece.c)

None.

9.3  Program Results

Program Results (g01cece.r)

nag_deviates_normal_dist (g01cec) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG C Library Manual