← 3. Relationships & regression
Logistic regression
Try this analysis →

Logistic Regression

The go-to statistical method for analyzing how likely an outcome is to fall into a particular category.

Odds and odds ratiosBinary, multinomial, ordinalPredicted probabilitiesModel performance

0.811.251.51.8OR = 1Tenure, 1 month0.960Monthly fee, $201.200Customer service, 1 contact1.4991,000 customers · odds ratios for cancellation

How likely is a customer to cancel a service? Can you predict whether a student passes an exam from study time and attendance? Can you analyze which of several products a customer will choose, or what factors are related to their level of satisfaction?

Logistic regression is the go-to statistical method for analyzing how likely an outcome is to fall into a particular category.

Where ordinary linear regression is used to explain continuous numbers such as test scores or sales, logistic regression is mainly used to analyze outcomes divided into categories, such as pass vs fail, purchase vs no purchase, or keeping vs canceling a service.

It is used in many fields, including customer churn prediction, medical risk factor analysis, surveys, education research, and marketing. In this article we cover the basic concepts of logistic regression, what probabilities and odds ratios mean, a worked example, the differences among binary, multinomial, and ordinal logistic regression, and points to watch out for when interpreting the results.

SECTION 1

What is logistic regression? How it differs from linear regression

Logistic regression is a method for statistically modeling the probability that a particular categorical outcome occurs, using one or more independent variables.

For example, suppose you collected the tenure, monthly fee, number of customer service contacts, and so on for 1,000 customers of a wireless carrier. Whether each customer kept or canceled the service is also recorded. With these data, you can see how customers’ usage characteristics are related to whether they cancel.

Based on these relationships, logistic regression can estimate the probability that a customer cancels the service. For example, if a particular customer’s predicted cancellation probability is 0.75, the model estimates that the probability of cancellation among cases with that customer’s characteristics is 75%.

This is, however, a probability calculated by a statistical model; it does not mean the customer will definitely cancel. To judge how reliable the predictions are, also check the model’s performance and how well its probabilities are calibrated.

How do linear regression and logistic regression differ?

Linear regression and logistic regression both analyze the relationship between independent and dependent variables, but they are typically used with different types of dependent variables.

AspectLinear regressionLogistic Regression
Dependent variableMainly continuous numbersCategorical outcome
Main goalEstimating the amount of change in a numberEstimating the probability of each category
Key outputRegression coefficients, predicted values, R²Regression coefficients, odds ratios, predicted probabilities
ExampleTest score by hours studiedProbability of passing by hours studied
Typical modelGeneral linear modelBinary logistic model

For example, if you predict test scores from hours studied, you can use linear regression. If instead you analyze the probability of passing an exam from hours studied, you can consider logistic regression.

An ordinary linear regression equation calculates the predicted value of the dependent variable directly. But when the outcome is coded 0 or 1, such as pass/fail, a linear regression equation can predict values below 0 or above 1.

To solve this problem, logistic regression uses the logistic function so that predicted probabilities stay between 0 and 1.

00.250.50.751Independent variablePredicted probabilityLogisticStraight lineBelow 0 · impossible probabilityAbove 1
Straight-line model vs logistic curve
SECTION 2

How logistic regression works: probability and odds

Binary logistic regression transforms the probability of an event into a value called the logit and models its relationship with the independent variables.

The logit is the natural log of the odds, the ratio of the probability that the event occurs to the probability that it does not. The usual binary logistic regression equation is as follows.

log[p / (1 - p)] = β₀ + β₁X₁ + β₂X₂ + ...

Here p is the probability that the event of interest occurs. For example, if you analyze whether customers cancel a service, p is the probability of cancellation. The independent variables could include tenure, monthly fee, number of customer service contacts, and so on.

Logistic regression does not assume a straight-line relationship between the independent variables and the probability itself; it sets up a linear relationship between the independent variables and the log odds. This structure lets you estimate the probability of the event and interpret the relationship between the independent variables and the outcome through odds ratios and similar measures.

How do probability and odds differ?

To understand logistic regression, you need to know the difference between probability and odds.

Probability expresses how likely an event is as a value between 0 and 1. Odds, on the other hand, are the probability that the event occurs divided by the probability that it does not.

Odds = p / (1 - p)

For example, suppose the probability that a customer cancels the service is 20%. Then the probability of not canceling is 80%, and the odds are as follows. 0.20 ÷ 0.80 = 0.25

Conversely, if the probability of cancellation is 75%, the odds are as follows. 0.75 ÷ 0.25 = 3.00

Probability of the eventOdds
10%0.111
20%0.250
50%1.000
75%3.000
90%9.000
10%Odds 0.11120%Odds 0.25050%Odds 1.00075%Odds 3.00090%Odds 9.00050%
Probability and odds

When the probability is 50%, the odds are 1, because the event is equally likely to happen or not happen. When the probability is above 50%, the odds are greater than 1, and when it is below 50%, the odds are less than 1. Logistic regression estimates relationships between variables using the log of these odds, the log odds.

SECTION 3

Worked example: factors that affect customers canceling a service

Suppose a wireless carrier analyzes the factors related to service cancellation using data on 1,000 customers.

The dependent variable is whether the service was canceled, coded 1 for customers who canceled and 0 for customers who kept the service. The independent variables were set up as follows.

The research question is as follows.

“How are tenure, monthly fee, and the number of customer service contacts related to the likelihood of canceling the service?”

Logistic regression results

Independent variableCoefficient (B)Odds ratio (OR)p-value
Tenure (1 month)-0.0410.960< .001
Monthly fee ($20)0.1821.200.003
Customer service contacts (1 contact)0.4051.499< .001
Tenure, 1 month0.960Monthly fee, $201.200Customer service, 1 contact1.499OR = 10.811.251.51.8
Odds ratios and estimate intervals for the three variables

How do you interpret the results?

The odds ratio for tenure was 0.960. Holding the other variables constant, each additional month of tenure is associated with about 4.0% lower odds of cancellation.

The odds ratio for monthly fee is 1.200. You can interpret this as a $20 increase in the monthly fee being associated with about 20.0% higher odds of cancellation. The odds ratio for customer service contacts is about 1.499, meaning each additional contact is associated with about 49.9% higher odds of cancellation.

In this example, all three variables were statistically significant.

Note, however, that an increase or decrease in odds is not the same as an increase or decrease in probability. For example, odds that are 20% higher do not mean the probability of cancellation rises by 20 percentage points.

You also cannot interpret this causally as customers canceling because they contact customer service a lot. Other explanations are possible; for example, dissatisfied customers may contact customer service often and then later cancel.

SECTION 4

Interpreting odds ratios and the change in actual probability

One of the most frequently used measures in logistic regression is the odds ratio (OR).

The odds ratio shows by what factor the odds of the event change when an independent variable changes by one unit. In a model that includes other independent variables, it is interpreted with those variables held constant. The odds ratio is calculated by applying the exponential function to the regression coefficient.

OR = e^B

The usual interpretation is as follows.

Odds ratioMeaning
OR = 1No change in odds
OR > 1Associated with higher odds of the event
OR < 1Associated with lower odds of the event

For example, OR = 1.50 means that when the independent variable increases by one unit, the odds of the event become 1.5 times as large. OR = 0.70, on the other hand, means the odds become 0.7 times as large, which corresponds to 30% lower odds.

Odds ratios are useful for understanding the direction and relative size of a relationship, but you must always check the units of the independent variable when interpreting them. For example, the odds ratio for monthly fee is different when the fee is measured per $1 than when it is measured per $20.

How much does the actual probability change when odds increase?

People often confuse odds ratios with probabilities in logistic regression.

For example, suppose a variable has an odds ratio of 2. This means the odds of the event double when that variable increases by one unit. But it does not mean the probability always doubles. The actual change in probability depends on the baseline probability.

Baseline probabilityProbability after the odds double
10%About 18.2%
20%About 33.3%
50%About 66.7%
70%About 82.4%
0%25%50%75%100%Baseline 10%18.2%+8.2 ppBaseline 20%33.3%+13.3 ppBaseline 50%66.7%+16.7 ppBaseline 70%82.4%+12.4 pp
Change in probability when the odds double

For example, for a customer whose baseline cancellation probability is 10%, doubling the odds only brings the cancellation probability to about 18.2%. If the baseline cancellation probability is 50%, doubling the odds brings it to about 66.7%. So even with the same odds ratio, the amount of change in actual probability can differ depending on the baseline probability.

In practice, results are easier to understand if you present not only odds ratios but also predicted probabilities calculated under specific conditions, average marginal effects, and so on.

SECTION 5

What types of logistic regression are there?

Logistic regression comes in several forms, depending on how many categories the dependent variable has and whether those categories are ordered.

The main types are binary logistic regression, multinomial logistic regression, and ordinal logistic regression.

MethodDependent variableExample uses
Binary logistic regressionTwo categoriesPurchase/no purchase, pass/fail
Multinomial logistic regressionThree or more unordered categoriesChoice of transportation among car, public transit, and bicycle
Ordinal logistic regressionThree or more ordered categoriesSatisfaction at low, medium, or high levels

All three methods analyze categorical outcomes, but because the structure of the dependent variable differs, you need to choose the appropriate one.

SECTION 6

What is binary logistic regression?

Binary logistic regression is used when the dependent variable falls into two categories.

Typical examples are as follows.

For example, if you analyze whether customers cancel a service, you can code cancellation as 1 and keeping the service as 0. Binary logistic regression estimates the relationship between the independent variables and the log odds of the event. Based on this, you can calculate each customer’s probability of cancellation or analyze how strongly particular factors are related to the odds of cancellation.

However, the direction in which coefficients and odds ratios are interpreted depends on which category was coded 1. So when reporting results, explain clearly how the event of interest was defined.

SECTION 7

What is multinomial logistic regression?

Multinomial logistic regression is used when the dependent variable has three or more categories with no clear order among them.

For example, suppose you surveyed the means of transportation people mainly use to commute. The response options are as follows.

These three categories have no natural order such as higher or lower. Multinomial logistic regression usually sets one category as the reference category and analyzes how the other categories compare with it.

For example, if car is set as the reference category, you can estimate the following relationships.

The independent variables can include age, income, commuting distance, whether the person owns a car, and so on. In multinomial logistic regression, results are sometimes expressed with relative risk ratios (RRR) relative to the reference category.

However, the relative risk ratio here should not be interpreted the same way as the risk ratio in a typical cohort study. In a multinomial logit, it shows how the ratio of the probability of a particular category to that of the reference category changes with the predictors.

SECTION 8

Ordinal logistic regression and telling the three models apart

Ordinal logistic regression is used when the dependent variable has three or more categories and there is a meaningful order among them.

For example, suppose service satisfaction was measured as follows.

  1. Very dissatisfied
  2. Dissatisfied
  3. Neutral
  4. Satisfied
  5. Very satisfied

In data like these, the order of the values is meaningful. But you cannot necessarily assume that the difference between 1 and 2 points is the same as the difference between 4 and 5 points. Ordinal logistic regression takes this order information into account when analyzing the relationship between the independent variables and the level of satisfaction.

One of the main methods is the proportional odds model. This model uses the proportional odds assumption, that the effect of an independent variable on the cumulative category probabilities is the same across category boundaries. For example, you can check whether higher service quality increases the likelihood of falling into a higher satisfaction category.

If the proportional odds assumption is not appropriate, however, you may need to consider a partial proportional odds model or another ordinal regression model.

How do you tell the three types of logistic regression apart?

The first thing to check when choosing a logistic regression method is the measurement level of the dependent variable.

Research questionStructure of the dependent variableRecommended analysis
Will the customer cancel the service?Cancel / keepBinary logistic regression
Which brand will the customer choose?Brand A / B / CMultinomial logistic regression
What is the customer’s level of satisfaction?Low / medium / highOrdinal logistic regression

For example, if satisfaction scores range from 1 to 5, it may not be appropriate to use multinomial logistic regression just because there are five categories. Satisfaction is an ordered response, so ordinal logistic regression should be considered first.

Conversely, if preferred brands are divided into A, B, and C, there is no order among the categories, so you can consider multinomial logistic regression. In this way, the method depends not only on the number of categories but also on whether there is a meaningful order among them.

SECTION 9

What is a generalized linear model (GLM)?

A generalized linear model (GLM) is a statistical model that extends linear models so that relationships between variables can be analyzed with various probability distributions and link functions, even when the dependent variable does not follow a normal distribution.

Ordinary linear regression expresses the conditional mean of a continuous dependent variable as a linear equation. A GLM, by contrast, can use different probability distributions and link functions depending on the type of outcome being analyzed. Typical examples are as follows.

Type of dependent variableTypical distributionExample analysis
Continuous numbersNormal distributionTest scores, sales
Binary outcomeBinomial distributionWhether a purchase is made, whether a service is canceled
Count of eventsPoisson distributionNumber of visits, number of accidents
Positive continuous numbersGamma distributionMedical costs, processing time

Binary logistic regression is a classic example of a GLM that uses the binomial distribution and the logit link function. Poisson regression is also a type of GLM, used to analyze counts of events over a period of time or per unit of exposure.

However, not every logistic regression model has exactly the same structure as a basic GLM. Multinomial and ordinal logits are often handled within the framework of generalized categorical response models.

SECTION 10

How do you evaluate the performance of a logistic regression model?

If you use logistic regression to predict outcomes, check not only the statistical significance of the coefficients but also the model’s predictive performance.

For binary classification problems in particular, you can use the following measures.

MetricMeaning
AccuracyShare of all cases classified correctly
PrecisionShare of predicted positives that are actually positive
RecallShare of actual positives correctly identified
F1 scoreHarmonic mean of precision and recall
ROC-AUCRanking performance in separating positives from negatives
PR-AUCPerformance summarizing the trade-off between precision and recall
Brier ScoreMean squared error between predicted probabilities and actual binary outcomes

For example, suppose 90% of customers keep the service and only 10% cancel. Predicting that every customer will keep the service gives 90% accuracy. But this model does not find a single customer who actually cancels.

So with data where the event of interest is rare, like cancellations, it is better to look at precision, recall, PR-AUC, and so on rather than accuracy alone. Calibration, which checks how well predicted probabilities match the actual event rates, also matters.

SECTION 11

Assumptions to check before logistic regression

Logistic regression is useful for analyzing categorical outcomes, but you need to consider an appropriate data structure and the model’s assumptions.

Type of dependent variable

In binary logistic regression, the dependent variable must fall into two categories. Multinomial logistic regression handles several unordered categories, and ordinal logistic regression handles several ordered categories. So check the measurement level of the dependent variable carefully before the analysis.

Independence of observations

Ordinary logistic regression models treat independence between observations as an important condition. For example, if you treat data from the same customer at several time points as if they came from independent customers, standard errors and test results can be inaccurate. In such cases you can consider mixed-effects logistic regression or generalized estimating equations (GEE).

Linear relationship with the log odds

Binary logistic regression considers linearity between continuous independent variables and the log odds, not the probability of the event itself. For example, if there is a complex nonlinear relationship between tenure and the likelihood of cancellation, a model with only a simple linear term may not represent the relationship adequately.

If needed, you can use polynomial terms, splines, and so on.

Multicollinearity

If the relationships among independent variables are too strong, estimates of individual coefficients can become unstable. For example, including very closely related variables together, such as monthly fee and annual spending, can cause multicollinearity.

Complete separation

When values or combinations of a particular independent variable perfectly separate the outcome categories, ordinary maximum likelihood estimation may produce coefficients that diverge or cannot be estimated stably. In such situations, consider other estimation methods such as Firth’s correction or regularized regression.

Enough events

Even if the total sample is large, it can be hard to estimate coefficients stably when the event of interest is very rare. For example, if only 20 of 10,000 customers cancel, a model with many independent variables can overfit or produce unstable estimates.

The required sample size and number of events should be decided by considering the number of predictors, the expected effects, the event rate, the research goal, and so on.

SECTION 12

Points to watch when interpreting logistic regression results

Because logistic regression provides probabilities and odds ratios, it can look intuitive and easy to understand, but its results are often misinterpreted.

Don’t confuse odds ratios with probabilities.

An odds ratio of 1.5 does not mean the probability of the event increases by 50 percentage points. It means the odds become 1.5 times as large, other things being equal. The actual change in probability depends on the baseline probability.

Statistical significance does not guarantee predictive performance.

A small p-value for a particular independent variable does not mean the model can accurately predict whether new customers will cancel. If prediction is the goal, check the model’s performance with separate validation data or cross-validation.

Regression coefficients do not imply causation.

Just because higher monthly fees were associated with higher odds of cancellation, you cannot conclude that lowering fees will necessarily reduce the cancellation rate. Other factors, such as customer characteristics, contract type, and service experience, may be at work as well.

Check model fit as well.

Logistic regression offers various measures such as the log-likelihood, AIC, BIC, and pseudo R². Pseudo R², however, is calculated and interpreted differently from the R² of ordinary linear regression, so it should not be interpreted the same way.

SECTION 13

How do you report logistic regression results?

In research papers and analysis reports, it is good to present not only coefficients and p-values but also odds ratios, confidence intervals, sample sizes, and so on.

Using the customer cancellation example above, you could write it as follows.

Sample report

A binary logistic regression was conducted to identify factors related to whether customers canceled the service. Tenure showed a statistically significant negative relationship with the odds of cancellation (OR = 0.960, p < .001). In contrast, monthly fee (OR = 1.200, p = .003) and the number of customer service contacts (OR = 1.499, p < .001) showed statistically significant positive relationships with the odds of cancellation. This means that, holding the other variables constant, longer tenure tended to be associated with lower odds of cancellation, and higher monthly fees and more customer service contacts with higher odds of cancellation.

In real studies, it is good to also report the 95% confidence interval of each odds ratio, model fit, the analysis sample size, and so on. And if the goal is to predict the probability of the event, you can also present predictive performance and calibration results.

SECTION 14

Where can logistic regression be used?

Logistic regression is used in many fields that analyze how likely categorical outcomes are.

Marketing and customer analytics

You can analyze whether customers make a purchase, cancel a subscription, click an ad, buy again, and so on.

Education research

You can predict, or analyze the factors related to, whether students pass, drop out, complete an education program, and so on.

Health and medical research

You can analyze factors related to binary outcomes such as whether a disease occurs, whether there is a response to treatment, and whether a patient is readmitted.

Social science research

You can analyze variables related to categorical outcomes such as employment, support for or opposition to a policy, vote choice, and level of satisfaction.

Finance and economics

You can analyze a variety of categorical outcomes, such as loan delinquency, the likelihood of default, and customers’ choice of financial products.

HR and organizational research

You can analyze whether employees leave, whether they take part in training programs, their level of job satisfaction, and so on. In this way, logistic regression is widely used to estimate the probability of a particular event or to analyze the relationship between a categorical outcome and several predictors.

✓Wrap-up

Logistic regression is a way to understand how likely categorical outcomes are.

Logistic regression is a statistical method that uses one or more independent variables to analyze the probability or relative likelihood of a categorical outcome.


The main types are binary, multinomial, and ordinal logistic regression, and you should choose the appropriate one based on how many categories the dependent variable has and whether they are ordered.

When reading the results, it is important to look not only at coefficients and p-values but also at odds ratios and confidence intervals. In particular, odds ratios and probabilities are different concepts, so take care when interpreting them. The measures you need to check also depend on whether the research goal is to explain relationships between variables or to predict outcomes for new cases.

KEY TAKEAWAY

The purpose of logistic regression is not simply to predict which outcome will occur, but to understand the relationship between a categorical outcome and several variables and to estimate its likelihood statistically.