Nearest-neighbour analysis

This tool can be used to determine whether a distribution of vector points is is significantly clustered or dispersed or if they are randomly distributed. It is based on the calculation of the average distance of each point to its nearest-neighbour (NN). The observed mean nearest-neighbour distance (do) is then compared to the expected value (de):

de = 0.5 × (A / n)0.5 [eq. 1]

Where A is the area of the minimum bounding box (MBB) enclosing the points and n is the number of points. The nearest-neighbour ratio, defined as do / de , ranges from 0.0 for a distribution of coincident points, to 1.0 for a random point distribution, to a maximum of 2.15 for a hexagonal grid with maximal dispersion. Points that are situated along a regular square grid should have a NN ratio near 2. The analysis also includes a statistical testing for the significance of the computed z-score based on the standard error of the mean NN distance ((se)):

se = 0.26136 / (n × n / A)0.5 [eq. 2]

The null hypothesis of this test is that the points are randomly distributed.

Nearest-neighbour analysis is strongly affected by edge effects because points located at the edges of the extent may have their NN situated beyond the edge. To compensate for this bias, the data can optionally be tiled in a 3 × 3 grid and the statistic is then calculated for the central area, a procedure recommended by Davis (2002) Statistics and Data Analysis In Geology, 3rd Ed. If the study area is anomolous within the larger region, the results of this analysis will be significantly influenced by edge effects.

See Also:

Scripting:

The following is an example of a Python script that uses this tool:

wd = pluginHost.getWorkingDirectory()
inputFile = wd + "input.shp"
edgeStrategy = "tile"
args = [inputFile, edgeStrategy]
pluginHost.runPlugin("NearestNeighbourAnalysis", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def inputFile = wd + "input.shp"
def edgeStrategy = "nothing"
String[] args = [inputFile, edgeStrategy]
pluginHost.runPlugin("NearestNeighbourAnalysis", args, false)

Credits: