[R-sig-Geo] Calculating point density

Adrian.Baddeley at csiro.au Adrian.Baddeley at csiro.au
Wed Jun 15 03:17:04 CEST 2011


The calculation of PointDensity described by Chris Fowler is *equivalent* to a kernel density estimator. The kernel k(v) is equal to 1/(pi*r^2) when v is inside the circle of radius r centred at the origin 0, and k(v) = 0 otherwise. 

There are theoretical reasons for preferring a smooth kernel instead of the discontinuous kernel used in PointDensity. There are practical advantages in using the Gaussian kernel - mainly that the density estimate can be computed rapidly using the Fast Fourier Transform. The relative merits of different density estimators are discussed in books on density estimation, e.g. Silverman 1986

Adrian Baddeley
________________________________________
From: Rolf Turner [r.turner at auckland.ac.nz]
Sent: Wednesday, 15 June 2011 4:36 AM
To: Christopher S. Fowler
Cc: r-sig-geo at r-project.org; Baddeley, Adrian (CMIS, Floreat)
Subject: Re: [R-sig-Geo] Calculating point density

On 15/06/11 06:35, Christopher S. Fowler wrote:
> I am working out a comparison of results for point pattern analysis using
> ArcGIS and R, specifically the spatstat package. One of the key functions
> for density calculations in ArcGIS is "Point Density" which counts the
> points within a given distance (r) of the centroid of each cell in a raster
> grid and divides it by the area of circle with radius r. The closest
> equivalent I have found is the density.ppp function in spatstat, but that is
> kernel density. Am I correct in thinking that this "reverses" the process of
> point density and assigns a contribution value extending out from each point
> in the data consistent with the function specified in the bandwidth
> variable?
>
> Any suggestions on the location of an appropriate point density function, or
> barring that, the reason for preferring kernel density to point density.

As the help for density.ppp() says, this function uses an isotropic Gaussian
kernel of standard deviation sigma. Its value at "x" is in effect the sum of
k(x - x_i) where k() is the kernel and the x_i are the points of the pattern
in question (although internally it use fast Fourier transform methods
rather
than calculating this sum directly).

Thus the value at "x" is a sum of weights associated with each point of the
pattern, with the weights diminishing as the distance of points of the
pattern
from "x" increases.

Note that the integral of the resulting density over the observation window
is ``theoretically'' equal to the number of points observed in the window,
but is in fact slightly less.

     cheers,

         Rolf Turner



More information about the R-sig-Geo mailing list