Bell Statistics

What is regression analysis?

Regression analysis fits an equation describing how an outcome varies with one or more predictors. Each coefficient estimates the average change in the outcome per unit change in that predictor, holding the others in the model fixed.

Also called
linear regression, OLS, least squares
Allon Korem

Written by Allon Korem

Chief Executive Officer

Last updated

In plain English

Regression fits an equation to data: an outcome on the left, one or more predictors on the right, and coefficients chosen to make the errors as small as possible. Ordinary least squares picks the coefficients that minimise the sum of squared residuals, which has a closed-form solution and is why the method predates computers. Each coefficient is read as the average change in the outcome associated with a one-unit change in that predictor, with the other predictors in the model held constant.

That last clause is doing enormous work and is the source of most misreadings. "Holding constant" means holding constant *the variables in the model*. Anything omitted is not held constant — it varies freely and its influence gets absorbed into whichever included predictor it correlates with. So a regression coefficient is a conditional association, and it becomes a causal effect only under an assumption about what was left out. That assumption is not tested by any statistic in the output, which is why a regression can be beautifully specified and confidently wrong.

The standard assumptions are worth knowing by what they affect rather than as a list. Linearity in the parameters, and correct functional form, affect the estimates themselves — fitting a straight line through a curved relationship gives a coefficient that describes neither end of it. Independent errors and constant variance affect the standard errors rather than the coefficients, which matters because time-series and clustered data violate both routinely and produce confidence intervals several times too narrow. Normality of errors affects small-sample inference only and is the least important of the set.

Two diagnostics repay the time. Plot residuals against fitted values, which reveals curvature, changing spread and influential points more reliably than any test statistic. And check multicollinearity when predictors move together, since correlated predictors make individual coefficients unstable and hard to interpret even while the model as a whole predicts perfectly well. Neither of these is a test to pass; both are ways of finding out what the model is actually doing.

Regression is the engine underneath a great deal of applied work — marketing mix modelling is a regression with adstock and saturation transformations, difference-in-differences is a regression with an interaction term, and the analysis of a randomised experiment is a regression with one binary predictor. In that last case the causal claim comes from the randomisation rather than from the model, which is the cleanest illustration of the general rule: regression estimates associations, and it is the design that decides whether an association may be read as an effect.

The formula

The model, the estimator and the two quantities you read off the output. The matrix form is worth seeing because it makes the collinearity problem obvious.

The model
Y = β₀ + β₁X₁ + β₂X₂ + … + βₖXₖ + ε

Linear in the parameters, not necessarily in the variables — X² and log(X) are both fine and keep it a linear model.

Least squares estimator
β̂ = (XᵀX)⁻¹ Xᵀy

The inverse is what fails when predictors are collinear: XᵀX becomes near-singular, and the coefficients become wildly unstable.

Coefficient inference
t = β̂ⱼ / SE(β̂ⱼ), df = n − k − 1

Report the confidence interval rather than the p-value — see the two-sample t-test calculator, which is a regression with one binary predictor.

Goodness of fit
R² = 1 − SS_res/SS_tot, adjusted R² = 1 − (1−R²)·(n−1)/(n−k−1)

R² never falls when you add a predictor, so use the adjusted version when comparing specifications — and neither says anything about whether the model is causal.

Worked example

An analyst regresses weekly revenue on weekly marketing spend across 104 weeks. The coefficient is 2.8 with a t of 9.4 and an R-squared of 0.71. They present it as a return of £2.80 per pound spent.

Model
revenue ~ spend
Coefficient on spend
2.8 (SE 0.30, t = 9.4)
R-squared
0.71
After adding seasonality and promotions
1.1 (SE 0.42)
R-squared after
0.88
Geo test estimate
1.3 (95% CI 0.9 to 1.7)

Adding seasonality and promotions cuts the coefficient from 2.8 to 1.1. A randomised geo test puts the true figure near 1.3.

The first model is not a bad fit — R-squared of 0.71 and a t of 9.4 look convincing — and it is wrong by a factor of more than two, because spend rises in the same weeks that promotions run and demand peaks. The omitted variables were absorbed straight into the spend coefficient, which is [confounding](/glossary/confounding-variable) doing exactly what the algebra predicts. The second model is much better and still not causal: it controls for the drivers that were measured, and only the geo test replaces that assumption with randomisation. Note too that R-squared rose while the coefficient of interest fell by 60%, which is the clearest possible demonstration that fit quality and coefficient credibility are unrelated.

Common misconceptions

The coefficient tells us the effect of that variable, holding everything else constant.
It holds constant the variables in the model. Everything omitted varies freely and its influence is absorbed into whichever included predictor it correlates with. The phrase is accurate only if you finish the sentence with "of the ones I included", which changes how much weight it can carry.
A high R-squared means the model is good.
It means the predictors track the outcome in this sample, which is easy with trending or seasonal data and says nothing about causality or about performance on new data. R-squared also never falls when you add a variable, so it cannot be used to compare specifications — and a model can have an excellent fit with a badly biased coefficient on the one variable you care about.
Non-significant predictors should be dropped from the model.
Not if theory says they belong. Dropping a genuine confounder because its own coefficient is imprecise re-introduces omitted variable bias into the coefficients you do care about. Stepwise selection driven by p-values is particularly damaging, since it invalidates the very inference it is using to choose.

Frequently asked questions

Can regression prove causation?
Not on its own. A coefficient is a conditional association, and reading it as an effect requires assuming that everything relevant that was omitted is unrelated to the predictor in question — an assumption no diagnostic can check. What makes a regression causal is the design it sits inside: randomised assignment, a valid instrument, or a difference-in-differences structure. The model is the arithmetic; the design is the argument.
How many predictors can I include?
Fewer than you would like, and the binding constraint is usually observations rather than a rule of thumb. With 104 weekly observations, a dozen predictors is already stretching it, and each additional one costs precision in all the others while raising the risk of overfitting. Correlated predictors cost more than independent ones. Regularisation helps when prediction is the goal and complicates interpretation when it is not.
How do I check regression assumptions?
Start with a plot of residuals against fitted values, which reveals curvature, changing variance and influential observations at a glance and is worth more than any single test. Add a residual-versus-time plot for anything sequential, since autocorrelation destroys standard errors. Check variance inflation factors when predictors are related. Formal tests are useful, but the plots tell you what is wrong rather than merely that something is.
Can I run a regression on time-series data?
Yes, with care, because two of the standard assumptions fail routinely. Errors are serially correlated, so ordinary standard errors are badly understated and intervals come out far too narrow. And two unrelated trending series will correlate strongly, producing a spurious relationship — the classic warning case. Difference or detrend the series, model the seasonality explicitly, and use standard errors robust to autocorrelation.

Related terms

  • Adstock

    Advertising does not stop working the week it stops running — and this is how models say so.

  • Confounding variable

    A common cause of both variables — the reason a strong, stable correlation can mean nothing.

  • Correlation

    How tightly two variables move together — bounded, unitless, and silent about cause.

  • Difference-in-differences

    Subtract the untreated group's change from the treated group's — and everything rests on parallel trends.

  • Diminishing returns

    The tenth million does less than the first — and why average ROAS is the wrong number to budget on.

  • Marketing mix modelling

    One regression across every channel, built on aggregate data — no tracking, and strong assumptions.

  • Multicollinearity

    When predictors move together the model cannot separate them — good predictions, meaningless coefficients.

  • Overfitting

    A model that memorised the noise — excellent on the data it saw, useless on the data it will meet.

  • Propensity score matching

    Pair like with like on the probability of being treated — and hope nothing important went unmeasured.

  • R-squared

    Share of variance explained — the most quoted and most over-interpreted number in any model output.

Calculate it

  • Correlation test

    Pearson r or Spearman rho, with the Fisher-z interval that says how little a small sample knows.

  • Two-sample t-test

    Compare the average of two independent groups — plan the sample size, then test the result.

  • One-way ANOVA

    Three or more independent groups on one continuous outcome — size it, then run the F test.

Knowing the term is the easy part

Applying it to a live measurement problem is the part that goes wrong. If you are designing an experiment, reading a result you do not trust, or trying to work out what your marketing actually caused, that is the work we do.

References

  • Gelman, A., & Hill, J. (2006). Data Analysis Using Regression and Multilevel/Hierarchical Models. Cambridge University Press.
  • Angrist, J. D., & Pischke, J.-S. (2009). Mostly Harmless Econometrics: An Empiricist's Companion. Princeton University Press.