nag_prob_normal (g01eac) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_prob_normal (g01eac)

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

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

2  Specification

#include <nag.h>
#include <nagg01.h>
double  nag_prob_normal (Nag_TailProbability tail, double x, NagError *fail)

3  Description

The lower tail probability for the standard Normal distribution, PXx is defined by:
PXx=-xZXdX,  
where
ZX=12π e-X2/2, -<X< .  
The relationship
PXx=12erfc-x2  
is used, where erfc is the complementary error function, and is computed using nag_erfc (s15adc). For the upper tail probability the relationship PXx=PX-x 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
PXx-PX-x=erfx2 ,  
is used, where erf is the error function, and is computed using nag_erf (s15aec).

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

5  Arguments

1:     tail Nag_TailProbabilityInput
On entry: indicates which tail the returned probability should represent.
tail=Nag_LowerTail
The lower tail probability is returned, i.e., PXx.
tail=Nag_UpperTail
The upper tail probability is returned, i.e., PXx.
tail=Nag_TwoTailSignif
The two tail (significance level) probability is returned, i.e., PXx+PX-x.
tail=Nag_TwoTailConfid
The two tail (confidence interval) probability is returned, i.e., PXx-PX-x.
Constraint: tail=Nag_LowerTail, Nag_UpperTail, Nag_TwoTailSignif or Nag_TwoTailConfid.
2:     x doubleInput
On entry: x, the value of the standard Normal variate.
3:     fail NagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.2.1.2 in the Essential Introduction for further information.
NE_BAD_PARAM
On entry, argument 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.
An unexpected error has been triggered by this function. Please contact NAG.
See Section 3.6.6 in the Essential Introduction for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 3.6.5 in the Essential Introduction for further information.

7  Accuracy

Accuracy is limited by machine precision. For detailed error analysis see nag_erfc (s15adc) and nag_erf (s15aec).

8  Parallelism and Performance

Not applicable.

9  Further Comments

None.

10  Example

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

10.1  Program Text

Program Text (g01eace.c)

10.2  Program Data

Program Data (g01eace.d)

10.3  Program Results

Program Results (g01eace.r)


nag_prob_normal (g01eac) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG Library Manual

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