Poisson regression with different exposures dependent and predictor variables 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.
 A: 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.
