Definition
Causal inference is the reasoning that turns data into a claim about the effect of an intervention: how an outcome would change if a condition were set one way rather than another, for the same units (the things studied, such as devices). It defines the effect through counterfactual outcomes, those the units would have shown under the condition they did not receive, and states the design and assumptions under which the observed data determine that effect. Without such an argument, a difference in data is only an association.
The idea
A request handled by a new software version took 12 milliseconds (ms). The causal question is how long the same request would have taken under the old version. That second number is a counterfactual: it would have been observed only if the request had been handled differently, and it never was. Running the request again under the old version gives a related number, not the same one, because the moment, the temperature and the radio noise have changed. This is called the fundamental problem of causal inference: for each unit, at most one of the outcomes being compared is ever observed.
Causal inference supplies the missing outcome with a stand-in and argues that the stand-in is fair. Three stand-ins are common.
The same unit at another time, measured under the other condition just before or just after. Fair if the unit is stable between the two measurements and the first leaves no trace in the second.
Other units assigned by chance, which received the other condition by random assignment §11.8. Fair on average, because chance cannot favor either condition.
Other units judged comparable, which happened to receive the other condition and are compared after adjusting for measured differences. Fair only if no unmeasured difference affects the outcome.
How it works
Define the question: the units, the population of units the answer is about, the two conditions as exact versions (which build, which settings), and the outcome with its unit of measurement.
Define the causal estimand §11.2, the quantity the study aims to estimate. The most common is the average treatment effect (ATE): the average, over the population of units, of each unit’s outcome under the treatment (the changed condition) minus its outcome under the baseline (the reference condition).
Choose a design that supplies the stand-ins: a randomized experiment; a paired design §11.7, in which each unit receives both conditions in random order; a blocked design; or an observational comparison of units that happened to receive different conditions, with adjustment.
State the assumptions that connect the observed data to the estimand (listed under Stated precisely) and argue for each one.
Estimate the effect, with an uncertainty computed from the variation between the units that were assigned.
Ask what would break the conclusion. A sensitivity analysis §11.46 states how strong an unmeasured influence would have to be to change the answer.
The reasoning can be written in two notations. Potential outcomes, used in the rest of this entry, list each unit’s outcome under each condition. A causal diagram is a directed acyclic graph §14.17 in which an arrow from one factor to another means that the first directly affects the second. The diagram shows which factors must be held fixed or adjusted for: those that open a second route between condition and outcome through a common cause (see the confounding §11.10 entry).
Worked example
Take a hypothetical population of two units whose outcomes under both conditions are known, which never happens in practice.
| Unit | Baseline (ms) | Treatment (ms) | Effect (ms) |
| A | 10 | 12 | 2 |
| B | 20 | 26 | 6 |
The individual effects are ms and ms. The average treatment effect is ms.
One unit per condition, chosen by a fair coin. Treating A and leaving B at baseline shows 12 ms and 20 ms, a difference of ms. Treating B shows 26 ms and 10 ms, a difference of ms. Each assignment has probability one half, so the expected estimate is ms, the true average. The design is unbiased, yet every single run of it is off by 12 ms.
A deliberate choice. An engineer who applies the new version to the unit that looks slow, B, always observes the difference ms, four times the true average. Unit B was slower to begin with, by ms. That baseline gap is the confounding bias: , the effect on B plus the gap.
Each unit under both conditions. Measuring each unit under both conditions gives ms for A and ms for B, an average of 4 ms, exactly, every time. This within-unit stand-in is the best available when its two assumptions hold: the unit does not change between the two measurements, and the first measurement does not affect the second.
Stated precisely
Number the units . Let and be the potential outcomes of unit : the outcomes it would show under the treatment and under the baseline. Let be 1 if unit received the treatment and 0 otherwise. The unit’s effect is , with the Greek letter tau, and the average treatment effect over the units is where means the sum over all units. Only one of and is ever observed. The connection to data rests on named assumptions:
Consistency: the observed outcome of unit is , the potential outcome of the condition it received. It fails when the treatment covers several versions, such as two builds with different settings.
No interference: a unit’s outcome depends only on its own condition. It fails when one board’s radio traffic delays another board on the same channel. Consistency and no interference together are called the stable unit treatment value assumption (SUTVA).
Exchangeability: the condition a unit received is independent of its potential outcomes, so knowing those outcomes would not help predict the condition. Random assignment makes this true by construction. In an observational comparison it is assumed within each level of measured factors , and is then called no unmeasured confounding.
Positivity, also called overlap: every unit, or every level of , had a probability above zero of receiving each condition.
Under consistency, no interference and complete randomization (a fixed number of treated units, , with every choice of those units equally likely), the mean observed outcome of the treated units minus that of the baseline units has an expected value, over the random assignment, equal to the ATE. Under consistency, no interference, exchangeability within levels of and positivity, the average of over a population equals where is the share of the population with , and is the mean observed outcome of the units with condition and level . This adjustment formula compares the conditions inside each level of and weights each level by its share.
Limits and common mistakes
Random assignment between units identifies average effects, not the effect on any single unit. In the example, the randomized comparison recovers 4 ms on average but never shows that unit A’s effect is 2 ms.
The within-unit stand-in depends on stability and on the absence of carryover, the influence of the first measurement on the second. Neither can be fully checked from the two measurements; randomizing the order and repeating the pair is the usual protection.
Correlation §15.44, time order and a plausible mechanism do not establish a cause.
An effect identified for the units, inputs and conditions studied need not hold for others; that question is external validity §11.44.
Outcomes that go missing for reasons tied to the condition or to the outcome, such as runs that crashed under the new version and were dropped, break the argument unless a rule stated in advance handles them.
Knowing that a change causes an effect does not say how. A claim about the mechanism needs its own evidence, such as measurements of the intermediate steps.
Questions answered
What comparison approximates the counterfactual for the same unit?
The closest approximation is the same unit measured under the other condition at a nearby time, with the order of the two conditions chosen at random and nothing carried over from the first measurement to the second. The counterfactual is the outcome the unit would have shown under the condition it did not receive. This within-unit comparison, a paired design, estimates the unit’s own effect if the unit stays stable between the two measurements. When a unit can receive only one condition, for example because the first measurement changes it permanently, random assignment across comparable units is the next stand-in. It does not recover any one unit’s counterfactual, but it recovers the average effect over the units, because chance cannot favor either condition. A comparison of units that happened to receive different conditions needs the explicit assumption that no unmeasured factor affects both the condition and the outcome. An uncontrolled before-and-after comparison is not a fair stand-in, because everything else that changed in between is mixed into the difference.
Related entries: Paired design (§11.7), Randomization (§11.8), Confounding (§11.10), External validity (§11.44), Estimand and estimator (§11.2).