# bvdist-norm2d: Bivariate Normal Distribution In fMultivar: Rmetrics - Analysing and Modeling Multivariate Financial Return Distributions

## Description

Density, distribution function, and random generation for the bivariate normal distribution.

## Usage

 ```1 2 3``` ```dnorm2d(x, y, rho = 0) pnorm2d(x, y, rho = 0) rnorm2d(n, rho = 0) ```

## Arguments

 `x, y` two numeric vectors defining the x and y coordinates. `n` the number of random deviates to be generated, an integer value. `rho` the correlation parameter, a numeric value ranging between minus one and one, by default zero.

## Value

`pnorm2d`
returns a two column matrix of probabilities for the bivariate normal distribution function.

`dnorm2d`
returns a two column matrix of densities for the bivariate normal distribution function.

`rnorm2d`
returns a two column matrix of random deviates generated from the bivariate normal distribution function.

## Author(s)

Adelchi Azzalini for the underlying `pnorm2d` function,
Diethelm Wuertz for the Rmetrics R-port.

## References

Azzalini A., (2004); The sn Package; R Reference Guide available from www.r-project.org.

Venables W.N., Ripley B.D., (2002); Modern Applied Statistics with S, Fourth Edition, Springer.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29``` ```## dnorm2d - # Bivariate Normal Density: x <- (-40:40)/10 X <- grid2d(x) z <- dnorm2d(X\$x, X\$y, rho = 0.5) ZD <- list(x = x, y = x, z = matrix(z, ncol = length(x))) # Perspective Density Plot: persp(ZD, theta = -40, phi = 30, col = "steelblue") # Contour Density Plot: contour(ZD, main="Bivariate Normal Density") ## pnorm2d - # Bivariate Normal Probability: z <- pnorm2d(X\$x, X\$y, rho = 0.5) ZP <- list(x = x, y = x, z = matrix(z, ncol = length(x))) # Perspective Plot: persp(ZP, theta = -40, phi = 30, col = "steelblue") # Contour Plot: contour(ZP) ## rnorm2d - # Bivariate Normal Random Deviates r <- rnorm2d(5000, rho=0.5) # Scatter Plot: plot(r, col="steelblue", pch=19, cex=0.5) contour(ZD, add=TRUE, lwd=2, col="red") # Hexagonal Binning: plot(hexBinning(r)) contour(ZD, add=TRUE, lwd=2, col="black") ```

### Example output

```Loading required package: timeDate

Rmetrics Package fBasics
Analysing Markets and calculating Basic Statistics
Copyright (C) 2005-2014 Rmetrics Association Zurich
Educational Software for Financial Engineering and Computational Science
Rmetrics is free software and comes with ABSOLUTELY NO WARRANTY.
https://www.rmetrics.org --- Mail to: info@rmetrics.org

Rmetrics Package fMultivar
Analysing and Modeling Multivariate Financial Return Distributions
Copyright (C) 2005-2014 Rmetrics Association Zurich
Educational Software for Financial Engineering and Computational Science
Rmetrics is free software and comes with ABSOLUTELY NO WARRANTY.
https://www.rmetrics.org --- Mail to: info@rmetrics.org
```

fMultivar documentation built on Nov. 17, 2017, 2:19 p.m.