
Dear List,

I'm modelling variation of call rates of a nocturnal bird with time and weather conditions. I've divided each night into 12 equal periods, and have call counts for each sex in each period over three years. My basic model is like this:

gam1 <- gam(ncalls ~ sex + year + s(day of year, by=fSex) + s(time of night, by=fSex) + s(moon) + s(temperature) + s(rain) + offset(blocklength), family=negbin(c(1,5)), data=dc)

My problem is that the ACF shows significant and cyclic correlations, with period 12 (the number of bins in each night). The ACF for the above gam is on the left panel of this pdf.  This pattern appears because the number of counts in one bin are correlated not only with the adjacent bins, but also with the same and adjacent bins on other nights. E.g. the 3rd bin on one night will be highly correlated with the 2nd and 4th bins on that night, but also with the 3rd, 2nd and 4th bins on different nights. So I appear to need some sort of composite correlation structure: AR1(time of night | day of year) + AR1(1|time of night). As far as I can tell, that's not possible in a GAMM in R.

I've also tried:

1) Using a tensor product for day of year + time of night, as suggested by Ben Bolker: 

gam1.te <- gam(ncalls ~ sex + year + te(day of year, time of night, by=fSex) + s(moon) + s(temperature) + s(rain) + offset(blocklength), family=negbin(c(1,5)), data=dc)

This certainly changes the ACF, but actually makes the periodic autocorrelation worse - see the right panel of this pdf.

2) Using various ARMA correlation structures, with the same fixed structure as gam1, and gam1.te. This model gives a better ACF (see here; right panel is with tensor product), although again, the tensor product accenutates the cyclic pattern.

gamm1 <- gamm(..., correlation=corARMA(p=2, q=1, form=~1|yrwksex)) where the grouping yrwksex is the week of each year for each sex - e.g. 2010049M. This grouping is necessary to enable GAMM to run; with no grouping it would take a very long time with ~23,000 observations.

I've been battling this for some time, and am reposting this problem in the hope that someone might be able to make a further suggestion. My two main issues are:

1) Fixed structure. As Ben Bolker noted, it's likely that a missing fixed structure term is the cause. But as far as I can tell, there are no further fixed terms I can add. Any ideas?
2) Cyclic correlation. Is there anyway of modelling a cyclic correlation structure in a GAMM - perhaps with something like corRWave in ramps? Or else a composite correlation structure, with an AR correlation between bins on the same night, and an AR structure between bins on different nights? 

Any suggestions would be much appreciated!

Many thanks,

Andrew



	[[alternative HTML version deleted]]

