1

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!

Progman
  • 16,827
  • 6
  • 33
  • 48
moellivm
  • 65
  • 1
  • 4

1 Answers1

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:

Paulito.Bandito
  • 136
  • 2
  • 6