# Take the log of an independent variable in a Poisson regression

Is it possible to take the log of an independent variable in a Poisson regression? What to I have to be aware of, when doing so? (The results are getting better, when assuming that the independent variable is with log link.)

• What do you mean by "the independant variable is with log link"? Are you actually talking about logging Y (the dependent variable) and doing linear regression, instead of Poisson regression? Or are you talking about logging one of the predictors in a Poisson regression?
– JMS
Commented Jun 11, 2011 at 17:34
• sorry fot this lack of clarity. I'm talking about logging independant variables, so the model in general is $log(E(y))=log(x_1)+x\beta$ Commented Jun 12, 2011 at 10:33

Thanks for the clarification. I agree with @Greg Snow that any transformation should make sense in the context of the problem. Why are you considering a log transform? Have you tried standardizing your predictors?

You want to keep in mind how the transformation changes the assumptions in your model. I'll use $\beta = (\beta_2, \dots, \beta_p)'$ and $X = (X_2, \dots, X_p)$. Your two models are

Log transform model: $E(Y|X_1,X) = \exp(\tilde\beta_1\log(X_1) + X\beta) = X_1^{\tilde\beta_1}\exp(X\beta)$

Original model: $E(Y|X_1, X) = \exp(\beta_1X_1 + X\beta)$.

For convenience I've overloaded $\beta$ slightly, in that their estimates would obviously be different under each model (in general).

A simple way to compare the two models is through their relative risk. Suppose we have two observations $y_i, y_j$ with the same covariate values except that $x_{i1} - 1 = x_{j1}$ ($x_{i1}$ is one unit greater than $x_{j1}$). The relative risk $RR=E(Y|X_1=x_{i1},X)/E(Y|X_1=x_{i1}-1,X)$ is then the multiplicative change in the rate caused by increasing $x_1$ by one unit. The $RR$ is given by

Log transform: $RR = \left(\frac{x_{i1}}{x_{i1} - 1}\right)^{\tilde\beta_1}$

Original model: $RR = \exp(\beta_1)$

RR under the log transform varies over the range of $x_{i1}$ (unless of course $\tilde \beta_1 = 0$). Does that make sense in your problem? In the original model the effect of a unit change in $x_1$ doesn't vary with its magnitude (i.e. increasing $X_1$ one unit has the same effect on the rate whether we move from 4 to 5, or 0 to 1, or 100 to 101, etc). Does that make sense in your problem?

The coefficient in the log transformed model is harder to interpret, so unless there is a good reason for the transformation I would pass.

You didn't say by what criterion the results are getting better, so it's hard to know for sure than any improvement in fit is "real". But even if it is, it might just be an indication that a Poisson regression is inappropriate. In particular the log transform removes the implicit proportional hazards assumption in the original model. Unfortunately it does so in a very rigid way, so while the overall fit might improve that doesn't necessarily mean you have a good model.

Edit:

A couple of points re: your comments. Your reference gives another way to interpret the coefficients via partial derivatives. Here, to compare the two models above we would look at $\frac{dE(Y|X)}{dx_1}$. So let's do that:

Log transform: $\frac{dE(Y|X_1,X)}{dx_1} = \frac{\tilde\beta_1}{x_1}\exp(\tilde\beta_1\log(x_1)+X\beta) = \tilde\beta_1x_1^{\tilde\beta-1}\exp(X\beta)$

Original: $\frac{dE(Y|X_1,X)}{dx_1} = \beta_1\exp(\beta x_1+X\beta) = \beta_1\exp(\beta_1 x_1)\exp(X\beta)$

Again, these are different models: compare the terms $\tilde\beta_1x_1^{\tilde\beta-1}$ and $\beta_1\exp(\beta_1 x_1)$. You can't interpret the log transformed model in the same way as the original model. However, you could apply that interpretation to $\log(X_1)$; the question is whether or not that's meaningful/reasonable/etc (a percent/unit change on the log scale is very different, obviously). (basically @Greg Snow's original point). If the only reason for the transformation is to reduce the excess variance or improve the residuals then I would look at other aspects of the model first.

In terms of decreasing the Pearson residuals: This isn't always a plus. You may be overfitting the data for one, and for another my original point applies - the log transformed predictor might be compensating for a misspecified model , perhaps in a less-than-obvious way. What are the sample mean and variance of $Y$ - are the data over/underdispersed? Have you considered another model, a negative binomial regression for example?

• it's getting better, because overdispersion reduces and Pearson residuals decrease (in a way that some observations are no influential points when comparing to the regular model with canonical log link) Btw: it seems to be possible to interpret the resulting coefficients as elasticities (page 4/17) [see References at the bottom]. Thus when $y$ increases by one percent, $x$ increase (decrease) by $\beta$ percent. Commented Jun 12, 2011 at 18:15
• References: google.de/… Commented Jun 12, 2011 at 18:17