Calculate probabilities from the CDF of a standard bivariate normal distribution.

pbivnorm(x, y, rho = 0, recycle = TRUE)

Arguments

x

vector of upper integration limits for the CDF. May also be a two-column matrix, in which case y should not be used.

y

vector of upper integration limits.

rho

correlation parameter.

recycle

whether to automatically recycle the vectors x, y, and rho to conform to whichever is longest. If FALSE, all three must be the same length.

Value

Numeric vector of probabilities.

Details

This function returns values identical to those of biv.nt.prob in the mnormt package, but is vectorized to reduce the number of Fortran calls required for computation of many probabilities.

Author

Fortran code by Alan Genz (see references). R interface by Brenton Kenkel (brenton.kenkel@gmail.com), based on code from Adelchi Azzalini's mnormt package.

References

Genz, A. (1992). Numerical Computation of Multivariate Normal Probabilities. J. Computational and Graphical Statist., 1, 141–149.

Genz, A. (1993). Comparison of methods for the computation of multivariate normal probabilities. Computing Science and Statistics, 25, 400–405.

Genz, A. Fortran code for MVTDSTPACK available at http://www.math.wsu.edu/math/faculty/genz/software/fort77/mvtdstpack.f (as of 2011-02-21).

Examples

x <- rnorm(10)
y <- rnorm(10)
rho <- runif(10)

pbivnorm(x, y, rho)
#>  [1] 0.531934284 0.007399442 0.029641811 0.619165736 0.031230073 0.034241329
#>  [7] 0.390804454 0.336367354 0.119833058 0.234420234

X <- cbind(x, y)
pbivnorm(X, rho = rho)
#>  [1] 0.531934284 0.007399442 0.029641811 0.619165736 0.031230073 0.034241329
#>  [7] 0.390804454 0.336367354 0.119833058 0.234420234

## rho can be a single value, unless recycling is disallowed
rho <- runif(1)
pbivnorm(x, y, rho)
#>  [1] 0.464210431 0.007363354 0.032903589 0.530670276 0.029386941 0.015258255
#>  [7] 0.219812115 0.308162044 0.088104413 0.218113982