Learn R Programming

fCopulae (version 3000.79)

density2d: Bivariate Density Tools

Description

Grid generator, kernel density estimator, histogram counter, and integrator for bivariate distributions

Usage

grid2d(x = (0:10)/10, y = x)
density2d(x, y = NULL, n = 20, h = NULL, limits = c(range(x), range(y))) 
hist2d(x, y = NULL, n = c(20, 20))
integrate2d(fun, error = 1.0e-5, ...)

Arguments

error
the error bound to be achieved by the integration formula. A numeric value.
fun
the function to be integrated. The first argument requests the x values, the second the y values, and the remaining are reserved for additional parameters. The integration is over the unit square "[0,1]^2".
h
a vector of bandwidths for x and y directions. Defaults to normal reference bandwidth.
limits
the limits of the rectangle covered by the grid.
n
n - an integer specifying the number of grid points in each direction. The default value is 20. [hist2D] - In this case n may be a scalar or a two element vector. The default value is 20. [rnorm2d] - the number of random d
x, y
two numeric vectors defining the x and y coordinates. [density2D][hist2D] - two vectors of coordinates of data. If y is NULL then x is assumed to be a two column matrix, where the first column contains the
...
parameters passed to the function to be integrated.

Value

  • grid2d returns a list with two vectors named $x and $y spanning the grid defined by the coordinate vectors x and y. density2d hist2d returns a list with three elements $x, $y, and $z. x and y are vectors spanning the two dimensional grid and z the corresponding matrix. The output can directly serve as input to the plotting functions image, contour and persp. integrate2d returns a list with the $value of the integral over the unit square [0,1]^2, an $error estimate and the number of grid $points used by the integration 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. Warnes G.R., (2004); The gregmisc Package; R Reference Guide available from www.r-project.org.