'Is there an R function that tests for spatial autocorrelation in residuals of a regression created by errorsarlm / lagsarlm / sacsarlm

My question relates to the functions errorsarlm(), lagsarlm() and sacsarlm() of the "spdep" package. I would like to test the residuals of a regression created by one of the functions above on remaining spatial autocorrelation, for example by running a Moran's I test.

For linear models there exists the function lm.morantest() which tests for spatial autocorrelation among OLS residuals.

Is there a function already implemented in a package (not necessarily "spdep" or "spatialreg") that does this for the residuals of a spatial regression model? For example, would it be correct to do this by the moran.mc() command?

If no such function exists, what would be the correct approach to write such a function by myself?

Any help is much appreciated!



Solution 1:[1]

Yes, you can use Moran's I on the residuals:

moran.test(df$residuals, listw=df_k2_wb, alternative="two.sided")

ArcPro has a good write-up on using this diagnostic:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Paulito.Bandito