Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 41

Binary Logistic Regression: Model Formulation and Logit Interpretation

Recommended resources

Hello! In our last module, we established the full framework for Generalized Linear Models (GLMs), covering everything from their core components to how we test coefficients and assess model fit using diagnostics.

Now, we move from the general theory to specific, powerful applications. This lesson marks the beginning of our deep dive into the most widely used GLM: Binary Logistic Regression. This is your go-to model whenever your outcome variable is binary—think yes/no, success/failure, or present/absent.

Our goal today is to answer two fundamental questions:

  1. Why can't we just use the familiar ordinary linear regression for binary outcomes?
  2. How do we correctly formulate a model for this type of data?

By the end of this lesson, you will be able to formulate the binary logistic regression model and explain the critical role of the logit link function in making it all work. This will lay the groundwork for interpreting model results, which we'll tackle in the next lesson.

Why Ordinary Linear Regression Fails for Binary Outcomes

Let's start with a foundational question. You have a good understanding of linear regression. Why can't we just apply it when our dependent variable, , can only be 0 or 1?

There are several critical problems with this approach.

Comparison of Linear and Logistic Regression for Binary Outcomes
A visual comparison of fitting a linear model (left) versus a logistic model (right) to binary (0/1) data. The linear model's predictions can extend beyond the valid probability range of [0, 1], while the logistic curve is correctly bounded.

As the image on the left shows, a simple linear model (Y = a + bX) will try to fit a straight line through data points clustered at Y=0 and Y=1. This leads to major issues:

  1. Impossible Predictions: The line will inevitably predict values above 1 and below 0. How do you interpret a probability of 1.2 or -0.1? It's meaningless.
  2. Incorrect Functional Form: The true relationship between a predictor and a probability is rarely linear. Often, a small change in a predictor has a large effect in the middle of its range but a smaller effect at the extremes. This suggests an "S-shaped" curve, not a straight line.
  3. Violation of Core Assumptions: The assumptions of linear regression, such as normally distributed and homoscedastic (constant variance) errors, are violated when the outcome is binary.

To get a solid grasp of these failures, please read the first part of the following document.

Introduction to Binary Logistic Regression

This document, 'Introduction to Binary Logistic Regression', clearly outlines the conceptual and statistical problems of using OLS regression for dichotomous outcomes. This provides the crucial 'why' behind logistic regression.

Please read pages 1-3, up to the section titled 'The Logit Transformation'. Focus on understanding the four problems described.


The Solution: Modeling a Transformation of the Probability

The core problem is that the linear predictor, , is unbounded (it can go from to ), while the outcome we want to predict, a probability , is bounded between 0 and 1.

The solution is to find a function that can "stretch" the [0, 1] interval to cover the entire number line. This transformation is called the logit link function. It's a two-step process.

Step 1: From Probability to Odds

Instead of modeling the probability directly, we can model the odds.

The odds represent the ratio of the probability of success to the probability of failure.

  • If , the odds are 1 (or "1 to 1").
  • If , the odds are (or "4 to 1").
  • As approaches 1, the odds approach .
  • As approaches 0, the odds approach 0.

By converting to odds, we've solved half the problem: we've removed the upper bound of 1. The range is now .

Step 2: From Odds to Log-Odds (the Logit)

To remove the lower bound of 0, we simply take the natural logarithm of the odds. This gives us the log-odds, which is also called the logit.

The range of the log-odds is . This is exactly what we needed! We now have a quantity that is unbounded, just like our linear predictor.

Logistic Distribution and Log-Odds Transformation
This image perfectly illustrates the effect of the logit transformation. The S-shaped probability curve (top) becomes a straight line when we plot the log-odds against the predictor (bottom).

The following video provides an excellent visual and conceptual walkthrough of this transformation.

Logistic Regression Details Pt1: Coefficients

StatQuest with Josh Starmer is fantastic for building intuition. This segment visually explains how the y-axis is transformed from probability to log-odds to allow for a linear model.

Please watch the video from 04:36 to 08:09. Focus on how the logit function transforms the y-axis and turns the 'squiggly line' into a straight line.


Formulating the Binary Logistic Regression Model

Now we can formally define the model. Binary logistic regression is a GLM where:

  1. Random Component: The response variable for a given set of predictors follows a Binomial distribution. For a single observation, this is a Bernoulli distribution (a single trial with probability of success ).
  2. Systematic Component: The predictors are combined linearly to form the linear predictor, .
  3. Link Function: The logit function links the expected value of the response, , to the linear predictor.

Putting it all together, the logistic regression model is:

This equation states that the log-odds of success is a linear function of the predictors. This is the fundamental equation you need to understand.

By rearranging the formula, we can express the probability as a function of the predictors. This S-shaped function is sometimes called the logistic function or sigmoid function.

The following reading provides a slightly more formal summary of these components and presents the model in the context of the GLM framework we've already learned.

6 Binary Logistic Regression – STAT 504

This page from Penn State's STAT 504 course formally introduces binary logistic regression as a GLM and clearly lays out its components and model equation.

Please read the following sections: Overview (at the top of the page). Section 6.1 Introduction to GLMs: Focus on the 'three components to any GLM' and the example for 'Binary Logistic Regression'. Section 6.2 Overview of Binary Logistic Regression: Read the 'Assumptions' and the model formulation part.


A First Look at Interpreting Coefficients

So what do the coefficients in our model equation actually mean? Since the left side of the equation is in log-odds, the coefficients must also be interpreted on that scale.

  • (the intercept) is the estimated log-odds of success when all predictor variables are zero.
  • is the estimated change in the log-odds for a one-unit increase in the predictor , holding all other predictors constant.

Let's return to the StatQuest video, which provides a simple, clear example of this interpretation for both continuous and categorical predictors.

Logistic Regression Details Pt1: Coefficients

Now that we have the model, let's see how to interpret its output. This video explains what the coefficients for the intercept and the predictors represent in terms of log-odds.

Please watch from 08:31 to 10:36 and then from 14:17 to 17:02. Don't worry about the p-values or statistical significance for now; just focus on what the coefficients themselves mean for the log-odds of the outcome.

While interpreting coefficients as changes in log-odds is technically correct, it's not very intuitive. In our next lesson, we will focus entirely on the much more practical skill of converting these log-odds back into odds ratios, which are far easier to understand and explain.


Conclusion

This lesson established the "why" and "what" of binary logistic regression. We've seen that it's not just an arbitrary choice but a necessary and elegant solution to the problems that arise when trying to model binary outcomes.

Key Takeaways:

  • Ordinary Linear Regression is unsuitable for binary (0/1) outcomes because it can produce impossible predictions and violates key statistical assumptions.
  • Logistic regression solves this by modeling a transformation of the probability, not the probability itself.
  • The logit link function, , transforms a probability (bounded at 0 and 1) into log-odds (unbounded), which can then be modeled as a linear combination of predictors.
  • The fundamental logistic regression equation is , which states that the log-odds of the outcome is a linear function of the predictors.
  • The model coefficients ('s) represent changes in the log-odds of the outcome.

Preview of the Next Lesson:

We've learned that coefficients are on the log-odds scale. Now, how do we make them interpretable for a report or a stakeholder? In the next lesson, we will focus on interpreting logistic regression coefficients. You will learn how to convert the raw coefficients into odds ratios, attach confidence intervals to them, and explain precisely what they mean in a practical context.