R – How to Account for Spatial Autocorrelation with a Binomial Regression Model

logisticrspatialspatial-interaction-model

I am using a binomial regression model for presence/absence, with 20 independent variables to test. The data has x and y coordinates and I would like to understand how can I take into account the spatial autocorrelation.

I already studied the correlation between the variables and run the same model for 1000 different samples (I have a big dataset that allows me to do this) to understand the distribution of each parameter and check for variables that might be introducing problems in my model.

glm_model <- glm(PA ~ Var1 + Var2 + Var3 + Var4 + Var5,family=binomial(link=logit))

However I believe I also need to account for spatial autocorrelation. I saw that there is a package that might help me (spdep), however I am not sure I completely understand if I can use my model or not. My question is what are my options ?

Best Answer

If you are happy to assume your binomial responses are coming from a spatially correlated gaussian random field via a logit link, and your non-spatial covariates have the usual log-linear form, then stuff it all into geoRglm:

http://cran.r-project.org/web/packages/geoRglm/vignettes/geoRglmintro.pdf

and once you've got your MCMC all tuned, out pops the parameter estimates.