[R] MASS glm.nb: Offset fails

Jari Oksanen jhoksane at ecology.helsinki.fi
Sat Jan 8 12:15:49 CET 2000

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

More information about the R-help mailing list