# 7.8.2. Example 2: Nearest Neighbour Analysis and Distance matrix

Is the spatial distribution of our honey bee colonies disperse or
clustered? – The level of clustering in a point vector layer can be assessed by
*Nearest Neighbour Statistics (Analysis
tools)*:

- Go to
*Vector.* - Select
*Analysis Tools.* - Choose
*Nearest Neighbour Analysis.* - Select the
*point vector layer*representing the bee’s locations. - Click
*OK*to view the result.

In this case, the observed mean distance between nearest neighbours is
1356 meters. If the distances between different points (or groups of points)
are of interest, the *Distance matrix*
function can be useful:

- Go to
*Vector.* - Select
*Analysis Tools.* - Choose
*Distance Matrix.* - Select the bees_colony_locations.shp as both
*input*and*target vector layer*. - Select the field ID as
*unique field*(Fig. 107). - This function could also be performed using two different point layers, or using the same layer but different ID fields.
- Click
*OK*to perform the calculation and view the result.

The resulting delimited text file contains a list of all point
combinations and the distance (computed in map units, thus meters in our
example) in-between these points. In case of our honey bee locations, the
maximal distance (12.5 kilometres) is between the honey bee colony Nr. 12 and
20, the minimal distance is only 484.5 meters (between ID 1 and 16).

** Fig. 107.** Generating a distance matrix between point vector layer(s).