# Logistic Regression Odds Ratio — The Math

In this article, I am going to show you why the odds ratio for an -variable in a logistic regression is simply the exponential of the regression coefficient. This article just contains “the math” and no interpretation. A discussion of interpretation of the odds ratio in logistic regression can be found here. A more basic discussion, that includes definitions of “odds” and “odds ratio” can be found here.

Before I begin, I want to remind you of a basic property of exponents from algebra. Specifically, when two like terms are multiplied together, the exponents add. For example,

In what follows, I will actually be going the other way: .

As I expect you know, in logistic regression, the log odds is a linear function of the ‘s:

The odds, then, can be found by exponentiating both sides:

What we want to know is what happens to the odds when we add 1 unit to one of the ‘s. We will assess the effect of this change using the odds ratio.

So let’s suppose that we considering a 1-unit change in . In that case, the new odds are given by

Note that I have used a subscript of “new” on the to show that this is the “new” , and thus the new odds that corresponds to adding 1-unit to .

I am now going to rearrange the right hand side of this equation, first by multiplying out and then by pulling out the term using the exponent formula given above. Thus,

We can now use this formula to compute the odds ratio:

Now notice that the in both the top and the bottom divide out, so we are left with

Thus, the odds ratio corresponding to a 1-unit change in an -variable is just the exponential of the ‘s regression coefficient.

Any questions or comments? Please feel free to comment below. I am always wanting to improve this material.

I have had to implement a very simple “captcha” field because of spam comments, so be a bit careful about that. Enter your answer as a number (not a word). Also, save your comment before you submit it in case you make a mistake. You can use cntrl-A and then cntrl-C to save a copy on the clipboard. Particularly if your comment is long, I would hate for you to lose it.

This entry was posted in TheMath and tagged , , , . Bookmark the permalink.

### 3 Responses to Logistic Regression Odds Ratio — The Math

1. Kom says:

In this case, x is continuous variable and the effect of change by x+1. So how about x is dummy variable (0,1), how does the x change? and how will it affect to the probability outcome?

2. miku says:

Hello. Why is it (p(new)/1-p(new)) over (p/1-p)?

• StatsProf says:

I am not sure if you are asking why it is the ratio or why it is p_new, so I will try to answer both.

Odds have the form p/(1-p). An odds ratio is the ratio of two odds. If I use p1 and p2 for the probabilities corresponding to the two odds, then an odds ratio is p1/(1-p1) over p2/(1-p2).

Now what we are thinking about in the above discussion is the effect of changing one of the X’s by one unit. That is, changing X1 to X1+1. We are thinking about this (changing from X1 to X1+1) because this is the standard way to interpret regression coefficients in regular linear least-squares regression. So this is the way we are used to thinking about the effects of the X’s.

So, in what I wrote above, p is the probability corresponding to the “base case” of X1. The p_new corresponds to the “new” case where we have changed X1 to X1+1. So that is why I am calling it p_new. It is the new p after changing from X1 to X1+1.