Learn R Programming

fCopulae (version 3000.79)

norm2d: Bivariate Normal Distribution

Description

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

Usage

pnorm2d(x, y = x, rho = 0)
dnorm2d(x, y = x, rho = 0)
rnorm2d(n, rho = 0)

Arguments

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.
x, y
two numeric vectors defining the x and y coordinates.

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.

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

Run this code
## Bivariate Normal Density:
   x = (-40:40)/10
   X = grid2d(x)
   z = dnorm2d(X$x, X$y, rho = 0.5)
   Z = list(x = x, y = x, z = matrix(z, ncol = length(x)))
   persp(Z, theta = -40, phi = 30, col = "steelblue")

Run the code above in your browser using DataLab