I am trying to fit a Poisson regession in R, using rates:

$\ln(\mathrm{rate}_i) ~= a + bx_i + c \ln(\mathrm{old\_rate})_i$

My issue is that the predictor variable $(\mathrm{old\_rate})$ is also a rate, and each observation has a different exposure for both $\mathrm{rate}$ and $(\mathrm{old\_rate})$.

For example, an observation might have 5 events in 10 days as the rate, and 25 events in 40 days as the old rate.

I can control for different exposures on the left hand side of the equation by fitting counts and controlling for exposure:

$\ln(\mathrm{count}_i) ~= \mathrm{exposure(\ln(\mathrm{count}_i))} + a + bx_i + c \ln(\mathrm{old\_rate})_i$

but R doesn't seem to let me control for the different exposures in $(\mathrm{old\_rate})_i$ variable.

Is there a way to control for this? I need the regression to take into account that $(\mathrm{old\_rate})$ is based on a small exposure for some observations and a large exposure for others.


1 Answer 1


One way of doing this is to set up a generalized linear mixed effects model for two sets of observations per item/unit/whatever (=one current observation) with a random item effect (following e.g. a gamma distribution on the rate scale, or a normal distribution on the log(rate scale)), i.e. $$\log(\text{expected count}_{ij}) = u_i + \log(\text{exposure}_j) + \ldots$$ for $j=1,2$ (old rate, or new), where $u_i$ is the random effect. I left out the remainder of the regression equation, because it may differ between old and new observations (or not) and will depend on what makes sense (e.g. if $x_i$ indicates some kind of intervention you applied, then you would want to have that in only for the new post-intervention observations, but not the pre-intervention ones). You also probably want to allow for a different intercept for the old and the new data or allow the random effect to not be centered on zero on the log-rate scale (or on 1 on the rate scale), but one or the other should be sufficient.

I am not sure which R package would fit this for you (in SAS the COUNTREG procedure would do it), but searching for +R +"generalized linear mixed effects" +Poisson or +R +Poisson +frailty may be a good way of finding suitable packages.

  • $\begingroup$ This does not estimate $c$ though in the original OP's question (the effect of the prior rate on the current rate). $\endgroup$
    – Andy W
    Commented May 27, 2016 at 12:16
  • $\begingroup$ As I understood it, the OP only wants to control for it and primarily aims to make inference about something else, which is possible in this manner. Also, would -assuming a r.e. not centered on 0 - the intercept for the new data not tell us how old and new rates relate? $\endgroup$
    – Björn
    Commented May 27, 2016 at 12:43
  • $\begingroup$ This is a different model than the original the OP specified. It may be reasonable, it may not be. I don't see how the $u_i$ says anything about how the rates relate to one another, but the intra-class correlation may be a reasonable substitute since there are only two periods. $\endgroup$
    – Andy W
    Commented May 27, 2016 at 13:19
  • $\begingroup$ I do not see how one could get around using a different model, do you? Perhaps there is some way that in some sense uses the same model (e.g. fit Bayesian model to old data, sample from posterior of random subject effects, fit model for each sampled value). Simplest case (no other covariates, no interventions etc.) for how this says something about the rates is: $\log E Y_{i1} = u_i + \log( \text{exposure}_{i1})$, $\log E Y_{i2} = a + u_i + \log( \text{exposure}_{i2})$ with $e^{u_i}$ following e.g. a gamma distribution. In this case $a$ is the log ratio in rates between period 1 and period 2. $\endgroup$
    – Björn
    Commented May 27, 2016 at 13:59
  • $\begingroup$ Thanks for your reply. @Andy is correct, I really am interested in estimating $c$, the effect of the old rate on the current rate. This would allow me to compare the relative importance of the previously observed rate $c$ to my other variable $b$. It does not seem easy to allow for varying confidence in the old rate (due to different exposures), but I must do that since an old rate of 5 events in 10 cases is much more uncertain than an old rate of 500 events in 1000 cases $\endgroup$
    – ig0101
    Commented May 27, 2016 at 14:04

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.