Skip to content

create point density raster OR other ways to thin point data

3 messages · Julie Lee-Yaw, Marcelino de la Cruz, Robert J. Hijmans

#
Hi 

I have a set of sampling locations with a strong bias towards one area within my study region (e.g. many more points in the south than in the north). I want to "thin" sites in this high density region by randomly discarding sites until the density of sampling is similar to other areas of my study region. 

The approach I've come up with so far is something like: 

1) calculate a kernel density or point density raster from the points
2) take the average "density value" of all points above (x) and below (y) a user-defined cutoff 
3) for all points with an initial density value > a defined cutoff, randomly discard point one at a time, create a new density raster, recalculate the average density (x) of these points...repeat until x = y 

To make this work, I'm trying to figure out how to produce a kernel density raster or point density raster from point data in R (akin to the "kernel density" and "point density" tools in ArcGIS). 

Can anyone point me in the right direction? I have seen the density.ppp function but I am unsure of how to calculate "sigma" or whether this function even what I need to meet my ultimate goal. Any alternative solutions for thinning point data are also appreciated.
#
Hi,

you can combine density.ppp and rthin to thin inversely to the density 
of points. See this example

# example of a heterogeneous point pattern
library(spatstat)
data(lansing)
maple<-lansing[lansing$marks=="maple"]
plot(maple)
maple.dens<- density(maple)
plot(maple.dens)

# get the probability of retention as inversely proportional to the 
density

maple.p <- eval.im(1-(maple.dens/max(maple.dens)))
plot(maple.p)

# Thin your pp
plot(rthin(maple, maple.p))

Sigma us calculted by default by density.ppp but you can set your aown 
sigma also (see the help page of density.ppp)


HTH,
Marcelino

El 2013-02-24 19:38, Julie Lee-Yaw escribi?:

  
    
#
Julie,
See:

library(dismo)
?gridSample

Robert
On Sun, Feb 24, 2013 at 10:38 AM, Julie Lee-Yaw <julleeyaw at yahoo.ca> wrote: