Commonly used statistical approaches often assume that the measured outcomes are independent of each other. In spatial data, it is often the case that some or all outcome measures exhibit spatial autocorrelation. This occurs when the relative outcomes of two points is related to their distance. When analyzing spatial data, it is important to check for autocorrelation. If there is no evidence of spatial autocorrelation, then proceeding with a standard approach is acceptable. However, if there is evidence of spatial autocorrelation, then one of the underlying assumptions of your analysis may be violated and your results may not be valid.

Addressing spatial autocorrelation in your analysis is not impossible and leads to more robust and replicable results.

Analysis of spatial autocorrelation can be broken down into steps: detecting, describing, and adjusting/predicting.

## Detecting autocorrelation

These pages demonstrate how to use Moran’s I or a Mantel test to check for spatial autocorrelation in your data. Moran’s I is a parametric test while Mantel’s test is semi-parametric. Both will also indicate if your spatial autocorrelation is positive or negative and provide a p-value for the level of autocorrelation. Both test against the null that there is no spatial autocorrelation. Moran’s I does this with a correlation that is weighted by inverse distances; the Mantel test examines the correlation between two distance matrices and generating a null distribution for this correlation by randomly permuting one of the matrices.

- R: How can I calculate Moran’s I?
- SAS: How can I calculate Moran’s I?
- Stata: How can I calculate Moran’s I?
- R: How can I perform a Mantel test?

## Describing and visualizing autocorrelation

These pages demonstrate how to generate a variogram for your data. A variogram gives you a sense of the degree and range of spatial autocorrelation in your data and how it changes over distances.

- Stata: How do I generate a variogram?
- SAS: How do I generate a variogram?
- R: How do I generate a variogram?

## Adjusting for or predicting with autocorrelation

These pages demonstrate how to find the empirical variogram that is closest to what you observe in your data and using this theoretical variogram to predict your outcome at unobserved locations. Proc mixed allows you to predict your outcome using both location and other predictors. Kriging allows you to predict based completely on location.

- How do I fit a variogram model to my spatial data in SAS using proc variogram?
- How do I fit a variogram model to my spatial data in SAS using proc mixed?