I want to predict Tree Heights in a certain area using some variables obtained through remote sensing. Like approximate Biomass, etc. I want to first use a linear regression (I know it's not the best idea but it is a must step for my project). I wanted to know how badly can spatial autocorrelation affect it and what is the easiest way to correct this if it is even possible. I'm doing everything in R by the way.

  • 6
    $\begingroup$ If you do see spatial autocorrelation in the residuals you can include the observations at nearby locations ("spatial lags") as predictors in the model as Sameer suggests. Another option for handling spatial autocorrelation is to model the spatial trend by including a semi-parametrically estimated function of the spatial coordinates using, for example, a generalized additive model. See this related question for more info. $\endgroup$
    – Macro
    Sep 12, 2012 at 2:26

1 Answer 1


Moran's I is a diagnostic statistic that can be used to detect spatial autocorrelation in the residuals of a regression, given that you have a weight matrix $\mathbf{w}$, with entries $w_{ij}$ representing distances between observation (residuals) $X_i$ and $X_j$. You can think of it as a spatially-weighted measure of correlation. Significance of the statistic can be calculated analytically or perhaps with non-parametric re-sampling methods (e.g. jackknife). Another method for doing something similar is the Lagrange multiplier test.

If a statistically significant autocorrelation is detected in the residuals, physically proximal observations have to be included in the regression model, similar in vein to what is done in a time-series.

Luckily, for the R user, there is an Analysis of Spatial Data CRAN task view; one recommend package is the spdep, which has the requisite functions (and illustrative vignettes).

  • 3
    $\begingroup$ (+1) The author of spdep also has a nice textbook about spatial data analysis in R here. I own this book and have found it very useful. $\endgroup$
    – Macro
    Sep 12, 2012 at 2:22
  • $\begingroup$ Just for completeness Geary's C is also a measure of spatial correlation. en.wikipedia.org/wiki/Geary's_C $\endgroup$
    – xro7
    Dec 6, 2016 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.