How much of a problem are autocorrelated residuals of a binary GAM (Generalized Additive model)? I'm trying to predict high or low crime rate in municipalities (binary 1/0 response variable) using a range of socioeconomic variables. Im doing this with a panel dataset with 300 municipality over 17 years (2006-2016). To be more specific I train the model on data from 2006-2015 and then predict with data on features/predictors from 2016.
The binary GAM I'm using for prediction has quite heavily autocorrelated residuals, how will this affect my predictions?
I have generally found very limited information on using panel/longitudinal data sets with binary response variables for prediction with Machine learning methods (Random Forest, Naive Bayes, K-NN) and would therefore also appreciate thoughts on this.
One thing that bugs me is how to make a model like random forest or GAM notice the id and time dimensions of a panel dataset.
 A: The autocorrelation is going to affect any statistical inference you try to do with the model, such as testing is smooths are significant.
It is trivial to include random effects and spatio-temporal smooths in the GAM. You'll need to expand on what features you want to include in this model but, for example:


*

*An isotopic spatial smoother (on coords x and y) plus region specific temporal trends all with same wiggliness (but not same shape) would include
gam(y ~ s(x,y) + s(time, region, bs = 'fs'), data = foo, method = 'REML')


*An isotropic spatial smoother plus region specific temporal trends with different wiggliness
gam(y ~ region + s(x,y) + s(time, by = region), data = foo, method = 'REML')

and we can build up from there. For example, a Markov Random Field smooth can be used for the regions if they are areal data (administrative boundaries etc), and the random effect basis can be used if you want a random intercept per region or subject. (Note the above are using the syntax from the mgcv package.)
