[R-sig-Geo] Spatial autocorrelation help

Orcun Morali orcunmor@li @ending from gm@il@com
Wed Jul 11 19:01:58 CEST 2018


Hi Dechen,

As for measuring spatial autocorrelation, one thing I noticed about your 
output is that you are using the randomization assumption in 
spdep::moran.test. Randomization assumption is not appropriate for 
Moran's I of regression residuals and spdep::lm.morantest is the 
function to correctly calculate moments of the measure for regression 
residuals anyway. Before using lm.morantest though, if I were you, I 
would check whether its inference applies to logistic regression 
residuals as well, since the theory was initially based on the classical 
regression.

As for fitting a spatial logistic model if you need it, McSpatial 
package in R might help you.

Best Regards,

Orcun

On 10/07/18 20:46, Dechen Lham wrote:
> 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.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list