pbivnorm2 | R Documentation |
This function evaluates the bivariate normal distribution
\Phi_2 ( x, y ; \rho )
assuming zero means and unit variances. It uses a simple approximation
by Cox and Wermuth (1991) with corrected formulas in Hong (1999).
pbivnorm2(x, y, rho)
x |
Vector of |
y |
Vector of |
rho |
Vector of correlations between random normal variates |
Vector of probabilities
The function is less precise for correlations near 1 or -1.
Cox, D. R., & Wermuth, N. (1991). A simple approximation for bivariate and trivariate normal integrals. International Statistical Review, 59(2), 263-269.
Hong, H. P. (1999). An approximation to bivariate and trivariate normal integrals. Engineering and Environmental Systems, 16(2), 115-127. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/02630259908970256")}
See also the
pbivnorm::pbivnorm
function in the pbivnorm package.
library(pbivnorm)
# define input
x <- c(0, 0, .5, 1, 1 )
y <- c( 0, -.5, 1, 3, .5 )
rho <- c( .2, .8, -.4, .6, .5 )
# compare pbivnorm2 and pbivnorm functions
pbiv2 <- sirt::pbivnorm2( x=x, y=y, rho=rho )
pbiv <- pbivnorm::pbivnorm( x, y, rho=rho )
max( abs(pbiv-pbiv2))
## [1] 0.0030626
round( cbind( x, y, rho,pbiv, pbiv2 ), 4 )
## x y rho pbiv pbiv2
## [1,] 0.0 0.0 0.2 0.2820 0.2821
## [2,] 0.0 -0.5 0.8 0.2778 0.2747
## [3,] 0.5 1.0 -0.4 0.5514 0.5514
## [4,] 1.0 3.0 0.6 0.8412 0.8412
## [5,] 1.0 0.5 0.5 0.6303 0.6304
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.