My question may be of technical nature: I am trying to model disease counts (d) by using population (p) as offset to control for exposure. In R, I found two possible ways to go:
m1 -> glm(d ~ 1 + offset(log(n)), family=poisson, data=dat)
m2 -> glm(d ~ 1, family=poisson, data=dat, offset=log(n))
The summary of m1 and m2 shows that summary(m1) = summary(m2) but if I try to calculate the McFadden through the pR2 (pscl package): McFadden(m1) ≠ McFadden(m2).
Does someone have an explanation for that?
Here is the source code of
pscl:::pR2.glm:If the offset is specified in the formula, it gets lost in the second line (
updateto compute the intercept-only model).See this example: