Based of an algorithm found online at https://stat.ethz.ch/pipermail/r-help/2006-June/107405.html
.
kde2d.weighted(x, y, h, n = 25, lims = c(range(x), range(y)), w)
x coordinate of data
y coordinate of data
vector of bandwidths for x and y directions. Defaults to
normal reference bandwidth (see bandwidth.nrd
). A scalar
value will be taken to apply to both directions.
Number of grid points in each direction. Can be scalar or a length-2 integer vector.
The limits of the rectangle covered by the grid as c(xl, xu, yl, yu)
.
numeric value or vector of same length as x (and y), for weighting, if not provided, a unified weighting of '1' will which will result in the regular density calculation.
Nicholas Hamilton
kde2d