average_nearest_neighbour_index#
- average_nearest_neighbour_index(domain, population_A, population_B, include_boundaries=None, exclude_boundaries=None, boundary_exclude_distance=0)#
Computes the average nearest neighbour index (ANNI) for between two queried populations.
The ANNI evaluates the spatial aggregation or dispersion effect of objects based on the average distances between pairs of the nearest objects and can be used to test for the clustering of specific cell types. This returns ANNI and the p-value (two-tailed) associated with ANNI under complete spatial randomness (CSR).
ANNI assumes homogeneous density of the populations and is sensitive to local variations in density. Populations with local variations in density may exhibit artefically high or low ANNI values.
This is also known as the Clark-Evans index.
- Parameters:
- domainobject
The domain containing the objects and their spatial information.
- population_Aquery-like
The first population of objects or a query to select them.
- population_Bquery-like
The second population of objects or a query to select them.
- include_boundariesarray-like, query-like, or None, optional
Boundaries to include in the analysis. Defaults to None.
- exclude_boundariesarray-like, query-like, or None, optional
Boundaries to exclude from the analysis. Defaults to None.
- boundary_exclude_distancefloat, optional
Buffer to exclude objects located within boundary_exclude_distance from the boundaries. Defaults to 0.
- Raises
- ——
- ValueError
If the query for reference objects does not return any objects.
- ValueError
If the query for measure objects does not return any objects.
- ValueError
If any object in the boundary query is not a shape object.
- Returns:
- ANNIfloat
The average nearest neighbour index.
- zscorefloat
The zscore associated with ANNI under CSR.
- p_valuefloat
The p-value (two-tailed) associated with ANNI under CSR.
Notes
For more information, see https://doi.org/10.2307/1931034