Data · Guide

Causal Inference

Getting from correlation to cause when you cannot run the experiment.

— min read Data

The Question Behind Most Analyses

Almost every business question is causal — would revenue rise because we did this — but the data available is observational, where the people who did the thing differ from those who did not in ways nobody recorded.

The counterfactual is what you actually want: what would have happened to these same users had they not been treated. It is unobservable by definition, so every method here is a strategy for constructing a credible stand-in for it.

Confounding & DAGs

A confounder causes both the treatment and the outcome, so it manufactures an association that is not causal. Users who install the mobile app spend more — but engaged users are likelier both to install and to spend, and engagement is doing the work.

StructureDo
Confounder — causes treatment and outcomeControl for it
Mediator — sits on the causal pathDo not control: it removes the effect you want
Collider — caused by bothDo not control: it creates false association

Drawing the assumed causal graph first is what makes those distinctions visible. "Control for everything available" is not a strategy — conditioning on a mediator or a collider actively introduces bias rather than removing it.

Selection bias is the version that catches everyone: comparing users who chose the feature with users who did not measures who chooses features, not what the feature does.

Why Randomisation Wins

A randomised experiment settles the problem by construction: assignment is independent of every characteristic, observed or not, so the groups differ only by chance and by the treatment. That is why an A/B test beats any amount of clever observational modelling when it is available.

Run the experiment unless
It is unethicalDeliberately degrading someone's service
It is impossibleA pricing change across a whole market
It is too slowThe effect takes a year to appear
It already happenedYou are evaluating a launch after the fact

The methods below are what you reach for in those cases — each buying credibility with a different assumption, stated explicitly.

Difference-in-Differences, Matching & IV

Difference-in-differences compares the change in a treated group with the change in an untreated one over the same period, cancelling anything that affected both. Its assumption is parallel trends: without treatment the two would have moved together — which you support by showing they did before the intervention.

MethodIdeaAssumption to defend
Difference-in-differencesCompare changes, not levelsParallel pre-trends
Matching / propensity scoresBuild a comparable control groupNo unobserved confounders
Instrumental variablesUse a nudge that only affects the outcome via treatmentThe instrument is truly exogenous
Regression discontinuityCompare either side of a cutoffNothing else jumps at the cutoff
Synthetic controlBuild a weighted control from other unitsThe synthetic tracks the pre-period well
The credibility of any of these lives entirely in its assumption, not its arithmetic. Report the assumption, show the evidence for it, and test how much the conclusion moves when it is relaxed — an unstated assumption is the whole result.

Be honest about what is being estimated, too. Most of these recover the effect for a particular subgroup — those near a cutoff, or those a nudge actually moved — which is not the same as the average effect across everybody.

Interview Questions

Why is correlation insufficient for a business decision?

The decision is causal — would acting change the outcome. Observational groups differ in unrecorded ways, so the association may be entirely produced by a confounder.

What is a confounder, and how does it differ from a mediator?

A confounder causes both treatment and outcome and must be controlled for. A mediator sits on the causal path, and controlling for it removes part of the very effect you are measuring.

Why should you not control for a collider?

A collider is caused by both variables. Conditioning on it creates an association between them that does not exist, so it introduces bias rather than removing it.

Why does randomisation solve confounding?

Assignment is independent of every characteristic, observed or not, so the groups differ only by chance and by the treatment itself.

What does difference-in-differences assume?

Parallel trends: absent the treatment, both groups would have moved together. You support it by showing their pre-treatment trends already tracked each other.

What is the weakness of matching?

It balances observed variables only. Any unobserved confounder survives the matching, so the estimate is credible only where you can argue nothing important was unmeasured.

Quick Quiz

1. A confounder…
2. Controlling for a mediator…
3. Difference-in-differences assumes…
4. Matching controls for…
5. Comparing users who chose a feature with those who did not measures…