wkde2d | R Documentation |
Weighted 2D kernel density estimation
wkde2d(x, y, w, h, adjust = 1, n = 100, lims = c(range(x), range(y)))
x |
Dimension 1 |
y |
Dimension 2 |
w |
Weight variable |
h |
vector of bandwidths for x and y directions. Defaults to normal reference bandwidth (ks::hpi). A scalar value will be taken to apply to both directions. |
adjust |
Bandwidth adjustment |
n |
Number of grid points in each direction. Can be scalar or a length-2 integer vector. |
lims |
The limits of the rectangle covered by the grid as c(xl, xu, yl, yu). |
A list of three components.
x, y
The x and y coordinates of the grid points, vectors of
length n.
z
An n[1] by n[2] matrix of the weighted estimated density:
rows correspond to the value of x, columns to the value of y.
Jose Alquicira-Hernandez
set.seed(1)
x <- rnorm(100)
set.seed(2)
y <- rnorm(100)
set.seed(3)
w <- sample(c(0, 1), 100, replace = TRUE)
dens <- Nebulosa:::wkde2d(x, y, w)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.