Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

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)$\left(X,Y\right)$ 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:
 y x P(X ≤ x,Y ≤ y : ρ) = 1/(2π×sqrt(1 − ρ2)) ∫ ∫ exp( − ((X2 − 2ρXY + Y2))/(2(1 − ρ2)))dXdY. − ∞ − ∞
$P(X≤x,Y≤y:ρ)=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 t$t$ 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
x$x$, the first argument for which the bivariate Normal distribution function is to be evaluated.
2:     y – double scalar
y$y$, the second argument for which the bivariate Normal distribution function is to be evaluated.
3:     rho – double scalar
ρ$\rho$, the correlation coefficient.
Constraint: 1.0rho1.0$-1.0\le {\mathbf{rho}}\le 1.0$.

None.

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:
ifail = 1${\mathbf{ifail}}=1$
 On entry, rho < − 1.0${\mathbf{rho}}<-1.0$, or rho > 1.0${\mathbf{rho}}>1.0$.
If on exit ${\mathbf{ifail}}={\mathbf{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 × 1016$5×{10}^{-16}$.

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

```