Produces a 2D kernel density estimation on a 2D grid from a 2D point set, using adaptive smoothing and allowing for the data points to have weights.
kde2(
x,
y,
w = NULL,
s = 1,
n = c(20, 20),
xlim = range(x),
ylim = range(y),
sd.min = NULL,
sd.max = NULL,
reflect = "",
cpp = TRUE
)
N-element vector of x-coordinates or N-by-2 matrix of (x,y)-coordinates
N-element vector of y-coordinates (only used if x is a vector)
optional N-element vector with weights
characteristic smoothing length
scalar or 2-element vector specifying the number of equally space grid cells
2-element vector specifying the x-range
2-element vector specifying the y-range
optional value, specifying the minimum blurring of any pixel, expressed in standard deviations in units of pixels
optional value, specifying the maximum blurring of any pixel, expressed in standard deviations in units of pixels
vector of characters c('left','right','bottom','top') specifying the edges, where the data should be reflected
logical flag; if set to TRUE (default) a fast implementation in C++ is used.
Returns a list of items
n-element vector of cell-center x-coordinates.
n-element vector of cell-center y-coordinates.
(n+1)-element vector of cell-edge x-coordinates.
(n+1)-element vector of cell-edge y-coordinates.
2D array of point counts.
2D array of weighted point counts (masses); only available if w
is specified.
2D array of smoothed density field.