[R-sig-ME] Autocorrelation in a GAMM for nightly time series

Andrew Digby andrewdigby at mac.com
Tue Jun 4 09:22:37 CEST 2013


Dear List,

I'm analysing call counts of a nocturnal species in response to temporal and environmental effects. Over a period of 3 years I divide each night into 10 equal-length blocks, and count the calls of each sex in each block. 

I then fit the following negative binomial GAM using mgcv:

gam(ncalls ~ sex + year + s(month) + s(time of night) + s(moon) + s(temperature) + s(rain) + offset(blocklength), family=negbin(c(1,5)), data=dc)

Where 'time of night' = 1-10 = the block number during the night, and blocklength = the length of that block (this changes throughout the year; hence the offset). 

Not surprisingly, the acf shows significant correlation between adjacent time blocks, with a periodicity of 10. This is because counts in a particular block will be similar to those in the blocks immediately before and after, and also to the same block on other nights (the species has a quite regular pattern of decreasing call rates as the night progresses).

To address these autocorrelation problems, I've tried various ARMA correlations, with correlation between time of night blocks, grouped by day (or week) and sex:

gamm( .., correlation=corARMA(form=~TimeofNight | DayofYearSex), p, q)  (p=1:3, q=0:3)
gamm( .., correlation=corARMA(form=~TimeofNight | WeekofYearSex), p, q)

This improves the ACF, but there are still correlations between residuals at same time of night - e.g. peaks every 10 lags.

My questions are:
1) Can I rely on the ACF when my time series isn't actually consecutive time bins, since it only includes each night (not full days). This means, for example, that the time lag between observations 9 & 10 (~1 hour) is much longer than that between 10 & 11 (~12 hours = daytime)?
2) (if yes to the above) How can I construct a correlation structure in a GAMM which allows for correlation between adjacent time bins within each night, and between the same time bin on different nights? 

Many thanks,

Andrew



More information about the R-sig-mixed-models mailing list