[GIS] R Spatial Kernel Density Estimation

kernel densityrspatial-analyst

I am new on spatial kernel density estimation with r and need some suggestions. Saying, I like to estimate the density for some event occurring at a location, for example, the probability of occurrence of a disease in each state, or the probability of soybean yield at each county. And then use the spatial kernel estimation result to calculate the probability that the occurrence will be lower than some specified level (threshold). What R package has the functions for spatial kernel density estimation?

The section 8.4.2 in the book, "Geographically Weighted Regression: The Analysis of Spatially Varying Relationships", have a topic about geographically weighted Kernels.This method seems to be what I need. Do anyone know any R package with functions for geographically weighted kernels?

Best Answer

I have also been looking for a proper way to perform a weighted bivariate kernel interpolation. The code below worked for me:

# Download an example dataset - those are tree logs in a 100x100m plot. I used the volume of log, as weight.

test <- read.csv("https://dl.dropboxusercontent.com/u/39606472/R_rep/test.csv")
require(ks)

# Evaluate effect of tree felt out and in the plot. By effect I mean a mixture between trunk volume and distance to tree on a regular grid. xmin/xmax = plot area, eval.points= where I want the effect to be evaluated

    kernel <-kde(x=test[,c("x1","y1")], xmin=c(-20,-20),xmax=c(120,120),eval.points = expand.grid(x=seq(5,95,10), y=seq(5,95,10)),w=res$vol)
        IDW <- data.frame(x=kernel[[2]]$x,y=kernel[[2]]$y,z=kernel[[3]])
        plot(test$x1,test$y1,cex=log(test$vol),xlim=c(-20,120),ylim=c(-20,120))
        image(IDW,add=T)
        points(test$x1,test$y1,cex=log(test$vol))

enter image description here

Related Question