liveBook · Manning

Linear regression

As explained in Causal AI

A linear model represents an outcome as a linear or affine function of predictor variables and model parameters, typically with an error term.

Suppose you want to know whether greater engagement with a game feature changes in-game purchases. Regressing purchases on engagement can describe an association, but the engagement coefficient is not automatically a causal effect. First identify an effect using causal assumptions; then choose a model to estimate it. section 10.1.2 section 11.4

Regression fits parameters by minimizing the difference between a function of predictors and an observed response. A linear relationship is convenient to fit, but its shape matters: if the expected outcome under intervention is linear in the treatment, its derivative is constant, so the treatment coefficient can represent a single average treatment effect (ATE). That interpretation depends on modeling the interventional outcome, not merely observing a straight-looking association. section 6.4.7 section 7.4.6

A linear causal mechanism

For an adult male, let x be femur length in centimeters and y be height in centimeters. One proposed mechanism is y = 25 + 3x + nᵧ, where nᵧ represents other causes of height and follows a normal distribution with mean 0 and scale 3.3 cm. The coefficient 3 asserts a proportional change in height with femur length. In a structural causal model, that is an assumption about how a cause acts—not just a convenient fit. section 6.1.1 section 6.1.5

For a backdoor-identified effect, regress the outcome on the treatment and the confounders specified by the adjustment set. With a linear model, the treatment coefficient estimates the ATE; coefficients for included confounders serve the adjustment rather than being the target. Do not add predictors solely because they improve fit: predictors in a structural causal assignment are limited to direct endogenous causes. A regression used for backdoor adjustment instead includes the identified confounders. section 11.4.1 section 6.4.7

Listing 11.5 Estimating the backdoor estimand with linear regression
causal_estimate_reg = model.estimate_effect(
    identified_estimand,    #1
    method_name="backdoor.linear_regression",  #2
    confidence_intervals=True    #3
)

The DoWhy call selects linear regression as the estimator for an already identified backdoor estimand and requests a confidence interval. section 11.4

## Realized estimand
b: In-game Purchases~Side-quest Engagement+Guild Membership+Time Spent Playing+Player Skill Level
Target units: ate

## Estimate
Mean value: 178.08617115757784
95.0% confidence interval: [[168.68114922 187.4911931 ]]

The resulting regression formula includes engagement and three adjustment variables; the displayed ATE estimate is about 178.09, with a 95% confidence interval from about 168.68 to 187.49. section 11.4.1

Linearity can also supply an additional assumption for instrumental-variable estimation when graphical assumptions alone do not identify the effect. That extra reach brings risk: look for evidence of nonlinearity, and do not treat a well-fitting regression as validation of a causal mechanism. Generalized linear models offer other response relationships, but their link functions are not, by themselves, causal mechanisms. section 11.3.2 section 4.5.4 section 6.4.7

How Causal AI covers it

How deep it goes
Defines parameter fitting, works through backdoor regression and its coefficient interpretation, and flags the limits of linear causal assumptions.
Examples
Uses a femur-length-to-height equation and a game-engagement regression with three confounders, an effect estimate, and a confidence interval.
What it assumes
Assumes causal DAG and backdoor-adjustment concepts while defining regression parameter fitting explicitly.
What you can do after
Apply it via DoWhy to estimate an identified backdoor effect and interpret the treatment coefficient under a linearity assumption.
How it connects
Connects linear regression to structural causal models, backdoor adjustment, average treatment effects, and instrumental variables.

Also explained in

Compare how 22 books explain linear regression →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Causal AI. The section links point to the parts of the book it draws on.