[R] Spatstat - K2 index

Adrian Baddeley Adrian.Baddeley at csiro.au
Tue Dec 2 03:35:47 CET 2008

Gough Lauren wrote:
>> I'm using spatstat to investigate the spatial structure of an arid shrub
>> population.  The first-order intensity of my data does not appear to be
>> homogenous, so I would like to use inhomogeneous techniques.  I realise
>> there is a inhomogeneous K-function available in spatstat, but there
>> doesn't not appear to be one for the pair-correlation function (O-ring
>> statistic).  
The function 'pcf' in spatstat computes the pair correlation function.

To compute the inhomogeneous version of the pair correlation function,
 if X is your point pattern and Z is its estimated intensity (a pixel 
image), type

         K <- Kinhom(X, Z)
         p <- pcf(K)

This uses the method 'pcf.fv' which computes an estimate of the 
(inhomogeneous) pair correlation function by numerically differentiating 
the inhomogeneous K function. See help(pcf) and help(pcf.fv).

In future versions of spatstat we will introduce a function pcf.inhom 
that uses kernel smoothing to do the same task.

>> As such I was planning to use a new technique (the K2
>> index) as described in Schiffers et al. (2008) [Ecography, 31:545-555].
>> The following website has more detail
>> [http://www.oikos.ekol.lu.se/appendixdown/E5374-example.R].  Despite
>> this I cannot get the function to run!  

You need the code file K2.R mentioned in this file.

According to the cited article, the "K2 index" is just the derivative of 
the pair correlation function. Presumably the file K2.R computes a 
numerical estimate of the derivative (assuming that it exists).

Adrian Baddeley

More information about the R-help mailing list