Learn R Programming

VGAM (version 0.9-1)

pnorm2: Bivariate normal distribution cumulative distribution function

Description

Cumulative distribution function for the bivariate normal distribution distribution.

Usage

pnorm2(x1, x2, mean1 = 0, mean2 = 0, var1 = 1, var2 = 1, cov12 = 0)

Arguments

x1, x2
vector of quantiles.
mean1, mean2, var1, var2, cov12
vector of means, variances and the covariance.

Value

  • pnorm2 gives the cumulative distribution function.

Warning

Being based on an approximation, the results may be negative! Also, this function may be renamed to pnormal2(), or something similar, at a later date.

Details

The default arguments correspond to the standard bivariate normal distribution with correlation parameter $\rho = 0$. That is, two independent standard normal distibutions. Let sd1 be sqrt(var1) and written $\sigma_1$, etc. Then the general formula for the correlation coefficient is $\rho = cov / (\sigma_1 \sigma_2)$ where $cov$ is argument cov12. Thus if arguments var1 and var2 are left alone then cov12 can be inputted with $\rho$.

One can think of this function as an extension of pnorm to two dimensions, however note that the argument names have been changed for VGAM 0.9-1 onwards.

References

Based on Donnelly (1973), the code was translated from FORTRAN to ratfor using struct, and then from ratfor to C manually. The function was originally called bivnor, and TWY only wrote a wrapper function.

Donnelly, T. G. (1973) Algorithm 462: Bivariate Normal Distribution. Communications of the ACM, 16, 638.

See Also

pnorm, binormal, normal1.

Examples

Run this code
yvec <- c(-5, -1.96, 0, 1.96, 5)
ymat <- expand.grid(yvec, yvec)
cbind(ymat, pnorm2(ymat[, 1], ymat[, 2]))

rhovec <- seq(-0.95, 0.95, by = 0.01)
plot(rhovec, pnorm2(0, 0, cov12 = rhovec), type = "l", col = "blue", las = 1)
abline(v = 0, h = 0.25, col = "gray", lty = "dashed")

Run the code above in your browser using DataLab