Linear regression is arguably the oldest machine learning model still used. It predates computers, let alone large language models. Yes, this model is fundamental to analytics. In 2026, it still answers a question most AI models skip: what happens to the outcome if we change one thing?
Let’s take a B2B software company that offers customers an optional onboarding call. Customers who book the call spend €1,594 more in their first six months than those who don’t. A machine learning model trained on the same data would predict revenue well and also rank the call among its top features. However, neither result would tell us whether booking more calls will bring in more money for the business.
AI tools can now write linear regression code in seconds, and running those models is much faster than many more sophisticated machine learning models. However, choosing which variables to include still requires expert knowledge.
Linear regression is still a core tool for measuring cause and effect. Difference-in-differences, fixed effects and regression discontinuity all use linear regression even though they seem more complex. This approach additionally strengthens analysis of many A/B test results. Any team that wants to know what moves revenue still needs it, no matter what AI tools they use. In this article, we cover where linear regression still beats more complex models.
What is linear regression?
Linear regression is a statistical method that models an outcome as a weighted sum of input variables plus noise. Each weight, called a coefficient, shows how much the outcome changes when one input rises by one unit while the other inputs stay fixed.
In our use case, the regression equation will look as follows. The model explains six-month revenue for all customers, based on whether they took the onboarding call, plus company size, plan and trial engagement. The model will assess this relationship as a function of variables such as company size, the chosen payment plan, and trial engagement.
revenue = baseline
+ effect × onboarding call
+ adjustment for company size
+ adjustment for plan
+ adjustment for trial engagement
+ noise
The model chooses the weights that bring its predictions as close as possible to actual revenue. The standard method is ordinary least squares (OLS). It minimises the sum of squared errors between estimated and actual values. We try to uncover the coefficient on the onboarding call variable. It estimates the revenue a call adds, holding all other included variables constant.
Prediction vs explanation
A common question when using a linear regression model is how to distinguish prediction from explanation. The answer is simple: the same model can do both. In prediction, we care about the output: comparing forecasted revenue with the actual value.
For explanation, the coefficient matters, as its value helps us understand the problem we analysed. Using large datasets, more complex machine learning algorithms have overtaken linear regression at the first job. At the second job, linear regression is still the best. Each coefficient has a clear meaning and a confidence interval so that you can check and defend the results.
Why linear regression still matters in the age of AI
AI has changed how analysts write code and explore data. It hasn’t changed anything about which models answer business questions. Understanding how each model works is still important to being a useful analyst or data scientist. For causal questions, linear regression still plays an important role for the following reasons.
Coefficients we can read
A gradient boosting model consisting of 500 trees can return a very accurate prediction. To explain such a model, we need tools like SHAP values or feature importance, which don’t offer easy interpretation. Moreover, they don’t show how the outcome changes when we change an input. Linear regression gives one number per variable, in the outcome’s units, with a confidence interval.
Speed of the model
Many business questions involve a few thousand rows at most. Linear regression works very well at that data size. It needs no tuning and runs very quickly. A more powerful model on a small dataset may overfit.
The backbone of causal methods
Many causal methods are linear regression with a specific design. Difference-in-differences is a regression with an interaction between group and period. Fixed effects models add one dummy per unit. Regression discontinuity fits a regression on each side of a cutoff. Double machine learning uses flexible models to clean the data. It still finishes with a simple regression of residuals on residuals, following the Frisch-Waugh-Lovell theorem. Anyone who understands linear regression can understand all of them and still get good causal inference results.
Where AI helps
AI fits into this workflow as a fast assistant. It writes code, helps with exploratory data analysis, and speeds up the technical work. It can also create a first causal diagram and suggest confounders the team might miss. The analyst checks each suggestion and decides what stays in the model. The result is a better, more accurate regression model, built faster.
Linear regression for causal inference
A regression coefficient becomes a causal estimate of the treatment effect only when the model includes the right variables. Which variables are right depends on the so-called data-generating process, which is often depicted in graphs. Basically, we assume which variables cause which, which helps us understand which ones to include in the model.

Each arrow in the diagram above means a given variable causes another. Company size, plan tier and trial engagement point to both the onboarding call and revenue. Larger, more engaged customers book the onboarding call more often. They also generate more revenue whether they decide to take the onboarding call or not. These shared causes are called confounders, and controlling for them is a key part of running a linear regression in a causal context.
Controlling for confounders
Adding a variable to a linear regression holds it constant in relation to other variables. This way, the coefficient on the onboarding call compares customers of the same size, plan and trial engagement. By including all those variables in the model, we compare customers who are alike on these variables and differ in whether they took the call. That closes the so-called backdoor paths. In our data, the estimate will be much closer to the truth after controlling for these variables.
This is the backdoor criterion at work. After controlling for a set of variables that blocks every backdoor path, the coefficient measures the causal effect.
Bad controls
Intuitively, we might expect that adding more variables to the model would make it safer, since we would include all available data points. This is not always true, as adding a variable to the regression model can harm the validity of the causal estimate. It depends on a given variable’s position in the causal diagram. We already established that controlling for confounders is needed, but the causal diagrams can also include other types of relationships between variables.
One of those is a variable called a mediator. On the graph above, we have a variable called ‘active users in month 3’. It sits on the path from the call to revenue: the call adds users, and users add revenue. Holding it fixed compares call takers and non-takers with the same number of users, which wipes out the extra users the call created. The model then measures only what the call adds after accounting for its main effect, so the estimate falls.
The rule is simple: never control for anything the treatment can change. Measure all control variables before the treatment.
Case study: Do onboarding calls raise customer revenue?
A B2B software company offers every new customer an optional onboarding call. We aim to understand whether the call is worth it, meaning if it brings incremental revenue. If it does, the team plans to roll it out more broadly.
We simulated 4,000 new customers. 30% of them took the call. Simulated data lets us check a model against a predefined answer: the call’s true average effect is €432 in six-month revenue. The dataset consists of the variables mentioned on the graph above:
- onboarding_call – 1 if the account took the call
- revenue_6m – revenue in the first six months
- employees -company size
- plan – subscription option chosen by a customer
- trial_sessions – logins during the free trial
- active_users_m3 – active users in month 3 (measured after the call)
Customers who took a call generated €5,722 in average revenue over six months. Non-takers generated €4,129 in average revenue. As noted above, this gap can’t be used to infer a causal effect because the groups differ fundamentally. This type of comparison mixes the call’s effect with differences between the groups, unless the data comes from a randomised experiment.

To correct for this effect, we have to account for the confounding variables. One of them is the company size. We can see that the larger the company is, the more likely it is to have an onboarding call. This means the group of call-takers consists disproportionately of larger companies, which naturally generate higher revenue.

We can summarise the gap between groups across all variables using the standardised mean difference. It compares each variable across the two groups, and values above 0.1 generally indicate a large between-group difference. The chart below clearly shows that customers who took a call differed from non-takers across all measured dimensions. This shows that measuring the effect of the call without controlling for confounders leads to an incorrect causal effect.

We showed that call takers are bigger and more engaged to begin with, and we can’t directly compare them with the other group. The fix is to compare similar groups. We want to compare a call taker with a non-taker of the same size, on the same plan, and in the same trial activity.
Controlling using linear regression
That’s exactly what linear regression does. We have to add all the confounding variables to the model. The following formula adds the three confounders from the causal diagram.
smf.ols("revenue_6m ~ onboarding_call + log_employees + C(plan) + trial_sessions", data=df).fit(cov_type="HC3")
We use the log of company size because revenue grows with size at a decreasing rate, and we use robust (HC3) standard errors.
With these controls, the coefficient on onboarding_call changes meaning. It now shows how much more revenue call takers generate among customers with the same size, plan, and trial activity.
The model returns €389 as the treatment coefficient, with a 95% interval between €343 and €436. The true effect is inside the confidence interval, but the coefficient is slightly far from it. The gap comes partly from random noise and partly from how a single coefficient averages the effect across plans, as the interactions section shows.
The model also returns coefficients for the controls. Doubling company size adds about €440 in revenue, each trial session adds €74, and an Enterprise account brings €2,110 more than a Basic account of the same size. These numbers help check that the model makes business sense. They are not causal effects themselves, because the model was designed around the call. The size coefficient, for example, also absorbs the effect of plan upgrades that bigger firms make.
The bad controls
In this step, we will make a mistake on purpose to show that including a wrong variable in the model can break the whole process. Active users in month 3 look like a reasonable additional control variable. It is in the data, it relates to revenue, and adding it improves the fit. Many analysts would include it just to be safe.
The estimate drops to €162, far from the true effect. As explained earlier, the call creates extra active users, so holding them fixed removes part of the effect we want to measure. This is an important warning that controlling for mediators is wrong, and such variables shouldn’t be included in the causal model.
Interactions
The €389 obtained is an average across all customers. The business question is narrower: which customers should get the call? To answer it, we need the effect for each group. We can achieve this using interaction terms.
An interaction term lets the call’s effect vary by plan. In the linear regression formula, the * between the call and the plan does this:
smf.ols("revenue_6m ~ onboarding_call * C(plan) + log_employees + trial_sessions",
data=df).fit(cov_type="HC3")
The model now estimates a base effect of the call for Basic customers, plus adjustments for Pro and Enterprise. The effect for Pro customers is the base effect plus the Pro adjustment.

All values are relatively close to the true effect, which is included in all the confidence intervals. This chart shows something interesting: Basic customers gain the most from the call, nearly three times as much as Enterprise customers. We also know from before that they take this call least often. This suggests the company puts a lot of effort into onboarding larger companies, where the call’s incremental revenue is lowest.
That doesn’t mean they should abandon it, since the effect is still positive and those are, after all, the largest accounts. The recommended course of action is to roll out the onboarding call more to Basic customers, as it can drive the largest incremental effect for the business.
We now have four linear regression models built on the same data. The chart compares every model in this case study against the true effect.

The analysis shows that a simple comparison of averages can enormously inflate the true effect, pointing out how dangerous it is not to control for confounders in practice. Using this number could lead to overly optimistic decisions, yet in many settings, such a comparison is still a go-to tool.
Adding all the confounders and an interaction term is clearly the best way to uncover the causal effect in the data when we measured all the confounders affecting the treatment and the outcome. We can also see that adding a bad control, a mediator variable, leads to an incorrect estimate which is too low compared to the true effect.
Looking at the R-squared metrics is also interesting, since it highlights that it’s not a key metric to evaluate a causal model. It’s slightly higher for the model with bad controls than for the correctly specified model. It happens because R-squared increases with every other variable in the model, regardless of whether it is valid from a causal perspective. That’s why it’s not very useful for evaluating regression models in causal inference settings.
Summary: linear regression in the age of AI
Linear regression remains the main tool for measuring cause and effect even in the age of large language models. A short onboarding case illustrates how using a regression model with good controls helps uncover the true causal effect. The raw gap of €1,594 overstated the call’s value almost four times. A linear regression built on a causal diagram ended up within 10% of the true effect.
Of course, this case study is simplistic, as the real world is much more complex. However, it still shows how linear regression can be used in practice and why this simple model remains important.
We have to remember that, like every causal inference method, linear regression relies on a few assumptions we need to be aware of when using it. The main one, and the most important from a causal inference perspective, is that every confounder must be measured and included in the model. In our case, company size, plan and trial activity played that role, and all of them were included in the data. Real projects are rarely this simple and clean. If a significant confounder is omitted from the analysis, its effect will be absorbed by the treatment coefficient, pushing it further from the true effect.
No statistical test can prove that every confounder is in the model. That’s why domain knowledge matters when running causal models, and why cooperation between analysts and stakeholders helps uncover the causal effect of a given activity. When a key confounder cannot be measured, a sensitivity analysis shows how strong it would need to be to overturn the result. For example, the DoWhy library includes such tests for causal models.
Furthermore, each customer type must appear both with and without the treatment, meaning we can’t have large companies only in the treatment groups, as we wouldn’t be able to find comparable ones in the control group. With these conditions in place, linear regression gives an answer that is easy to explain, transparent and easy to explain, transparent and open to challenge. AI tools now speed up every step of that work. The judgement about which variables belong in the model still remains with the analyst and the people who know the business.