# NAG CL Interfaceg01eac (prob_​normal)

Settings help

CL Name Style:

## 1Purpose

g01eac returns a one or two tail probability for the standard Normal distribution.

## 2Specification

 #include
 double g01eac (Nag_TailProbability tail, double x, NagError *fail)
The function may be called by the names: g01eac, nag_stat_prob_normal or nag_prob_normal.

## 3Description

The lower tail probability for the standard Normal distribution, $P\left(X\le x\right)$ is defined by:
 $P(X≤x)=∫-∞xZ(X)dX,$
where
 $Z(X)=12π e-X2/2, -∞
The relationship
 $P(X≤x)=12erfc(-x2)$
is used, where erfc is the complementary error function, and is computed using s15adc. For the upper tail probability the relationship $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$ is returned.
When the two tail confidence probability is required the relationship
 $P(X≤|x|)-P(X≤-|x|)=erf(|x|2) ,$
is used, where erf is the error function, and is computed using s15aec.
NIST Digital Library of Mathematical Functions
Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth

## 5Arguments

1: $\mathbf{tail}$Nag_TailProbability Input
On entry: indicates which tail the returned probability should represent.
${\mathbf{tail}}=\mathrm{Nag_LowerTail}$
The lower tail probability is returned, i.e., $P\left(X\le x\right)$.
${\mathbf{tail}}=\mathrm{Nag_UpperTail}$
The upper tail probability is returned, i.e., $P\left(X\ge x\right)$.
${\mathbf{tail}}=\mathrm{Nag_TwoTailSignif}$
The two tail (significance level) probability is returned, i.e., $P\left(X\ge |x|\right)+P\left(X\le -|x|\right)$.
${\mathbf{tail}}=\mathrm{Nag_TwoTailConfid}$
The two tail (confidence interval) probability is returned, i.e., $P\left(X\le |x|\right)-P\left(X\le -|x|\right)$.
Constraint: ${\mathbf{tail}}=\mathrm{Nag_LowerTail}$, $\mathrm{Nag_UpperTail}$, $\mathrm{Nag_TwoTailSignif}$ or $\mathrm{Nag_TwoTailConfid}$.
2: $\mathbf{x}$double Input
On entry: $x$, the value of the standard Normal variate.
3: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

If ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR, then g01eac returns $0.0$.
NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
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.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
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.

## 7Accuracy

Accuracy is limited by machine precision. For detailed error analysis see s15adc and s15aec.

## 8Parallelism and Performance

g01eac is not threaded in any implementation.

None.

## 10Example

Four values of tail and x are input and the probabilities calculated and printed.

### 10.1Program Text

Program Text (g01eace.c)

### 10.2Program Data

Program Data (g01eace.d)

### 10.3Program Results

Program Results (g01eace.r)