mesa.ecospatial.global_spatial_stats

mesa.ecospatial.global_spatial_stats(grid, mode='MoranI', tissue_only=False, plot_weights=False)

Perform global spatial autocorrelation analysis on a 2D grid of diversity indices.

Parameters:
  • grid (numpy.ndarray) – The 2D grid containing diversity indices for 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, the analysis is restricted to only tissue regions, excluding non-tissue areas. Default is False.

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

Return type:

Tuple[float, float]

Returns:

  • float – The calculated spatial statistic indicating the degree of autocorrelation.

  • float – The p-value associated with the spatial statistic test, indicating statistical significance.