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_bivariate_normal (g01ha)

Purpose

nag_stat_prob_bivariate_normal (g01ha) returns the lower tail probability for the bivariate Normal distribution.

Syntax

[result, ifail] = g01ha(x, y, rho)
[result, ifail] = nag_stat_prob_bivariate_normal(x, y, rho)

Description

For the two random variables (X,Y)(X,Y) following a bivariate Normal distribution with
E[X] = 0,  E[Y] = 0,  E[X2] = 1,  E[Y2] = 1  and  E[XY] = ρ,
E[X]=0,  E[Y]=0,  E[X2]=1,  E[Y2]=1  and  E[XY]=ρ,
the lower tail probability is defined by:
yx
P(Xx,Yy : ρ) = 1/(2π×sqrt(1ρ2))exp(((X22ρXY + Y2))/(2(1ρ2)))dXdY.
P(Xx,Yy:ρ)=12π1-ρ2 -y -x exp(- (X2- 2ρ XY+Y2) 2(1-ρ2) ) dXdY.
For a more detailed description of the bivariate Normal distribution and its properties see Abramowitz and Stegun (1972) and Kendall and Stuart (1969). The method used is described by Genz (2004).

References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Genz A (2004) Numerical computation of rectangular bivariate and trivariate Normal and tt probabilities Statistics and Computing 14 151–160
Kendall M G and Stuart A (1969) The Advanced Theory of Statistics (Volume 1) (3rd Edition) Griffin

Parameters

Compulsory Input Parameters

1:     x – double scalar
xx, the first argument for which the bivariate Normal distribution function is to be evaluated.
2:     y – double scalar
yy, the second argument for which the bivariate Normal distribution function is to be evaluated.
3:     rho – double scalar
ρρ, the correlation coefficient.
Constraint: 1.0rho1.0-1.0rho1.0.

Optional Input Parameters

None.

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:
  ifail = 1ifail=1
On entry,rho < 1.0rho<-1.0,
orrho > 1.0rho>1.0.
If on exit ifail = 1ifail=1 then nag_stat_prob_bivariate_normal (g01ha) returns zero.

Accuracy

Accuracy of the hybrid algorithm implemented here is discussed in Genz (2004). This algorithm should give a maximum absolute error of less than 5 × 10165×10-16.

Further Comments

The probabilities for the univariate Normal distribution can be computed using nag_specfun_cdf_normal (s15ab) and nag_specfun_compcdf_normal (s15ac).

Example

function nag_stat_prob_bivariate_normal_example
x = 1.7;
y = 23.1;
rho = 0;
[result, ifail] = nag_stat_prob_bivariate_normal(x, y, rho)
 

result =

    0.9554


ifail =

                    0


function g01ha_example
x = 1.7;
y = 23.1;
rho = 0;
[result, ifail] = g01ha(x, y, rho)
 

result =

    0.9554


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