Nearest Neighbour Exercise

Description

Here you will generate different spatial distributions of objects and calculate the corresponding nearest neighbour statistic.

$$Rn=\frac{\bar{D}\left(Obs\right)}{0.5\sqrt{\frac{a}{n}}}$$ where \(Rn\) is the statistic; \(\bar{D}\) is the average distance of the nearest neighbour distance between all objects over a total area \(a\); and \(n\) is the number of objects within that area.

Calculating \(Rn\) can cause some confusion. For each object we need to find its nearest-neighbour object the square area and measure the distance to it. This will be a list of measurements, \(D\), from which we calculate the mean and put this into the formula for the \(Rn\) statistic, above.

What values of \(Rn\) do we expect?
Well, let us define the total area divided by the number of objects equal to the average area of each object. Taking the square-root of the average area of each object would equal the average distance between each object.

Regular spacing

If the objects are regularly spaced (i.e. they have equal spacings) then the average distance between each object is equal to the nearest neighbour distance, so the limiting value of \(Rn\) in this case will be 2 (due to the factor of 0.5 in the denominator).

Random spacing

In the case of random spacing there will be some objects closer than the average distance between each object and some further apart. However, mathematically it can be shown that the average of the nearest neighbour spacing in this case is exactly have of the average spacing. Therefore, \(Rn=1.0\) is the limiting value for randomly spaced objects.

Clustering

The other case to consider is clustering. If the objects are clustered we observe that \(Rn<1.0\).


Simulations

Below we can conduct computer simulations to space objects differently and calculate the \(Rn\) statistic. Click "Run Simulation" to compute the results. For each case do the following:

Choose type of simulation to do, corresponding to different spacings:
Average number of objects along \(x\)
Length of area in metres
Regular
Random
Cluster 1
Cluster 2