# Spatial correlation at lag 1

Near-neighbor spatial correlation (at lag 1) captures the increasingly correlation between neighboring spatial sites. It can be quantified by the spatial correlation function, or Moran’s I, between ecological states z[i, j] and z[m, n] separated by a distance r:

(1)

where is the spatial mean of the state variable (), is if spatial units and are separated by a distance , and is 0 otherwise, is the total number of units separated by the distance . In the notation , the subscript stands for 2-dimensional space. The near-neighbor spatial correlation , the analog of autocorrelation at lag 1 for time series, is calculated for the distance corresponding nearest neighboring units of the system.