# cdfBvn2¶

## Purpose¶

Returns the bivariate Normal cumulative distribution function of a bounded rectangle.

## Format¶

p = cdfBvn2(h, dh, k, dk, r)
Parameters
• h (Nx1 vector) – starting points of integration for variable 1.

• dh (Nx1 vector) – increments for variable 1.

• k (Nx1 vector) – starting points of integration for variable 2.

• dk (Nx1 vector) – increments for variable 2.

• r (Nx1 vector) – correlation coefficients between the two variables.

Returns

p (Nx1 vector) – the integral over the rectangle bounded by h, h + dh, k, and k + dk of the standardized bivariate Normal distribution.

## Examples¶

### Example 1¶

// Starting point of integration for variable 1
h = 1;

// Increments for variable 1
dh = -1;

// Starting point of integration for variable 2
k = 1;

// Increments for variable 2
dk = -1;

// Correlation coefficient
rho = 0.5;

print  cdfBvn2(h, dh, k, dk, rho);


After running the above code,

1.4105101488974692e-001


### Example 2¶

print cdfBvn2(1, -1e-15, 1, -1e-15, 0.5);


After running the above code,

4.9303806576313238e-32


### Example 3¶

print cdfBvn2(1, -1e-45, 1, -1e-45, 0.5);


After running the above code,

0.0000000000000000e+000


### Example 4¶

trap 2,2;
print cdfBvn2(1, -1e-45, 1, 1e-45, 0.5);


After running the above code,

WARNING: Dubious accuracy from cdfBvn2:
0.000e+000 +/- 2.8e-060
0.0000000000000000e+000


## Remarks¶

Scalar input arguments are okay; they will be expanded to Nx1 vectors.

cdfBvn2() computes:

cdfBvn(h + dh, k+ dk, r) + cdfBvn(h, k, r) - cdfBvn(h, k + dk, r) - cdfBvn(h + dh, k, r)


cdfBvn2() computes an error estimate for each set of inputs. The size of the error depends on the input arguments. If trap 2 is set, a warning message is displayed when the error reaches 0.01 abs(y)(). For an estimate of the actual error, see cdfBvn2e().