4
$\begingroup$

I am attempting to fit a GLM to rate data. In my case it is the number of provisioning visits to a bird nest per hour. I model the data like in the example below including time as an offset.

number of visits ~ x , offset=log(time), family=poisson(link = log)

However this is complicated by the fact that my nests also have different numbers of chicks and I want to include this in my model. This suggests to me that I need to adjust my offset to account for both time and number of chicks. Am I thinking about this the correct way or do I need a different approach?

$\endgroup$
2
  • 3
    $\begingroup$ How about glm(visits ~ x + chicks, offset=log(time), family=poisson)? The offset is there because you want to estimate the effects of x on the rate of visits rather than the count of visits. Chicks don't change that. $\endgroup$ Commented Aug 13, 2014 at 18:39
  • $\begingroup$ You could easily use number of chicks as a covariate and then include time in your estimation of rates using the offset mechanism. $\endgroup$
    – DWin
    Commented Nov 17, 2023 at 20:01

1 Answer 1

3
$\begingroup$

I know nothing about ornithology, but I can give you some general advice. An offset is used to, effectively, include a feature with a coefficient fixed at precisely $1$. That is, the coefficient is assumed to be $1$ and is not estimated. I do not know if this is plausible in your field.

In a Poisson regression, the most common use of offsets is to adjust for periods of different lengths (recall that a Poisson model has several requirements, one of which is that all periods are of the same length). For example, you might look at the number of car accidents per month; because not all months have the same length, you could include an offset to account for the brevity of February compared to January. Naturally, we would expect that the additional number of days in January would slightly increase the average number of car accidents in that month, since people have more opportunities to get into wrecks. The offset corrects for this.

Incidentally, your code does not include an offset in any way; instead, it includes the effect of either x or log(time) as an additional feature. In R's GLM command, the offset is declared like this glm(y~x,offset=chicks).

Alternatively, you could include number of chicks as an additional feature and estimate a coefficient for it. This would express that there is some uncertainty in the effect of a chick on visits, and that you would like to estimate that effect from the data. I don't entirely understand why you believe that the number of chicks requires an offset, instead of being modeled as its own feature. Moreover, the number of chicks aren't in the same units as log(time), which makes me concerned that there's no sensible interpretation of the model.

Correcting for variable-length periods of time in your data collection makes perfect sense, though, and is standard practice.

$\endgroup$
2
  • 2
    $\begingroup$ Well, offsets can also be included directly in the model formula as y ~ x + offset(log(time)) $\endgroup$ Commented Dec 6, 2018 at 19:03
  • 1
    $\begingroup$ @kjetilbhalvorsen Oh wow, I had no idea! That's rather elegant. $\endgroup$
    – Sycorax
    Commented Dec 6, 2018 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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