I am trying to reproduce ArcGIS' kernel density in R. Specifically, I'd like to make a weighted kernel density map, like you see in Census OnTheMap (example). I am running into a lot of dead ends, where you can easily make an unweighted density map, or you can easily plot a weighted density, but it's difficult to make a weighted density map.

The closest examples use smoothing over a specified area or expect you to already have a raster set up. I'm new to raster, so it's difficult to make sense.

I do know that ArcGIS defaults the bandwidth to Silverman's rule of thumb (bw.nrd0).

So how do we take points (say polygon centroids) with a value and make a map plotting the density of those values?

1 Answer 1


You can use the sp.kde function in the spatialEco package for a weighted or "unweighted" kernel density estimate (KDE). However, a kde on polygon centroids is not valid because the polygon sets represent areas of various sizes.


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.