1
$\begingroup$

I have a set of points in a 2d space representing location of animals. I am interested in a probability heatmap which give lower values for cells far from these locations.

I have seen many references in biology using kernel density estimation to achieve that. However, my dataset is fairly large (continental scale) and I am using R, which means traditional R functions such as kde2d() run out of memory, or require some complex manuvering with overlay() in the raster package.

There is a more memory efficient and simpler code for doing gaussian blur, i.e. a convolution two grids one with data, and one representing an approximation of a normal distribution.

Intuitively these two concepts seem related. Both are based on (1) draw a normal distribution around each point, (2) sum those normals, (3) get new value for each location. Plus Gaussian blur tutorials seems to use the term kernel quite frequently. But I could not find any source saying they are similar.

Would a gaussian blur on a binary map of locations (1,0) be equivalent to a kernel density estimation? (ignoring, of course the error due to making the process in a discrete cells).

$\endgroup$
1

1 Answer 1

1
$\begingroup$

Yes, kernel density estimators (KDEs) can be approximated by binning and convolution. This can be an effective strategy for handling a large number of low-dimensional points. The convolution can be implemented efficiently using using the fast Fourier transform (FFT). See the references below for more information, and this related thread for some alternative strategies.

There are some issues to keep in mind: 1) Binning distorts the data, so the resulting density estimate is an approximation of the true KDE. 2) runtime and memory scale exponentially with the dimensionality of the data because exponentially many bins are needed to cover the space. So, you'd fine in 2d for example, but this strategy wouldn't work well with high-dimensional data.

A small correction to the procedure you described: You'd want to work with the count of points in each bin, rather than a binary representation (there may be more than one point per bin).

References:

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.