# Linear Regression and Spatial-Autocorrelation

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.

• 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. Sep 12 '12 at 2:26

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).

• (+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. Sep 12 '12 at 2:22
• Just for completeness Geary's C is also a measure of spatial correlation. en.wikipedia.org/wiki/Geary's_C
– xro7
Dec 6 '16 at 15:53