kernel2d_est: MASS' Two-Dimensional Kernel Density Estimation

Description Usage Arguments Details Value Examples

Description

Two-dimensional kernel density estimation with an axis-aligned bivariate normal kernel, evaluated on a square grid. Originally from MASS package, this function was copied to avoid CRAN notes.

Usage

1
kernel2d_est(x, y, h, n = 25, lims = c(range(x), range(y)))

Arguments

x

Type: numeric vector. x coordinate of data.

y

Type: numeric vector. y coordinate of data.

h

Type: numeric vector. Vector of bandwidths for x and y directions. Defaults to normal reference bandwidth. A scalar value will be taken to apply to both directions.

n

Type: numeric vector. Number of grid points in each direction. Can be scalar or a length-2 integer vector.

lims

Type: numeric vector. The limits of the rectangle covered by the grid as c(xl, xu, yl, yu).

Details

Return a list of three components:

x

The x coordinates of the grid points, vector of length n

y

The y coordinates of the grid points, vector of length n

z

An n[1] by n[2] matrix of the estimated density: rows correspond to the value of x, columns to the value of y.

Value

A list of three elements.

Examples

1
2
3
4
## Not run: 
#?MASS::kde2d

## End(Not run)

Laurae2/Laurae documentation built on May 8, 2019, 7:59 p.m.