I am attempting to estimate the effect of various variables on the time-series of counts of reported cattle stillbirths. We investigate the effect of day-of-week, month, holidays etc…and also the effect of non-temporal variables.
We performed model comparisons between Gaussian glm, Poisson glm and negbin glm and the latter seems most appropriate for our data. We found that the residuals from our best model are not i.i.d. but follow an autoregressive process of order 5 , AR(5). I therefore wish to re-run this model after adding an AR(5) correlation structure in order to get unbiased estimates and standard errors for the variables retained in the model.
In the past, I have been faced with a similar situation for a Gaussian glm and used the gls function with a corStruct object describing the within-group correlation structure. However, this would not work with our negbin model. Looking around on various help forums, I came across the possibilities of using generalized estimating equations instead.
The gee function (in gee package) has a corstr object which would allow me to specify an AR process of whichever order but there is no option to include a negbin family. The geeglm function (in geepack package) does recognized the negbin family but only gives an option to fit an AR(1) correlation structure. The corstr object seems to have a “userdefined” option but it is unclear how it could be defined for an AR(5) process.
In short, my questions are:
- is it possible to include an AR (p) correlation structure directly into a negbin glm? How?
- if GEE are the way forward, how can the the corstr object in geeglm be defined for an AR(p) process?