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_prob_normal (g01ea)

## Purpose

nag_stat_prob_normal (g01ea) returns a one or two tail probability for the standard Normal distribution.

## Syntax

[result, ifail] = g01ea(x, 'tail', tail)
[result, ifail] = nag_stat_prob_normal(x, '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 lower tail probability for the standard Normal distribution, P(Xx)$P\left(X\le x\right)$ is defined by:
 x P(X ≤ x) = ∫ Z(X)dX, − ∞
$P(X≤x)=∫-∞xZ(X)dX,$
where
 Z(X) = 1/(sqrt(2π ))e − X2 / 2, − ∞ < X < ∞. $Z(X)=12π e-X2/2, -∞
The relationship
 P(X ≤ x) = (1/2)erfc(( − x)/(sqrt(2))) $P(X≤x)=12erfc(-x2)$
is used, where erfc is the complementary error function, and is computed using nag_specfun_erfc_real (s15ad). For the upper tail probability the relationship P(Xx) = P(Xx)$P\left(X\ge x\right)=P\left(X\le -x\right)$ is used and for the two tail significance level probability twice the probability obtained from the absolute value of x$x$ is returned.
When the two tail confidence probability is required the relationship
 P(X ≤ |x|) − P(X ≤ − |x|) = erf((|x|)/(sqrt(2))) , $P(X≤|x|)-P(X≤-|x|)=erf(|x|2) ,$
is used, where erf is the error function, and is computed using nag_specfun_erf_real (s15ae).

## 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

## Parameters

### Compulsory Input Parameters

1:     x – double scalar
x$x$, the value of the standard Normal variate.

### Optional Input Parameters

1:     tail – string (length ≥ 1)
Indicates which tail the returned probability should represent.
tail = 'L'${\mathbf{tail}}=\text{'L'}$
The lower tail probability is returned, i.e., P(Xx)$P\left(X\le x\right)$.
tail = 'U'${\mathbf{tail}}=\text{'U'}$
The upper tail probability is returned, i.e., P(Xx)$P\left(X\ge x\right)$.
tail = 'S'${\mathbf{tail}}=\text{'S'}$
The two tail (significance level) probability is returned, i.e., P(X|x|) + P(X|x|)$P\left(X\ge |x|\right)+P\left(X\le -|x|\right)$.
tail = 'C'${\mathbf{tail}}=\text{'C'}$
The two tail (confidence interval) probability is returned, i.e., P(X|x|)P(X|x|)$P\left(X\le |x|\right)-P\left(X\le -|x|\right)$.
Default: 'L'$\text{'L'}$
Constraint: tail = 'L'${\mathbf{tail}}=\text{'L'}$, 'U'$\text{'U'}$, 'S'$\text{'S'}$ or 'C'$\text{'C'}$.

None.

### Output Parameters

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

## Error Indicators and Warnings

Errors or warnings detected by the function:
If ${\mathbf{ifail}}\ne {\mathbf{0}}$, then nag_stat_prob_normal (g01ea) returns 0.0$0.0$.
ifail = 1${\mathbf{ifail}}=1$
 On entry, tail ≠ 'L'${\mathbf{tail}}\ne \text{'L'}$, 'U'$\text{'U'}$, 'S'$\text{'S'}$ or 'C'$\text{'C'}$.

## Accuracy

Accuracy is limited by machine precision. For detailed error analysis see nag_specfun_erfc_real (s15ad) and nag_specfun_erf_real (s15ae).

None.

## Example

```function nag_stat_prob_normal_example
x = 1.96;
[result, ifail] = nag_stat_prob_normal(x)
```
```

result =

0.9750

ifail =

0

```
```function g01ea_example
x = 1.96;
[result, ifail] = g01ea(x)
```
```

result =

0.9750

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