mesa.ecospatial.local_spatial_stats

mesa.ecospatial.local_spatial_stats(grid, mode='MoranI', tissue_only=False, p_value=0.01, seed=42, plot_weights=False, return_stats=False)

Compute local indicators of spatial association (LISA) for local spatial autocorrelation on a 2D grid of diversity indices, identifying significant hotspots and coldspots based on the chosen statistical method.

Parameters:
  • grid (numpy.ndarray) – The 2D grid containing diversity indices for local spatial autocorrelation analysis.

  • mode (str, optional) – The spatial statistic method to be used, options include ‘MoranI’, ‘GearyC’, and ‘GetisOrdG’. Default is ‘MoranI’.

  • tissue_only (bool, optional) – If set to True, restricts the analysis to tissue regions only. Default is False.

  • p_value (float, optional) – The p-value cutoff for determining significance of hotspots and coldspots. Default is 0.01.

  • seed (int, optional) – Random seed for ensuring reproducibility of the analysis. Default is 42.

  • plot_weights (bool, optional) – If set to True, visualizes the spatial weights matrix to aid in understanding spatial relationships. Default is False.

  • return_stats (bool, optional) – If True, returns the local indicators of spatial association (LISA) along with identified hotspots and coldspots. Default is False.

Return type:

Tuple[ndarray, ndarray]

Returns:

  • numpy.ndarray – A boolean array indicating locations identified as hotspots (high value surrounded by high values).

  • numpy.ndarray – A boolean array indicating locations identified as coldspots (low value surrounded by low values).