g01ha returns the lower tail probability for the bivariate Normal distribution.

# Syntax

C#
```public static double g01ha(
double x,
double y,
double rho,
out int ifail
)```
Visual Basic
```Public Shared Function g01ha ( _
x As Double, _
y As Double, _
rho As Double, _
<OutAttribute> ByRef ifail As Integer _
) As Double```
Visual C++
```public:
static double g01ha(
double x,
double y,
double rho,
[OutAttribute] int% ifail
)```
F#
```static member g01ha :
x : float *
y : float *
rho : float *
ifail : int byref -> float
```

#### Parameters

x
Type: System..::..Double
On entry: $x$, the first argument for which the bivariate Normal distribution function is to be evaluated.
y
Type: System..::..Double
On entry: $y$, the second argument for which the bivariate Normal distribution function is to be evaluated.
rho
Type: System..::..Double
On entry: $\rho$, the correlation coefficient.
Constraint: $-1.0\le {\mathbf{rho}}\le 1.0$.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

#### Return Value

g01ha returns the lower tail probability for the bivariate Normal distribution.

# Description

For the two random variables $\left(X,Y\right)$ following a bivariate Normal distribution with
 $EX=0, EY=0, EX2=1, EY2=1 and EXY=ρ,$
the lower tail probability is defined by:
 $PX≤x,Y≤y:ρ=12π⁢1-ρ2∫-∞y∫-∞xexp-X2-2ρXY+Y221-ρ2dXdY.$
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$ probabilities Statistics and Computing 14 151–160
Kendall M G and Stuart A (1969) The Advanced Theory of Statistics (Volume 1) (3rd Edition) Griffin

# Error Indicators and Warnings

Errors or warnings detected by the method:
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{rho}}<-1.0$, or ${\mathbf{rho}}>1.0$.
If on exit ${\mathbf{ifail}}={1}$ then g01ha returns zero.
${\mathbf{ifail}}=-9000$
An error occured, see message report.

# 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×{10}^{-16}$.

# Parallelism and Performance

None.

The probabilities for the univariate Normal distribution can be computed using s15ab and s15ac.

# Example

This example reads values of $x$ and $y$ for a bivariate Normal distribution along with the value of $\rho$ and computes the lower tail probabilities.

Example program (C#): g01hae.cs

Example program data: g01hae.d

Example program results: g01hae.r