hide long namesshow long names
hide short namesshow short names
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(Xx) is defined by:
x
P(Xx) = Z(X)dX,
P(Xx)=-xZ(X)dX,
where
Z(X) = 1/(sqrt(2π ))eX2 / 2, < X < .
Z(X)=12π e-X2/2, -<X< .
The relationship
P(Xx) = (1/2)erfc((x)/(sqrt(2)))
P(Xx)=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(Xx)=P(X-x) is used and for the two tail significance level probability twice the probability obtained from the absolute value of xx 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
xx, 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'tail='L'
The lower tail probability is returned, i.e., P(Xx)P(Xx).
tail = 'U'tail='U'
The upper tail probability is returned, i.e., P(Xx)P(Xx).
tail = 'S'tail='S'
The two tail (significance level) probability is returned, i.e., P(X|x|) + P(X|x|)P(X|x|)+P(X-|x|).
tail = 'C'tail='C'
The two tail (confidence interval) probability is returned, i.e., P(X|x|)P(X|x|)P(X|x|)-P(X-|x|).
Default: 'L''L'
Constraint: tail = 'L'tail='L', 'U''U', 'S''S' or 'C''C'.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

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

Error Indicators and Warnings

Errors or warnings detected by the function:
If ifail0ifail0, then nag_stat_prob_normal (g01ea) returns 0.00.0.
  ifail = 1ifail=1
On entry,tail'L'tail'L', 'U''U', 'S''S' or 'C''C'.

Accuracy

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

Further Comments

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