Hosia Aino
2013-Mar-15 13:31 UTC
[R] Poisson and negbin gamm in mgcv - overdispersion and theta
Dear R users, I am trying to use "gamm" from package "mgcv" to model results from a mesocosm experiment. My model is of type M1 <- gamm(Resp ~ s(Day, k=8) + s(Day, by=C, k=8) + Flow + offset(LogVol), data=MyResp, correlation = corAR1(form= ~ Day|Mesocosm), family=poisson(link=log)) where the response variable is counts, offset by the log of sample volume. Unfortunately, the residuals from the model show heteroscedasticity. While trying to follow up on this, I have run into following problems: 1) How to estimate the overdispersion parameter from a (Poisson) gamm? I have not been able to extract residual degrees of freedom from M1. 2) How to manually estimate theta for a negative binomial gamm? I would like to see if applying a negative binomial distribution with log link (model below) would solve the problem. However, negbin in gamm requires a known theta... M2 <- gamm(Resp ~ s(Day, k=8) + s(Day, by=C, k=8) + Flow + offset(LogVol), data=MyResp, correlation = corAR1(form= ~ Day|Mesocosm), family= negbin(THETA, link="log")) 3) And finally, can I somehow compare the models M1 and M2? Trying anova(M1,M2) gives the message: "Error in eval(expr, envir, enclos) : object 'fixed' not found" (and I am anyway not sure if this is a valid approach between Poisson and negbin gamms). I am most grateful for any help! Aino Aino Hosia Postdoc Havforskningsinstituttet/Institute of Marine Research PO Box 1870 Nordnes, N-5817 Bergen, Norway (Nordnesgaten 50) Tel: +47 55 23 53 49 E-mail: aino.hosia@imr.no<mailto:aino.hosia@imr.no> www.imr.no<http://www.imr.no/> [[alternative HTML version deleted]]