bivariateNormalCdf

Evaluates the bivariate normal distribution function.

Synopsis

bivariateNormalCdf (x, y, rho)

Required Arguments

float x (Input)
The x-coordinate of the point for which the bivariate normal distribution function is to be evaluated.
float y (Input)
The y-coordinate of the point for which the bivariate normal distribution function is to be evaluated.
float rho (Input)
Correlation coefficient.

Return Value

The probability that a bivariate normal random variable with correlation rho takes a value less than or equal to x and less than or equal to y.

Description

Function bivariateNormalCdf evaluates the distribution function F of a bivariate normal distribution with means of zero, variances of one, and correlation of rho; that is, with ρ = rho, and \(|\rho|<1\),

\[F(x,y) = \frac{1}{2 \pi \sqrt{1 - \rho^2}} \int_{-\infty}^{x} \int_{-\infty}^{y} \exp \left(- \frac{u^2 - 2 \rho uv + v^2}{2\left(1-\rho^2\right)}\right) \mathit{dudv}\]

To determine the probability that \(U\leq u_0\) and \(V\leq v_0\), where \((U,V)^T\) is a bivariate normal random variable with mean \(\mu= (\mu_U,\mu_V)^T\) and variance-covariance matrix

\[\begin{split}\Sigma = \begin{bmatrix} \sigma_U^2 & \sigma_{UV} \\ \sigma_{UV} & \sigma_V^2 \\ \end{bmatrix}\end{split}\]

transform \((U,V)^T\) to a vector with zero means and unit variances. The input to bivariateNormalCdf would be X = \((u_0-\mu_U)/\sigma_U\), Y = \((v_0-\mu_V)/\sigma_V\), and \(\rho=\sigma_{UV}/(\sigma_U \sigma_V)\).

Function bivariateNormalCdf uses the method of Owen (1962, 1965). Computation of Owen’s T-function is based on code by M. Patefield and D. Tandy (2000). For \(|\rho|=1\), the distribution function is computed based on the univariate statistic, \(Z=\min(x,y)\), and on the normal distribution function normalCdf.

Example

Suppose \((X,Y)\) is a bivariate normal random variable with mean (0, 0) and variance-covariance matrix as follows:

\[\begin{split}\begin{bmatrix} 1.0 & 0.9 \\ 0.9 & 1.0 \\ \end{bmatrix}\end{split}\]

In this example, we find the probability that X is less than −2.0 and Y is less than 0.0.

from __future__ import print_function
from numpy import *
from pyimsl.stat.bivariateNormalCdf import bivariateNormalCdf

x = -2.0
y = 0.0
rho = 0.9
p = bivariateNormalCdf(x, y, rho)
print("The probability that X is less than -2.0")
print("and Y is less than 0.0 is %6.4f" % p)

Output

The probability that X is less than -2.0
and Y is less than 0.0 is 0.0228