liveBook · Manning

Causal inference

As explained in Causal Inference for Data Science

A causal problem is a problem of determining whether and how one factor causes an outcome.

Causal inference asks a decision-focused question: if you change a treatment, policy, feature, price, or medication, how will an outcome change? Unlike prediction, which estimates what is likely to happen, it seeks the effects of actions and the factors that produce outcomes. section 1.0 section 4.1.1

The central challenge is that correlation is not causation. A third variable may affect both the treatment and the outcome, creating confounding bias. For example, age can influence both which medication a patient receives and how quickly they recover, obscuring the medication’s effect. section 1.4 section 1.4.2

Figure 1.6 Apart from how treatment may affect recovery, there’s a third element affecting both simultaneously. These elements are called confounders. For instance, in this example, age is a confounder.
figure

Use this diagram to distinguish the treatment-to-outcome relationship from a confounder that influences both variables. section 1.4.2

A practical causal analysis typically proceeds by:

  • Determining whether data are experimental or observational; randomized experiments provide stronger causal evidence, but may be infeasible, unethical, costly, or too slow. section 1.1.1 section 1.3.5
  • Defining the treatment, outcome, objective, and all plausible variables involved in how the data was generated. section 3.6
  • Drawing a directed acyclic graph (DAG), consulting domain experts, and making assumptions and limitations explicit. section 1.8 section 3.6
  • Identifying confounders and checking positivity: the treatment must have occurred in the situations being compared. section 2.9
  • Choosing a suitable method to estimate a causal effect, or collecting new data when essential confounders are unavailable. section 1.1.5

Randomized controlled trials (RCTs) and A/B tests are the preferred way to estimate causal effects because random assignment removes confounding. Their average treatment effect (ATE) compares the average outcome under one treatment with the average outcome under another. Observational studies need additional assumptions and methods because treatment was not assigned at random. section 1.3.4 section 1.8

Website launch: before-and-after is not enough

Suppose traffic rises after a redesigned website launches. The redesign may have helped, but competitor actions and unknown changes may also have influenced visits. A causal analysis asks whether the new site changed traffic after accounting for relevant alternative causes; a simple before-and-after comparison cannot settle that question. section 1.3.1

For observational data, methods such as the adjustment formula aim to remove confounding effects; instrumental-variable methods use a variable that affects treatment but is unrelated to confounders. Method choice depends on the graph, available variables, and assumptions. Model accuracy or cross-validation error alone cannot validate a causal conclusion, since a key confounder may be missing. section 1.1.5 section 4.1.5

Prediction and intervention answer different questions

A hospital can predict which COVID-19 patients may soon need intensive care and use that forecast to prioritize treatment. To prevent intensive-care admissions, it instead needs to determine which factors causally affect severe illness—an intervention question requiring causal reasoning. section 4.1.1

Figure 1.1 Five steps in the typical process of causal inference
figure

Use the five-step process as a checklist for moving from a causal question to an analysis that states its data, assumptions, and method. section 1.1

How Causal Inference for Data Science covers it

How deep it goes
Develops workflows, graphs, confounding, ATE, and estimation methods while deferring detailed formulas and later graph tools.
Examples
Uses illness treatments, website traffic, arcade revenue, COVID-19 triage, and synthetic game-level data to expose misleading associations.
What it assumes
Assumes familiarity with data analysis while motivating statistical foundations, domain knowledge, and causal-model reasoning needed for trustworthy conclusions.
What you can do after
Evaluate/understand whether a causal question needs an experiment or observational analysis, then map confounders and assumptions before estimating effects.
How it connects
Connects confounders, directed acyclic graphs, average treatment effect, adjustment formula, instrumental variables, propensity scores, and supervised learning.

Also explained in

Compare how 2 books explain causal inference →

Related concepts

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