A Deeper Dive into Odds Ratios Using Logistic Regression

PART 2 OF THE DEEP DIVE INTO ODDS RATIOS SERIES

A comprehensive guide on how to extract and explore odds ratios from a Logistic Regression model using Python and Statsmodels, with examples.

18 min read

7 hours ago

Photo by NEOM on Unsplash

When we build a statistical model, we often focus more on its predictive value. However, we can also leverage it to uncover the story behind the data.

Not a Medium member yet? Continue using this free version!

Logistic regression is one of the simplest yet most effective models for binary classification. Beyond prediction, we can obtain the odds ratios for each variable in the fitted logistic regression model, which is invaluable for our understanding of the data.

In this article, as a continuation of the first article in the deep dive into odds ratios series, we will explore how to extract odds ratios from logistic regression. We will start by deriving the relationship between the model and odds ratios. Then, we will examine use cases where the logistic regression approach offers several advantages over the basic method of calculating odds ratios, including: calculating for categorical and numerical variables, handling multiple…