# Checking spatial autocorrelation by plotting residuals?

For my analysis in biology, I want to study the effects of several factors (climate, cultivated area...) on insect dynamics and phenology. For that, I have data of insect captures from several traps along the years. I want to explain some variables like annual abundance according to the independent variables. I don't want to have a good forecasting model; my goal is mainly to explain what part of my dependent variable variance is explained by the regressors. My dependent variables are prone to be spatially autocorrelated : their value in a trap may depend on the value in another trap.

My dataset looks like this (for simplification, there are only two independent variables here). It's unbalanced : I may have data between 1985-1995 for one trap and between 1990-2000 for another for example.

I first thought about using panel data analysis but couldn't manage to do it and now I'm trying it with GLM. My idea is first to build that kind of model : (I'm using R formulation : here "Trap" and "Year" are put as random effects.)

Dep.variable ~ Indep.variable + Indep.variable2 + (1|Trap) + (1|Year) + error term

Though "Trap" is put as a random effect, there could be some remaining residual spatial autocorrelation. So, I would like to check if there is some correlation between traps within the same year, but independently of years : I want to know if there is an average autocorrelation, not in a particular year.

So my question is : if I plot the residuals of my model against each trap and see that the distribution is the same for each trap, can I conclude that there is no remaining autocorrelation for my variable ? Or is there some sort of test I could use ? I know Moran and Mantel tests, but it seems to me i cannot use them in that case.

• How many data points? You could try to estimate a variogram from the residuals. – kjetil b halvorsen Sep 16 '17 at 15:33