Mark Na
2011-Jul-01 21:09 UTC
[R] Poisson GLM with a logged dependent variable...just asking for trouble?
Dear R-helpers, I'm using a GLM with poisson errors to model integer count data as a function of one non-integer covariate. The model formula is: log(DV) ~ glm(log(IV,10),family=poisson). I'm getting a warning because the logged DV is no longer an integer. I have three questions: 1) Can I ignore the warning, or is logging the DV (resulting in non-integers) a serious violation of the Poisson error structure? 2) If the answer to #1 is "no, don't ignore it, it's serious" then can I use a quasipoisson error structure instead (does not give the same warning) and if so are there any pitfalls to using the quasipoisson model? Are there any better alternatives for count data where the counts must be logged? Or, should I just abandon logging the DV? In that case, how could I compare the fit of a Poisson model (without logging the DV) to that of a GLM with normal errors (with a logged DV). AIC would not be valid because the DVs are different, right? 3) The quasipoisson model doesn't return an AIC value. Why, and is there anything I can do to calculate AIC manually, that would allow me to compare this model to other models? Many thanks in advance for your help! Cheers, Mark
ONKELINX, Thierry
2011-Jul-04 07:39 UTC
[R] Poisson GLM with a logged dependent variable...just asking for trouble?
Dear Mark, I think you want glm(DV ~ log10(IV), family=poisson) Note that the poisson family uses the log-link by default. Hence you don't need to log-transform DV yourself. Best regards, Thierry ---------------------------------------------------------------------------- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics & Quality Assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 Thierry.Onkelinx at inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey> -----Oorspronkelijk bericht----- > Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] > Namens Mark Na > Verzonden: vrijdag 1 juli 2011 23:10 > Aan: r-help at r-project.org > Onderwerp: [R] Poisson GLM with a logged dependent variable...just asking for > trouble? > > Dear R-helpers, > > I'm using a GLM with poisson errors to model integer count data as a function of > one non-integer covariate. > > The model formula is: log(DV) ~ glm(log(IV,10),family=poisson). > > I'm getting a warning because the logged DV is no longer an integer. > > I have three questions: > > 1) Can I ignore the warning, or is logging the DV (resulting in > non-integers) a serious violation of the Poisson error structure? > > 2) If the answer to #1 is "no, don't ignore it, it's serious" then can I use a > quasipoisson error structure instead (does not give the same > warning) and if so are there any pitfalls to using the quasipoisson model? Are > there any better alternatives for count data where the counts must be logged? > Or, should I just abandon logging the DV? In that case, how could I compare the > fit of a Poisson model (without logging the DV) to that of a GLM with normal > errors (with a logged DV). AIC would not be valid because the DVs are different, > right? > > 3) The quasipoisson model doesn't return an AIC value. Why, and is there > anything I can do to calculate AIC manually, that would allow me to compare > this model to other models? > > Many thanks in advance for your help! > > Cheers, Mark > > ______________________________________________ > R-help at 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.