Spatial autocorrelation in residuals of spaMM model after controlling for it

101 views Asked by At

I am trying to control for spatial variation which I suspect to be strong in my dataset. I am comparing a linear model from lme4 with 3 explanatory variables - 1 continuous fixed effect, 1 discrete fixed effect, and 1 random grouping effect - against a model fitted with the spaMM package to control for spatial autocorrelation based on the information in this blog post: https://datascienceplus.com/spatial-regression-in-r-part-1-spamm-vs-glmmtmb/. My response variable appears fairly normally distributed/maybe slightly right-skewed.

mod1<-lmer(Y ~ X + Species + (1|Area), data=data)
mod2<-fitme(Y ~ X + Species + (1|Area) + Matern(1|X+Y), data=data, family="gaussian")

I am testing the residuals for spatial autocorrelation using DHARMa:

sims<-simulateResiduals(mod1)
testSpatialAutocorrelation(sims, data$Long, data$Lat, plot=TRUE) 

There is of course very highly significant spatial autocorrelation in the non-spatial model, but there still is nearly as much autocorrelation that is also very highly significant in the spatial model - isn't this supposed to have reduced to 0/non-significant? The assumption plots from DHARMa (plot(mod2)) have no significant issues and suggest the models fit well, so why have I still got so much autocorrelation if I've controlled for it? Or have I controlled for it incorrectly?

0

There are 0 answers