As discussed previously, in logistic regression the log odds is modeled as a linear function of the -variables. That is
To solve this equation for , we first apply the exponential function to both sides of the equation:
Recall that so that the right hand side of the above equation is
Also remember that “log” is the natural logarithm, so the exponential function is its inverse (i.e., ). Thus, the left hand side is
Thus, after exponentiating both sides, logistic regression equation becomes:
Next multiply both sides by ,
and then “break up” the term,
Now move the term (the last term on the right-hand side) over to the left-hand side by adding it to both sides:
Next, factor out the ,
Finally, divide both sides by to get :
This is the equation for that you will see in multiple articles on this website.
There is one other form of this equation that is commonly used. It is obtained by multiplying the top and bottom of the right hand side of the equation for by . Since , this gives
The terms in the denominator are customarily written in the opposite order. So the second form of the equation for is
I have probably put in too many steps in the derivation above, but I wanted it to be accessible to almost everyone, even if your algebra skills are a little rusty.
Questions or Comments?
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.