Re: [R] Fit Negbin glm model with autoregressive correlation structure

2014-02-04 Thread F.Vial
Dear Cristiano,
Thank you for your suggestion. It looks like an interesting option for what
we are trying to do. We'll look at your paper and package in more details.
Regards,
Flavie



--
View this message in context: 
http://r.789695.n4.nabble.com/Fit-Negbin-glm-model-with-autoregressive-correlation-structure-tp4684489p4684694.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Fit Negbin glm model with autoregressive correlation structure

2014-01-31 Thread flavie.vial
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.v...@vetsuisse.unibe.chmailto:flavie.v...@vetsuisse.unibe.ch






[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fit Negbin glm model with autoregressive correlation structure

2014-01-31 Thread Cristiano Varin
You may also introduce ARMA errors in negative binomial regression via Gaussian 
copulas. The following webpage illustrates how to use the package gcmr 
(Gaussian Copula Marginal Regression) for fitting negative binomial 
regression model with ARMA(2,1) errors: 

http://cristianovarin.weebly.com/gcmr.html

With best regards,
Cristiano Varin
-
Cristiano Varin cristiano.va...@unive.it
Department of Environmental Sciences, 
Informatics and Statistics
Ca' Foscari University of Venice

http://cristianovarin.weebly.com

Il 31/01/2014 09:41, flavie.v...@vetsuisse.unibe.ch ha scritto:
 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.v...@vetsuisse.unibe.chmailto:flavie.v...@vetsuisse.unibe.ch
 
 
 
 
 
 
 
   [[alternative HTML version deleted]]
 
 
 
 
 __
 
 R-help@r-project.org
  mailing list
 
 https://stat.ethz.ch/mailman/listinfo/r-help
 
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 
 and provide commented, minimal, self-contained, reproducible code.
 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.