Dear list members, I am using gam (from mgcv package in R) to model presence/absence data in 3355 cells of 1x1km (151 presences and 3204 absences). Even though I include a smooth with the spatial locations in the model to address the spatial dependence in my data, the results from a variogram show spatial autocorrelation in the residuals of my gam (range=6000 meters). Since I am modelling a binary response, using a gamm with a correlation structure is not advisable because it "performs poorly with binary data", neither gamm4 because (although is supposed to be appropriate for binary data) it has "no facility for nlme style correlation structures".
The alternative I have found is to fit my model using the function magic from the same mgcv package. Because I found no examples of how to use magic for spatially correlated data I have adapted the ?magic example for temporally correlated data. The results of the output change the coefficients of the model but do not remove the spatial autocorrelation and the smooth plots show the same effect. You can find find the output from my models and figures of the variograms and plots of the smooth effects in the following link https://stackoverflow.com/questions/61110762/gam-with-binomial-distribution-and-with-spatial-autocorrelation-in-r Could someone tell me if there is something wrong in my script? Does anyone know another alternative to remove the residuals' spatial autocorrelation from a binomial gam? Thank you very much. Kind regards, Carlos -- Carlos Bautista Institute of Nature Conservation Polish Academy of Sciences Mickiewicza 33 31-120 Krakow, Poland www.carpathianbear.pl www.iop.krakow.pl [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo