Where does the offset go in Poisson/negative binomial regression? [duplicate]

(First of all, just to confirm, an offset variable functions basically the same way in Poisson and negative binomial regression, right?)

Reading about the use of an offset variable, it seems to me that most sources recommend including that variable as an option in statistical packages (exp() in Stata or offset() in R). Is that functionally the same as converting your outcome variable to a proportion if you're modeling count data and there is a finite number that the count could have happened? My example is looking at employee dismissal, and I believe the offset here would simply be log(number of employees).

And as an added question, I am having trouble conceptualizing what the difference is between these first two options (including exposure as an option in the software and converting the DV to a proportion) and including the exposure on the RHS as a control. Any help here would be appreciated.

• Not correct about choosing offset. Usually you will want the offset to be the log(number at risk) or log(person-time) since the link is log().
– DWin
Commented Aug 8, 2013 at 6:33
• Sorry, I'm not sure I understand - which part is not correct? Are you saying that the offset chosen should be log([number at risk]) and not just [number at risk]? Oops, I actually did mean to write that in the OP - I'll edit that now. Commented Aug 8, 2013 at 21:34
• Just a note to add that Stata can complicate the issue of what is going into the model -- exp() requires the pre-calculated log(number at risk) as per @DWin's answer; while offset() takes the original (number at risk) as an input, but calculates the log of this for you before using in the model. So they return the same results, but require different forms of input. Commented Aug 8, 2013 at 21:53
• Does that mean that the function call by Hong below is then incorrect? Should it be offset(Holders) instead? Because his estimated coefficients did stay the same... Commented Aug 8, 2013 at 22:41
• A quick comment on using offsets -- these are in most instances vital to having an appropriate model. I tell students that the need for the offset variable is to compare rates of events between groups [or covariate values] rather than comparing the absolute counts of events -- with the former almost always being our question of interest. Commented Aug 8, 2013 at 22:56

Recall that an offset is just a predictor variable whose coefficient is fixed at 1. So, using the standard setup for a Poisson regression with a log link, we have:

$$\log \mathrm{E}(Y) = \beta' \mathrm{X} + \log \mathcal{E}$$

where $\mathcal{E}$ is the offset/exposure variable. This can be rewritten as

$$\log \mathrm{E}(Y) - \log \mathcal{E} = \beta' \mathrm{X}$$ $$\log \mathrm{E}(Y/\mathcal{E}) = \beta' \mathrm{X}$$

Your underlying random variable is still $Y$, but by dividing by $\mathcal{E}$ we've converted the LHS of the model equation to be a rate of events per unit exposure. But this division also alters the variance of the response, so we have to weight by $\mathcal{E}$ when fitting the model.

Example in R:

library(MASS) # for Insurance dataset

# modelling the claim rate, with exposure as a weight
# use quasipoisson family to stop glm complaining about nonintegral response
glm(Claims/Holders ~ District + Group + Age,
family=quasipoisson, data=Insurance, weights=Holders)

Call:  glm(formula = Claims/Holders ~ District + Group + Age, family = quasipoisson,
data = Insurance, weights = Holders)

Coefficients:
(Intercept)    District2    District3    District4      Group.L      Group.Q      Group.C        Age.L        Age.Q        Age.C
-1.810508     0.025868     0.038524     0.234205     0.429708     0.004632    -0.029294    -0.394432    -0.000355    -0.016737

Degrees of Freedom: 63 Total (i.e. Null);  54 Residual
Null Deviance:      236.3
Residual Deviance: 51.42        AIC: NA

# with log-exposure as offset
glm(Claims ~ District + Group + Age + offset(log(Holders)),
family=poisson, data=Insurance)

Call:  glm(formula = Claims ~ District + Group + Age + offset(log(Holders)),
family = poisson, data = Insurance)

Coefficients:
(Intercept)    District2    District3    District4      Group.L      Group.Q      Group.C        Age.L        Age.Q        Age.C
-1.810508     0.025868     0.038524     0.234205     0.429708     0.004632    -0.029294    -0.394432    -0.000355    -0.016737

Degrees of Freedom: 63 Total (i.e. Null);  54 Residual
Null Deviance:      236.3
Residual Deviance: 51.42        AIC: 388.7

• This is an excellent answer, thank you for clarifying the algebraic identity. Commented Oct 25, 2013 at 1:43
• Fantastic answer Commented Dec 10, 2016 at 23:23

The offset does act similarly for both Poisson and NB. The offset has two functions. For Poisson models, the actual number of events defines the variance, so that's needed. It also provides the denominator, so you can compare rates. It's unite-less.

Just using a ratio will mess up the standard errors. Having a model,that deals with the offset as most Poisson regression model functions do takes care of both the standard errors AND comparing rates.

• What do you mean by mess up the SEs? Commented Aug 8, 2013 at 21:45
• Is the reasoning here that the ratio will no longer properly fit the Poisson distribution? Commented Aug 8, 2013 at 21:50
• Thread necromancy, but for anyone reading this in 2017, I think this means converting to a ratio erases the information from the total number of trials: 1 out of 10 should have a different SE than 10 out of 100, but they both get converted to 0.1. Commented Oct 5, 2017 at 23:03