How to Interpret Logistic Regression Coefficients
Calculating mean marginal effects of logistic regression coefficients
Do you love logistic regression, but hate interpreting anything with any form of logarithmic transformation? Well, I can’t say you are in good company, but I can say that you do have me as company!
In this article, I’m going to talk all about interpreting logistic regression coefficients — here’s the outline:
- Interpreting linear regression coefficients
- Why logistic regression coefficient interpretation is challenging
- How to interpret logistic regression coefficients
- Calculating mean marginal effects with the statsmodels package
- Conclusion
Interpreting linear regression coefficients
Most people with an elementary knowledge of statistics fully understand how coefficients are interpreted with linear regression. If that is you, you might consider skipping ahead to the portion of the article that discusses logistic regression coefficients.
Interpreting linear regression coefficients is very simple and easy. The simplicity of interpretation is one of the reasons linear regression is still a very popular tool despite the advent of much more sophisticated algorithms.
Simple linear regression (linear regression with one input variable) takes this form:
We are primarily interested in interpreting B₁. For linear regression, this interpretation is simple — for a one-unit change in x, we expect a B₁ change in y. Another phrase for this relationship is the ‘mean marginal effect’.
Let’s look at an example of how we can interpret B₁ using simulation. Simulation is a great tool to test data science tools/approaches because we make the baseline truth and then see if our methods are able to identify it.
In the code below, we are simulating 30,000 rows of x values. We simulate the x values by sampling from a normal distribution with the parameters of our choosing (in this case a mean of 2 and standard deviation of 0.2). We then simulate y by multiplying x by our simulated impact of 0.16 and then we add random error…