I came to R from GLIM and its glm. My data sets (ecological community data) are severely over-dispersed, and so I was delighted to find out that the MASS library has glm.nb which is an advancement from the GLIM macros I had used (N.E.Breslow, Applied Statistics 33, 38--44; 1984). However, I need to use offset, but that failed. I am not (yet --- hopefully) fluent enough in R to be able to debug the code, but it seems that the problem comes in expanding `...' in the glm.nb call. The first time this goes smoothly: Call <- match.call() expands to (formula = TFLO ~ poly(PH, 2), offset = log(TOT)) which was my exact call. However, the second time fails: m <- match.call(expand = FALSE) expands to (formula = TFLO ~ poly(PH, 2), ... = list(offset = log(TOT))), and now the following commad will remove `... = list(offset = log(TOT))': m$method <- m$model <- m$x <- m$y <- m$control <- m$contrasts <- m$init.theta <- m$link <- m$... <- NULL leaving only (formula = TFLO ~ poly(PH, 2)). So the later offset <- model.extract(m, offset) fails (or offset is NULL). Finally, the actual fatal error comes from glm.control(), obviously via glm.fit: Error in glm.control(...) : unused argument to function So it seems that offset is still here, but glm.control did not know what to do with it. My R is 0.90.0, running under Linux 2.0.36. During my trials, I upgraded to VR 6.1-6, but the problem remained. Regards, jari oksanen -- Jari Oksanen - Dept Ecol Env Sci, Univ Helsinki, 15140 Lahti Ph. +358 3 89220312, Fax -- 89220289, Mobile +358 40 5136529 jari.oksanen at helsinki.fi http://www.helsinki.fi/~jhoksane ******************** Happy Year 0x7d0! ********************* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sat, 8 Jan 2000, Jari Oksanen wrote:> I came to R from GLIM and its glm. My data sets (ecological community data) > are severely over-dispersed, and so I was delighted to find out that the MASS > library has glm.nb which is an advancement from the GLIM macros I had used > (N.E.Breslow, Applied Statistics 33, 38--44; 1984). However, I need to use > offset, but that failed. > > I am not (yet --- hopefully) fluent enough in R to be able to debug the code, > but it seems that the problem comes in expanding `...' in the glm.nb call. The > first time this goes smoothly: > > Call <- match.call() > > expands to (formula = TFLO ~ poly(PH, 2), offset = log(TOT)) which was my > exact call. However, the second time fails:Can you please tell us exactly what you did (the precise call)? The correct formula would have been TFLO ~ poly(PH, 2) + offset(log(TOT)) (V&R3, p. 217-8). -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> > I came to R from GLIM and its glm. My data sets (ecological community data) > are severely over-dispersed, and so I was delighted to find out that the MASS > library has glm.nb which is an advancement from the GLIM macros I had used > (N.E.Breslow, Applied Statistics 33, 38--44; 1984). However, I need to use > offset, but that failed. >You might like to look at the gnlr function in my gnlm library (www.luc.ac.be/~jlindsey/rcode.html). It not only does negative binomial but several other overdispersed count distributions as well (double Poisson, multiplicative Poisson, gamma count, ...), works with nonlinear as well as linear regression, and the dispersion parameter can depend on covariates. Jim -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._