flavie.vial at vetsuisse.unibe.ch
2014-Jan-31 08:41 UTC
[R] Fit Negbin glm model with autoregressive correlation structure
Hello, 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? Thank you for your suggestions, Dr Flavie Vial Veterinary Public Health Institute DCR-VPH, Vetsuisse Fakultät Schwarzenburgstrasse 155 CH-3003 Bern Switzerland flavie.vial@vetsuisse.unibe.ch<mailto:flavie.vial@vetsuisse.unibe.ch> [[alternative HTML version deleted]]