Search code examples
rgamautocorrelation

Temporal autocorrelation in GAM


I'm modelling species count data that has been collected sporadically over the last ~40 years against a range of environmental predictors. At present, my GAM looks like this:

k = gam(CountIndividuals ~ s(Date, bs = 'cr', k = 8) + 
s(ENSO, bs = 'cr', k = 4) + s(mean_wind_speed, bs = 'cr', k = 4) + 
s(CHL, bs = 'cr', k = 4) + s(SST, bs = 'cr', k = 4) + 
s(SIOD, bs = 'cr', k = 4), family = nb(link = log), 
data = Shy_Albatross, method = "REML")

I've been worried about autocorrelation in the variables, however upon inspecting k$residuals with ACF() and PACF() there didn't appear to be any autocorrelation.

My question is whether I need to assess each variable in the model individually? There should be autocorrelation in there values, however I'm not sure whether that is relevant.


Solution

  • An assumption of the model is that the observations are conditionally independent. If you model the autocorrelation through terms in the model, and it is reasonable to expect that the smooth functions of Date and the other variables in the model are accounting for the temporal structure in the data such that once we consider the model, the observations are independent.

    By looking at the residuals you are looking at the observations conditional upon the model.