Skip to content
Prev 8165 / 29559 Next

Spatstat- nearest neighbour correlation, nncorr

Hi R users,

In the package Spatstat, I'd like to apply 'nncorr' to a point pattern (with
continuous marks), like this:

NNcorrel <- nncorr(pattern) *

However, I'm getting this error: "Error in nncorr(pattern) : Insufficient
data". This error is not because there are no points inside the window
(there are always >= 2 points). I think the error occurs because the mean
nearest neighbour distance is above a critical value. This critical value
seems to be the same as the 'range' argument that's used in the 'markcorr'
and 'pcf' R functions. I don't really understand why nncorr returns an error
when the points are far apart... 

So the question is, how do I tell nncorr to measure the correlation between
nearest-neighbours, IRRESPECTIVE of the mean nearest neighbour distance  ??

Thanks!
Tom

* actually I'm using a special correlation function for angular marks (see
help(markcorr) for details): 
NNcorrel <- nncorr(pattina, function(m1,m2) {sin(m1-m2)^2})
However, that's not particularly relevant as both this & the simpler version
given above return the same error.