I recently discovered how to model exposures over time using the log of (e.g.) time as an offset in a Poisson regression.

I understood that the offset corresponds to having time as covariate with coefficient 1.

I'd like to better understand the difference between using time as an offset or as a normal covariate (therefore estimating the coefficient). In which situation should I want to use one method or the other?

UPGRADE: I don't know if it is interesting, but I ran a validation of the two methods using randomly split data repeated 500 times and I noticed that using the offset method leads to a larger test error.

up vote 23 down vote accepted

Offsets can be used in any regression model, but they are much more common when working with count data for your response variable. An offset is just a variable that is forced to have a coefficient of $1$ in the model. (See also this excellent CV thread: When to use an offset in a Poisson regression?)

When used correctly with count data, this will let you model rates instead of counts. If that is of interest, then it is something to do. Thus, this is the context in which offsets are used most frequently. Let's consider a Poisson GLiM with a log link (which is the canonical link).

\begin{align} \ln(\lambda) &= \beta_0 + \beta_1X & ({\rm counts})& \\ \ln\bigg(\frac{\lambda}{{\rm time}}\bigg) &= \beta_0 + \beta_1X & ({\rm rates})& \\ &\Rightarrow \\ \ln(\lambda) - \ln({\rm time}) &= \beta_0 + \beta_1X \\ \ln(\lambda) &= \beta_0 + \beta_1X + 1\times \ln({\rm time}) & ({\rm still\ rates})& \\ &\ne \\ \ln(\lambda) &= \beta_0 + \beta_1X + \beta_2\times \ln({\rm time})\quad {\rm when}\ \beta_2 \ne 1 & ({\rm counts\ again})& \end{align}

(As you can see, the key to using an offset correctly is to make $\ln({\rm time})$ the offset, not $\rm time$.)

When the coefficient on $\ln({\rm time})$ isn't $1$, you are no longer modeling rates. But since $\beta_2 \in (-\infty, 1)\cup (1, \infty)$ provides much greater flexibility to fit the data, models that don't use $\ln({\rm time})$ as an offset will typically fit better (although they may also overfit).


Whether you should model counts or rates really depends on what your substantive question is. You should model the one that corresponds to what you want to know.

As far as what it might mean for $\beta_2$ not to be $1$, consider an example where time isn't the variable in question. Imagine studying the number of surgical complications at different hospitals. One hospital has many more reported surgical complications, but they might claim that the comparison isn't fair because they do many more surgeries. So you decide to try to control for this. You can simply use the log of the number of surgeries as an offset, which would let you study the rate of complications per surgery. You could also use the log of the number of surgeries as another covariate. Let's say that the coefficient is significantly different from $1$. If $\beta_2 > 1$, then the hospitals that do more surgeries have a higher rate of complications (perhaps because they are rushing the job to get more done). If $\beta_2 < 1$, the hospitals that do the most have fewer complications per surgery (perhaps they have the best doctors, and so do more and do them better).

Seeing how this could happen if the variable in question were time is a little more complicated. The Poisson distribution arises from the Poisson process, in which the time between events is exponentially distributed, and hence there is a natural connection to survival analysis. In survival analysis, the time to events are often not distributed as an exponential, but the baseline hazard can become greater or lesser over time. Thus, consider a case where you are modeling the number of events that occur following some natural starting point. If $\beta_2 > 1$, that means the rate of events is speeding up, whereas if $\beta_2 < 1$, that means the rate of events is slowing down.

For a concrete example of the former, imagine a scan that counts the number of cancer cells a period of time after the initial tumor was surgically removed. For some patients, more time has elapsed since the surgery and you wanted to take that into account. Since once a cancer has regained its foothold it will begin to grow exponentially, the rate will be increasing over the time since the surgery without additional treatment.

For a concrete example of the latter, consider the number of people who die of a disease outbreak for which we have no treatment. At first, lots of people die because they were more susceptible to that disease, or already had a compromised immune system, etc. Over time, as the population of people remaining is less susceptible to the disease, the rate will decrease. (Sorry this example is so morbid.)

  • Thank you very much Gung for your comprehensive answer! Please tell me if I understood well. If we use time as an offset we assume a linear positive relationship between time and events whose angular coefficient is given by the other predictors exponentiated $y = {\rm time}*\exp(\sum_{1}^{p}\beta_pX_p + {\rm const})$. Instead if we use log time as covariate we estimate the exponential effect of time on events, which can be either positive o negative $y = {\rm time}^{\beta_{{\rm time}}}*\exp(\sum_{1}^{p}\beta_pX_p + {\rm const})$. (cont...) – Bakaburg Oct 4 '15 at 11:30
  • 1
    Therefore why one should assume that the relationship between time and events is linear and growing? Wouldn't be better to estimate the shape of such relationship in every case? I have two more questions: 1. what would it mean to use not log transformed time as covariate instead? 2. (maybe I should edit the question or ask a new one for this) I read that poisson models can actually be used with not integer y too. Thus I could write in R: glm(I(y/time) ~ cov.1 + ... + cov.n, poisson) and have the same results that I have using offset(log(time)). I tried this but I get different coefficients. – Bakaburg Oct 4 '15 at 11:40
  • The Poisson dist is for integers only; you should not enter a fraction on the LHS. Not using the log transform means modeling rates of events per exponentially unit time, which will probably never be sensible in the real world. – gung Oct 4 '15 at 14:09
  • Ok about why time need to be log. Still I haven't understood in which case one should use an offset instead of modelling the time variable. About not integer values with poisson, I'm often in the situation in which I have to model a zero bound continuous dependent variable. Initially I used to model them using log linear regressions, but this would give me problems with in the presence of zeros. Then I found that left alone standard errors, poisson model are ok to get estimates even without counts. I usually then use bootstrap for the intervals. ref: stats.stackexchange.com/a/38588/6479 – Bakaburg Oct 7 '15 at 15:27
  • 1
    @Bakaburg, time is probably correlated with them. That isn't any different from any other regression modeling situation. I don't see the problem here. You are either interested in modeling average rates or you aren't. – gung Oct 9 '15 at 7:43

Time offsets can usually be viewed as your model estimating the rate an event occurs per unit time, with the offset controlling for how long you observed different subjects.

In poisson models you are always estimating a rate that something happens, but you never get to observe this rate directly. You do get to observe the number of times that an event happens over some amount of time. The offset makes the connection between the two concepts.

For example, you observed subjects shooting baskets for varying amounts of time, and you counted the number of successful baskets for each subject. What you are really interested in in how often each subject sinks a basket, i.e. the number of successful baskets each subject expects to sink each minute, as that is a somewhat objective measure of their skill. The number of baskets you actually observed sunk would then be this estimated rate times how long you observed the subject attempting. So you can think in terms of the units of the response, the number of baskets per minute.

Its difficult to think of a situation where you would use time observed as a covariate in a poisson regression, since by its very nature you are estimating a rate.

For example, if I want to asses the effect of being american vs european (very silly example) on the number of basket, adding time as a covariate would allow me to assess that effect "independently" from the time passed shoting, isn't it? Furthermore it would also give me an estimate of the effect of time on the outcome.

Here's an example that hopefully highlights the danger of this. Assume that Americans and Europeans, in truth, sink the same number of baskets each minute. But say that we have observed each European for twice as long as each American, so, on average, we have observed twice as many baskets for each European.

If we set up a model including parameters for both time observed and an indicator for "is European", then both of these models explain the data:

$$ E(\text{baskets}) = 2 c t + 0 x_{\text{Eropean}}$$ $$ E(\text{baskets}) = 0 t + 2 c x_{\text{Eropean}} $$

(where $c$ is some constant, which is the true rate that both types of players make baskets).

As a statistician, we really want, in this situation, our model to inform us that there is no statistical difference between the rate that Europeans make baskets and the rate Americans make baskets. But our model has failed to do so, and we are left confused.

The issue is that we know something that our model does not know. That is, we know that if we observe the same individual for twice as much time, that, in expectation, they will make twice as many baskets. Since we know this, we need to tell our model about it. This is what the offset accomplishes.

Maybe using the offset method is appropriate when we know that the events happen uniformily along time!

Yes, but this is an assumption of the poisson model itself. From the wikipedia page on the poisson distribution

the Poisson distribution, named after French mathematician Siméon Denis Poisson, is a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval of time and/or space if these events occur with a known average rate and independently of the time since the last event.

  • 2
    Thanks for your answer. But using time as a covariate wouldn't it give me the same answer? For example, if I want to asses the effect of being american vs european (very silly example) on the number of basket, adding time as a covariate would allow me to assess that effect "independently" from the time passed shoting, isn't it? Furthermore it would also give me an estimate of the effect of time on the outcome. Sometimes time is not always important to a count variable, for example when the events happen all at the beginning of the observation period. – Bakaburg Oct 3 '15 at 19:44
  • Maybe using the offset method is appropriate when we know that the events happen uniformily along time! – Bakaburg Oct 3 '15 at 19:44
  • 1
    @Bakaburg I added an attempted response. I hope it helps! – Matthew Drury Oct 3 '15 at 20:08

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.