Weighted KDE in R

853 views
Skip to first unread message

Nick van Doormaal

unread,
Nov 23, 2016, 5:55:13 AM11/23/16
to GIS In Ecology Forum
Hello,

I'm trying to find a way to calculate a kernel density using weights. I know this can be easily done in ArcGIS, QGIS, and GME where you can specify which column contains the weights. However, I cannot figure out how to do this in R.

So far, I'm using the 'kernelUD'-function from the adehabitatHR-package. My input data points consists of animal sightings, tracks, and dung. I would like to give the animal sightings a higher weight, so that the KDE is more emphasized towards sightings.

Thank you for your time,

Nick

GIS in Ecology

unread,
Nov 25, 2016, 7:01:59 AM11/25/16
to GIS In Ecology Forum
Hi Nick,

Unless I've missed something in the documentation, it doesn't seem like adehabitat allows for weightings when calculating KDEs. However, you can create KDEs with weightings using other packages in R. For example, you can use the density() function and add a weighting by specifying a term weights. You can find more information about this here: https://stat.ethz.ch/R-manual/R-devel/library/stats/html/density.html.

The resulting KDE would be usable within other tools in the adehabitat package (e.g. for extracting 95% PVC etc), but I haven't actually tried or tested this myself.

I hope this helps, and if you have the time, post back on this thread to let others know if this worked for you as I suspect many people will also want to know about how to add a weighting value when creating a KDE in R.

All the best,

Colin

Jeffrey Evans

unread,
Dec 18, 2017, 5:50:43 AM12/18/17
to GIS In Ecology Forum
For future reference, I added a weighted KDE function "spkde" to version 1.0-0 of the spatialEco package (https://cran.r-project.org/web/packages/spatialEco/index.html).

Best,
Jeff
Reply all
Reply to author
Forward
0 new messages