Using the offset as argument and in a formula should give the same output. As one can see here https://stackoverflow.com/a/29233096/426176.
However, using glm.nb
I get different results:
mod1 <- glm.nb(y ~ x1 + x2 + offset(log(pop)))
mod2 <- glm.nb(y ~ x1 + x2, offset(log(pop)))
I'm a bit confused about which is the most adequate when using glm.nb
.
I also use gam
with a negative binomial and a poison family and I also get different results, which make sense when using predict
as the offset
as an argument is ignored. Hence predicting the number of cases and not incidence.
From GAM help page: "offset: Can be used to supply a model offset for use in fitting. Note that this offset will always be completely ignored when predicting, unlike an offset included in formula: this conforms to the behaviour of lm and glm."