[R-sig-Geo] Spatial autocorrelation help

Dechen Lham dechen@lh@m @ending from ieu@uzh@ch
Tue Jul 10 19:46:21 CEST 2018


Hello all,

I would like some help in my problem below:

I am running a logistic regression and my best model residuals has spatial autocorrelation  (SAC) when checked as below and also on the raw data of the response type. My response is binary 0 and 1 (type of prey and to be predicted by several predictors). These type of prey are obtained from  a total of  200 locations (where the faecal samples are collected from).   In order to account for this SAC , I used the auto_covdist function from spdep package. But when i use this as a new predictor in my model, and then check for spatial autocorrelation in the residues of the model, there is still spatial autocorrelation,…..could u see if i am doing something wrong please?

#account for SAC in the model using weights
# auto_covariate is a distance weighted covariate
data$response <- as.numeric(data$response)
auto_weight <- autocov_dist(data$prey.type, xy=coords, nbs=1, type="inverse", zero.policy = TRUE,style="W", longlat = TRUE)

m5_auto <- glm(response ~  predictor1 + predictor2 + predictor3 + predictor4 + predictor1:predictor4, weight=auto_weight, family=quasibinomial("logit"), data=data)

# check spatial autocorrelation - first convert data to spatial points dataframe
dat <- SpatialPointsDataFrame(cbind(data$long, data$lat), data)
lstw  <- nb2listw(knn2nb(knearneigh(dat, k = 2)))

# check SAC in model residuals
moran.test(residuals.glm(m5_auto), lstw) # and gives the below:

Moran I test under randomisation

data:  residuals.glm(m5)  
weights: lstw  

Moran I statistic standard deviate = 1.9194, p-value = 0.02747
alternative hypothesis: greater
sample estimates:
Moran I statistic       Expectation          Variance 
     0.160824328      -0.004608295       0.007428642 

-Someone said its stupid to account for spatial autocorrelation in a logistic regression when you have a significant SAC using moran’s I. So i am now wondering how this can be solved? or does a SAC in a logistic regression be just ignored? 

I am new to spatial statistics and now idea how to move with such. I only know that my data has spatial
 autocorrelation (which i hope to have checked correctly using morans I as above) and now need to account for this in my analysis. Some advice would be greatly appreciated by people who have used to account for SAC in their logistic models.  Is a logistic mixed models an option to consider?especially if your covariates are spatial in nature,…i read somewhere that if you cant account for SAC in glm then you can move to mixed models esp if your covariates are spatial which is expected to digest the SAC. 

Help and advice would be greatly appreciated.



More information about the R-sig-Geo mailing list