# Choosing a correlation structure for a GAM-GEE with multiple clusters

I am working with presence-absence data and want to use a GEE, fitting splines to my environmental co-variates, in order to account for non-linear response to my parameters and the fact that within individual non-independance between sequential observations is apparent. Essentially the goal is to estimate the effect of environmental variables on the presence of a population.

What is the best correlation structure to use when I want to assume independence between individuals but non-independence within individuals?

I am using the R package geepack to fit the GEEs and my current working model looks like this:

geeglm(used ~ ns(temp) + ns(temp2), id=id, data=data, corstr = "independent", family=binomial)

• What do you mean by sequential? Regularly spaced in time or irregularly? – Gavin Simpson Aug 30 '17 at 17:08
• Regularly spaced - they are interpolated, regularised locations from gps data. – Jojo Ono Aug 30 '17 at 17:11
• If this is time series then I'd start with an AR(1). But you mention GPS so is this a spatial dependence? – Gavin Simpson Aug 30 '17 at 17:18
• Yes spatially and temporally autocorrelated. I would use AR1 but it doesnt account for spatial autocorrelation and assumes only a temporal component? – Jojo Ono Aug 30 '17 at 17:44
• This is all useful info that should be in your original question. I don't think it is practically possible to do what you want with geeglm() at least not without creating your own fixed correlation matrix. geeglm() has no options for a spatial correlation structure from what I can see and certainly can't combine two structures unless you estimate the relevant parameters yourself and build your own correlation to go into the model. I would try with the AR(1) and then do a lot of model checking to see if spatial auto correlation remains in the residuals, as a start. – Gavin Simpson Aug 30 '17 at 18:06