# Moran's I test on regression residuals with spatial autocorrelation

Suppose we want a regression model `\$y_i = f(x_i^t) + e_i\$`, where `\$y_i\$` and `\$x_i\$` are collected spatially, and we believe there would be spatial autocorrelation (SAC). I read some popular methods like spatial-lag or spatial-error, and the Moran's I test.

My question is, if we believe that the SAC in `\$y_i\$` is all caused by SAC `\$x_i\$`, that is, we believe `\$e_i\$` are independent with each other. Then is there any problem to simply run a normal regression model? It looks to me that this way does not violate any assumptions. I can definitely run a test on the residuals. However several application papers do things in such a way: they first run Moran's I on `\$y_i\$`, if significant, then spatial-lag. O.w., run Moran's I on residuals, if significant, then spatial-error. If looks weird to me.

Running a regression on data that is spatially autocorrelated is fine, and unavoidable in most scenarios (e.g. ecological modelling).

It is when you have SAC in your residuals that you have issues. The assumptions of independence are not met and the chance of Type 1 error is increased. Not to mention potential for unstable/biased parameter estimates.

So it's important test your residuals for SAC. You could use Moran's I, computed at various lags (e. g. Corellograms), variograms and local estimates of SAC. Probably good to try a range of methods to get a better picture of the error structure.

• Thank you so much! My understanding is that, if we can believe all the sources of SAC comes from those predictors, then first do a Moran's I on response variables (instead of residuals) and then use spatial-lag is not a good idea (at least no need when no SAC in residuals). Do you think so? – RunStat Oct 12 '19 at 23:20
• You will probably find your response is spatially correlated if your predictors are. If we assume endogenous sources of SAC are negligible then any residual SAC is probably due to a misspecified model. This could be because you used a linear model for a non linear response or there are variables that are missing. There could also be issues with spatial non-stationarity. So test the residuals and then if SAC is an issue then look at maybe using auto regressive models or spatial filtering methods or geographic weighted regression if you suspect non stationarity – Liam G Oct 13 '19 at 3:59

My understanding is that if the independent variables account for all the spatial autocorrelation in y, then there is no need to account for spatial autocorrelation in the models. To test this, we need to use spatial indicators like Moran's I, Geary's C.

Alternatively, you can test the presence of spatial autocorrelation, after building the model. The lagsarlm package in R allows you to build the spatial autoregressive model and the "rho" value in the model can help you identify the presence of spatial autocorrelation. The "rho" value takes values between 0 and 1 and 0 indicates no spatial autocorrelation and 1 indicates high spatial autocorrelation.

However several application papers do things in such a way: they first run Moran's I on \$y_i\$, if significant, then spatial-lag. O.w., run Moran's I on residuals, if significant, then spatial-error. If looks weird to me.

I have not come across any papers that do it the above way.