# interpretation of odds ratio when independent variable is log transformed

In logistic regression, we derive the odds ratio by exponentiating the coefficient (estimate). If one of my independent variables ($$X_1$$) was log transformed (natural log), how should I interpret the odds ratio in such cases?

For example:

• $$X_1$$ has an OR of 0.46 (95% C.I: 0.24, 0.93) for a binary outcome of $$Y$$.
• $$X_1$$ was log transformed (natural log)

In the above results, usually (if no log transformation was done) one would have interpreted as "for every one unit increase in $$X_1$$, the odds of outcome $$Y$$ would have increased by 0.46". But this variable was log transformed (natural log, base = 2.72) during the pre-processing stage of the model creation.

Any suggestions pls

Let's look at what's going on behind the scenes. A logistic regression model (binomial GLM) looks like this: $$\log\left(\frac{\pi}{1-\pi}\right)=\beta_0+\beta_1X_1$$ assuming we're only fitting an intercept and one parameter for your $$X_1$$ variable.

As you correctly state, exponentiating the coefficients gives us the odds: $$\exp\left[\log\left(\frac{\pi}{1-\pi}\right)\right]=\exp(\beta_0+\beta_1X_1)\\ \implies \frac{\pi}{1-\pi} = \exp(\beta_0)\exp(\beta_1X_1)$$ For simplicity, let's focus on $$\beta_1$$ and assume that $$\beta_0=0$$. This makes $$\exp(\beta_0)=\exp(0)=1$$, and therefore the above expression reduces to: $$\frac{\pi}{1-\pi} = \exp(\beta_1X_1)$$ Now, let's look at what happens when $$X_1$$ increases by one unit e.g. from $$2$$ to $$3$$. Let's also imagine $$\beta_1=-0.74$$: $$(1) \space\space\frac{\pi}{1-\pi} = \exp(-0.74\times2)=\exp(-1.48)\approx0.23 \\ (2) \space\space\frac{\pi}{1-\pi} = \exp(-0.74\times3)=\exp(-2.22)\approx0.11$$ A unit increase in $$X_1$$ has resulted in a decrease of $$0.11/0.23=0.478$$ in the odds. Note that this is just the odds ratio, and $$\exp(\beta_1)=\exp(-0.74)=0.478$$. So a unit increase in $$X_1$$ results in the odds of success being multiplied by the odds ratio, which is nothing but $$\exp(\beta_1)$$. Essentially, if $$\beta_1>0$$, an increase in $$X_1$$ will yield higher odds (because the odds ratio > 1), whereas if $$\beta_1<0$$, an increase in $$X_1$$ will yield lower odds (because the odds ratio < 1).

Now, you should be able to see for yourself what would happen if we were working with $$\ln(X_1)$$ rather than with $$X_1$$. Hint: $$(3) \space\space\frac{\pi}{1-\pi} = \exp(-0.74\times\ln(2))=2^{-0.74}\approx0.60\\ (4) \space\space\frac{\pi}{1-\pi} = \exp(-0.74\times\ln(3))=3^{-0.74}\approx0.44$$ That is, a decrease in the odds of $$0.44/0.60=0.74$$. However, the odds ratio is still $$\exp(\beta_1)=\exp(-0.74)=0.478$$, so what's going on here?

By taking the natural logarithm of $$X_1$$, you change the interpretation of its coefficient. Now, the odds ratio represents the change in the odds if you multiply $$X_1$$ by $$e$$. Therefore: $$(5) \space\space\frac{\pi}{1-\pi} = \exp(-0.74\times\ln(2))=2^{-0.74}\approx0.599\\ (6) \space\space\frac{\pi}{1-\pi} = \exp(-0.74\times\ln(2\times e))=(2\times e)^{-0.74}\approx0.286$$ We see that multiplying $$X_1$$ by $$e$$ results in the odds decreasing from $$0.599$$ to $$0.286$$. Here $$0.286/0.599=0.478$$ which is precisely the odds ratio i.e. $$\exp(\beta_1)=\exp(-0.74)$$.

Following the same logic, it's easy to see that:

• If we had transformed $$X_1$$ to be $$\log_2(X_1)$$, the interpretation would be "by how much would the odds decrease after doubling $$X_1$$"
• If we had transformed $$X_1$$ to be $$\log_{10}(X_1)$$, the interpretation would be "by how much would the odds decrease after multiplying $$X_1$$ by 10"
• Luz thanks for the wonderful and detailed post. Apologies that still my confusion remains towards the end of the post...may be I am not mathematically sound. Sep 21 at 10:54
• Luz Thanks so much for the detailed reply My doubt is - from the last step - does this mean, I should exponentiate 1.584 further to get the odds ratio. Say something like 2.72^1.584 which will be 4.879 Sep 21 at 10:59
• @VenkatPgi The odds ratio is just $\exp(\beta_1)=\exp(0.46)=1.584$. Sep 21 at 11:07
• Luz thanks once again...may be it was not clear from my initial question. The estimate which I got after running logistic regression was -0.743. After exponentiating, it was 0.46. If the original estimate is having a negative sign, the change in predictor would cause a change in the reverse direction in the outcome, right? In that case, should I do like this: exp(-0.743 x ln(3))/exp(-0.743 x ln(2))? Sep 21 at 11:20
• @VenkatPgi Ah I see, let me update with $\beta_1=-0.74$. Sep 21 at 11:23