Chapter 2: Randomized Experiments

Published

Last modified: 2026-10-09 12:05:56 (UTC)

📝 Preview Changes: This page has been modified in this pull request (~72% of content changed).
🎨 Highlighting Legend: Modified text (yellow) shows changed words/phrases, added text (green) shows new content, and new sections (blue) highlight entirely new paragraphs.

If you look up at the sky on a busy street, do the people walking past look up as well? Like every causal question, this one names something done (your glance upward), something that may follow (passers-by glancing upward), and a group of people it concerns (for instance, people living in Madrid in 2019). This chapter explains why one kind of study, the randomized experiment, can answer such questions convincingly.

Definition 1 (Experiment and randomized experiment) A study is an experiment if the investigator, not the subjects or anyone else, assigns the action of interest: the investigator decides who gets it. An experiment is randomized if a chance mechanism, such as a coin flip, makes those assignments, and nonrandomized if no chance mechanism makes them, for example when a fixed rule based on each subject’s characteristics does (Hernán and Robins 2020, 13).

Example 1 (Looking up at the sky) Stand on a sidewalk and flip a coin each time a pedestrian approaches: on heads, look up; on tails, look straight ahead. After a few thousand repetitions, compare, for each action, the share of pedestrians who look up within the next 10 seconds. This is a randomized experiment (Definition 1): you carry out the action, and the coin decides whom you act on. Suppose 55% looked up when you did and 1% when you did not.

Example 2 (A nonrandomized version) Now look up whenever a man approaches and straight ahead whenever a woman does. This is still an experiment, but a nonrandomized one (Definition 1): sex, not a coin, decides the action. A skeptic could point out that men and women might respond differently to a stranger’s upward glance, so any difference could reflect who was in each group rather than your action; the groups are not comparable, and the result persuades far less (Hernán and Robins 2020, 13).

This chapter is based on Hernán and Robins (2020, chap. 2, pp. 13-25).

1 2.1 Randomization (pp. 13-16)


In a typical study we see only one of Zeus’s two potential outcomes: the one under the treatment he actually got. Table 2.1 adds the counterfactual columns to the observed data of Table 1.2; “?” marks the counterfactual outcome that is missing.

Table 2.1: Observed data with counterfactual outcomes, Zeus’s family (Hernán and Robins 2020, 14)

Name \(A\) \(Y\) \(Y^{a=0}\) \(Y^{a=1}\)
Rheia 0 0 0 ?
Kronos 0 1 1 ?
Demeter 0 0 0 ?
Hades 0 0 0 ?
Hestia 1 0 ? 0
Poseidon 1 0 ? 0
Hera 1 0 ? 0
Zeus 1 1 ? 1
Artemis 0 1 1 ?
Apollo 0 1 1 ?
Leto 0 0 0 ?
Ares 1 1 ? 1
Athena 1 1 ? 1
Hephaestus 1 1 ? 1
Aphrodite 1 1 ? 1
Polyphemus 1 1 ? 1
Persephone 1 1 ? 1
Hermes 1 0 ? 0
Hebe 1 0 ? 0
Dionysus 1 0 ? 0

With half the counterfactual outcomes missing, Table 2.1 by itself only supports association measures. Randomized experiments also have missing counterfactuals. But randomization ensures the values are missing by chance, so effect measures can be consistently estimated despite the missing data.

The use of counterfactuals to estimate effects in randomized experiments goes back to Neyman (1923) (Hernán and Robins 2020, 13).

1.1 An Ideal Randomized Experiment

Definition 2 (Ideal randomized experiment) An ideal randomized experiment is a randomized experiment (Definition 1) that also satisfies the following:

  • every participant is followed until the end of the study (no loss to follow-up);
  • every participant takes the assigned treatment throughout (full adherence);
  • there is a single version of treatment;
  • assignment is double-blind: neither the participants nor the investigators know who received which treatment (Chapter 9) (Hernán and Robins 2020, 14).

Example 3 (A coin for every individual) Take the near-infinite population drawn as a diamond in Figure 1.1, and flip a coin for each individual, with probability of heads below 50%:

  • tails: white group, given the treatment (\(A = 1\));
  • heads: grey group, given placebo (\(A = 0\)).

Suppose the experiment is otherwise ideal (Definition 2). Let \(Y = 1\) if the individual has died by day 5 and \(Y = 0\) otherwise. At the end of the study, \(\Pr[Y = 1 \mid A = 1] = 0.3\) and \(\Pr[Y = 1 \mid A = 0] = 0.6\), so the associational risk ratio is \(0.3/0.6 = 0.5\) and the associational risk difference is \(0.3 - 0.6 = -0.3\).

Real experiments rarely meet all four requirements. The ideal version is a teaching device, and later chapters relax it (Hernán and Robins 2020, 14).

1.2 Exchangeability

When a coin decides who is treated, it should not matter which of the two groups the coin sends to treatment. The property behind this intuition is exchangeability.

Definition 3 (Exchangeability) Let \(A\) be a dichotomous treatment, with \(0 < \Pr[A = 1] < 1\), and \(Y\) a dichotomous outcome with counterfactual outcomes \(Y^a\) for \(a = 0, 1\) (Chapter 1). The treated and the untreated are exchangeable if, for each treatment value \(a\), the risk under \(a\) is the same in both groups: \[ \Pr[Y^a = 1 \mid A = 1] = \Pr[Y^a = 1 \mid A = 0] \quad \text{for } a = 0 \text{ and } a = 1. \tag{1}\] Equivalently, the counterfactual outcome is independent of the actual treatment: \(Y^a \perp\!\!\!\perp A\) for all \(a\) (Hernán and Robins 2020, 14).

Example 4 (Swapping the groups) In Example 3, suppose the assistants misread the instructions and treated the grey group instead of the white one. Because the coin formed the groups, neither group is expected to be at higher risk than the other under either treatment value. We would still expect a risk of 0.3 among those treated, who are now the grey group, and a risk of 0.6 among those not treated. Which group was treated does not matter: the white and grey groups are exchangeable (Definition 3).


Proposition 1 (Under exchangeability, treatment does not predict the counterfactual outcome) Let \(A\) and \(Y\) be dichotomous, with \(0 < \Pr[A = 1] < 1\). If exchangeability (Definition 3) holds, then, for \(a = 0, 1\), \[ \Pr[Y^a = 1 \mid A = 1] = \Pr[Y^a = 1 \mid A = 0] = \Pr[Y^a = 1]. \] Knowing someone’s treatment therefore tells us nothing about that person’s \(Y^a\) (Hernán and Robins 2020, 14).

Proof. By the law of total probability, \(\Pr[Y^a = 1] = \Pr[Y^a = 1 \mid A = 1] \Pr[A = 1] + \Pr[Y^a = 1 \mid A = 0] \Pr[A = 0]\). Under exchangeability the two conditional risks have a common value \(p\), so \(\Pr[Y^a = 1] = p \mathopen{}\left(\Pr[A = 1] + \Pr[A = 0]\right)\mathclose{} = p\).

That is why randomization matters: it is the study design we expect to deliver exchangeability.

Some authors call an exchangeable treatment exogenous, using exogeneity as another name for exchangeability (Hernán and Robins 2020, 14).

1.3 In Ideal Randomized Experiments, Association Is Causation

Proposition 2 (Association is causation under exchangeability) Let \(A\) and \(Y\) be dichotomous, with \(0 < \Pr[A = 1] < 1\). Suppose that consistency holds (\(Y = Y^A\)) and that exchangeability (Definition 3) holds. Then, for \(a = 0, 1\), \[ \Pr[Y^a = 1] = \Pr[Y = 1 \mid A = a]. \tag{2}\] So the causal risk difference \(\Pr[Y^{a=1} = 1] - \Pr[Y^{a=0} = 1]\) equals the associational risk difference \(\Pr[Y = 1 \mid A = 1] - \Pr[Y = 1 \mid A = 0]\), and, when \(\Pr[Y = 1 \mid A = 0] > 0\), the causal risk ratio equals the associational risk ratio (Hernán and Robins 2020, 14–15).

Proof. The first step below is Proposition 1; the second is consistency, since \(Y = Y^a\) for everyone with \(A = a\). \[ \begin{aligned} \Pr[Y^a = 1] &= \Pr[Y^a = 1 \mid A = a] \\ &= \Pr[Y = 1 \mid A = a]. \end{aligned} \]

Example 5 (Causal effects in the coin-flip experiment) In Example 3 the white group was actually treated, so its risk under treatment is not counterfactual at all. Assume consistency, and assume, as Example 4 argues, that the coin made the groups exchangeable. Then, by Proposition 2, \(\Pr[Y^{a=1} = 1] = \Pr[Y = 1 \mid A = 1] = 0.3\) and \(\Pr[Y^{a=0} = 1] = \Pr[Y = 1 \mid A = 0] = 0.6\). The causal risk ratio is \(0.3/0.6 = 0.5\) and the causal risk difference is \(0.3 - 0.6 = -0.3\), the same as the associational measures.


Remark 1 (Counterfactual outcomes as baseline traits). Here is a second way to see why randomization gives \(Y^a \perp\!\!\!\perp A\). Think of \(Y^a\) as a characteristic each person carries into the study, much like a blood type: it is settled before the coin is flipped, because it describes the outcome under \(a\) regardless of the treatment later assigned. A coin knows nothing about anyone’s blood type, or about anyone’s \(Y^a\). The analogy has a limit: a blood type can be measured at any time, whereas \(Y^a\) is revealed only after treatment, and only in people who actually received \(a\) (adapted from Hernán and Robins 2020, 15, which uses genetic make-up as the analogy).

1.4 Full and Mean Exchangeability

Definition 4 (Full exchangeability (Technical Point 2.1)) Let \(\mathcal{A} = \mathopen{}\left\{a, a', a'', \ldots\right\}\mathclose{}\) be the set of treatment values present in the population and \(Y^{\mathcal{A}} = \mathopen{}\left\{Y^a, Y^{a'}, Y^{a''}, \ldots\right\}\mathclose{}\) the set of all counterfactual outcomes. There is full exchangeability if \(Y^{\mathcal{A}} \perp\!\!\!\perp A\), that is, if the counterfactual outcomes are jointly independent of the treatment. For a dichotomous treatment, \(\mathcal{A} = \mathopen{}\left\{0, 1\right\}\mathclose{}\) and full exchangeability is \(\mathopen{}\left\{Y^{a=1}, Y^{a=0}\right\}\mathclose{} \perp\!\!\!\perp A\) (Hernán and Robins 2020, 15).

Example 6 (Exchangeable but not fully exchangeable) Take a population with four equally common kinds of individuals, written as pairs \((Y^{a=0}, Y^{a=1})\): the treated are of kinds \((0, 0)\) and \((1, 1)\), and the untreated are of kinds \((0, 1)\) and \((1, 0)\). In each treatment group, half have \(Y^{a=0} = 1\) and half have \(Y^{a=1} = 1\), so the groups are exchangeable (Definition 3). But the treated are exactly the individuals whom treatment would not affect, and the untreated exactly those whom it would, so the pair \(\mathopen{}\left\{Y^{a=1}, Y^{a=0}\right\}\mathclose{}\) depends on \(A\), and full exchangeability (Definition 4) fails.

Proposition 3 (Full exchangeability implies exchangeability (Technical Point 2.1)) For any treatment and outcome, full exchangeability (Definition 4) implies \(Y^a \perp\!\!\!\perp A\) for each \(a\), which for a dichotomous treatment and outcome is exchangeability (Definition 3). The converse is false (Hernán and Robins 2020, 15).

Proof. If the whole set \(Y^{\mathcal{A}}\) is independent of \(A\), so is each of its members \(Y^a\). Example 6 is a population in which the converse fails.

A coin flip assigns \(A\) independently of everything that exists before assignment, including the whole set \(Y^{\mathcal{A}}\), so randomization produces full exchangeability.


Definition 5 (Mean exchangeability (Technical Point 2.1)) For a treatment \(A\) and an outcome \(Y\) with finite counterfactual means \(\operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{}\), there is mean exchangeability if \(\operatorname{E}\mathopen{}\left[Y^a \mid A = a'\right]\mathclose{} = \operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{}\) for all treatment values \(a\) and \(a'\) present in the population (Hernán and Robins 2020, 15).

Example 7 (Equal means, unequal spreads) For a dichotomous outcome and treatment, \(\operatorname{E}\mathopen{}\left[Y^a \mid A = a'\right]\mathclose{} = \Pr[Y^a = 1 \mid A = a']\), so mean exchangeability says that the risks in Equation 1 are equal: it is the same as exchangeability (Definition 3). For a continuous outcome, mean exchangeability can hold while exchangeability in the sense \(Y^a \perp\!\!\!\perp A\) fails. Suppose that, under each treatment value \(a\), systolic blood pressure \(Y^a\) has mean 130 millimeters of mercury in both the treated and the untreated, but a standard deviation of 10 in the treated and 20 in the untreated. Mean exchangeability (Definition 5) holds, yet \(Y^a\) is not independent of \(A\), because its spread depends on \(A\).

Proposition 4 (Mean exchangeability suffices (Technical Point 2.1)) Let \(a\) be a treatment value with \(\Pr[A = a] > 0\), and let \(\operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{}\) be finite. If consistency (\(Y = Y^A\)) and mean exchangeability (Definition 5) hold, then \[ \operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{} = \operatorname{E}\mathopen{}\left[Y \mid A = a\right]\mathclose{}. \tag{3}\] Full exchangeability implies \(Y^a \perp\!\!\!\perp A\) for each \(a\) (Proposition 3), which in turn implies mean exchangeability, so any of the three can take its place here (Hernán and Robins 2020, 15).

Proof. \[ \begin{aligned} \operatorname{E}\mathopen{}\left[Y \mid A = a\right]\mathclose{} &= \operatorname{E}\mathopen{}\left[Y^a \mid A = a\right]\mathclose{} && \text{(consistency)} \\ &= \operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{} && \text{(mean exchangeability)}. \end{aligned} \] If \(Y^a \perp\!\!\!\perp A\), then \(\operatorname{E}\mathopen{}\left[Y^a \mid A = a'\right]\mathclose{} = \operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{}\) for every \(a'\) with \(\Pr[A = a'] > 0\), which is mean exchangeability.

1.5 Caution: \(Y^a \perp\!\!\!\perp A\) Is Not \(Y \perp\!\!\!\perp A\)

Proposition 5 (Under exchangeability, association signals an average effect) Under the conditions of Proposition 2 (dichotomous \(A\) and \(Y\), \(0 < \Pr[A = 1] < 1\), consistency, and exchangeability), treatment and outcome are independent, \(Y \perp\!\!\!\perp A\), if and only if there is no average causal effect, that is, if and only if \(\Pr[Y^{a=1} = 1] = \Pr[Y^{a=0} = 1]\).

Proof. By Equation 2, \(\Pr[Y = 1 \mid A = 1] - \Pr[Y = 1 \mid A = 0] = \Pr[Y^{a=1} = 1] - \Pr[Y^{a=0} = 1]\). \(Y \perp\!\!\!\perp A\) means that the left side is 0, and no average causal effect means that the right side is 0.

WarningExchangeability Is Not Independence of Treatment and Outcome
  • \(Y^a \perp\!\!\!\perp A\) (exchangeability) says that, given any one treatment level for everybody, both groups would share the same risk.
  • \(Y \perp\!\!\!\perp A\) says that observed treatment and observed outcome are not associated.

In a marginally randomized experiment with consistency, exchangeability is expected to hold. If treatment also has an average causal effect, \(Y \perp\!\!\!\perp A\) fails (Proposition&nbsp;5) (Hernán and Robins 2020, 15).

The book’s margin note puts this in terms of individual effects, but an effect in some individuals is not enough to create an association. By Proposition 5, with consistency, if exchangeability held in a population whose individual effects cancel out on average, as in Table 1.1, then \(Y \perp\!\!\!\perp A\) would hold despite those individual effects.

1.6 Does Exchangeability Hold in Table 2.1?

Until Chapter 10, let each of the 20 individuals stand for 1 billion identical ones, so that proportions in the tables are population probabilities and sampling variability plays no role.

Example 8 (Exchangeability fails in the heart transplant study (Tables 1.1 and 2.1)) Check \(Y^a \perp\!\!\!\perp A\) for \(a = 0\), pretending we can see the counterfactual outcomes of Table 1.1. Among the 13 treated, \(Y^{a=0} = 1\) for 7: Poseidon, Ares, Athena, Persephone, Hermes, Hebe, and Dionysus; among the 7 untreated, for 3: Kronos, Artemis, and Apollo: \[ \Pr[Y^{a=0} = 1 \mid A = 1] = \frac{7}{13} \approx 0.54 \;>\; \frac{3}{7} \approx 0.43 = \Pr[Y^{a=0} = 1 \mid A = 0]. \] The treated are at higher baseline risk than the untreated, so exchangeability (Definition&nbsp;3) does not hold. It fails for \(a = 1\) too: \(\Pr[Y^{a=1} = 1 \mid A = 1] = 7/13\), whereas \(\Pr[Y^{a=1} = 1 \mid A = 0] = 3/7\) (Rheia, Artemis, and Leto) (Hernán and Robins 2020, 16).

WarningExchangeability Usually Cannot Be Checked

In practice we have only the observed data of Table 2.1, not the counterfactual outcomes of Table 1.1, so we usually cannot tell whether exchangeability holds. Even if we knew that it failed, that would not prove the study was not randomized:

  1. Twenty people are too few; sampling variability could explain almost anything (Chapter 10), which is why we let each individual stand for 1 billion identical ones.
  2. A study can be randomized and still lack exchangeability in an infinite population, if the investigators used more than one coin (Section 2.2) (Hernán and Robins 2020, 16).
NotePopulation Effects Only

This chapter targets population (average) causal effects, because effects in single individuals generally cannot be computed from the observed data (they are not identified, in the sense made precise in Section 2.3). Crossover experiments, next, are a possible exception under strong conditions (Hernán and Robins 2020, 16).

1.7 Crossover Experiments

Definition 6 (Crossover experiment (Fine Point 2.1)) A crossover experiment follows each individual \(i\) over two or more time points \(t = 0, 1, \ldots\), with a treatment \(A_{it}\) assigned anew at each, so that one person’s outcome can be seen under more than one treatment value. For two periods, write \(Y_{i0}^{a_0}\) for \(i\)’s counterfactual outcome at \(t = 0\) under treatment \(a_0\) at \(t = 0\), and \(Y_{i1}^{a_0, a_1}\) for the counterfactual outcome at \(t = 1\) under \(a_0\) at \(t = 0\) and \(a_1\) at \(t = 1\) (Hernán and Robins 2020, 16).

Example 9 (Zeus’s lightning bolt) Zeus lets us decide when he throws his thunderbolt. On day 1 he throws it at our request (\(a = 1\)), and his blood pressure goes up; on day 2 we ask him to hold off (\(a = 0\)), and his blood pressure stays flat. This is a crossover experiment (Definition 6) with one individual and two periods. It is tempting to say that we have seen both of Zeus’s counterfactual outcomes, \(Y^{a=1} = 1\) and \(Y^{a=0} = 0\), and therefore an individual causal effect. That conclusion holds only under the strong conditions stated next.


Proposition 6 (When a crossover experiment reveals an individual effect (Fine Point 2.1)) Consider a two-period crossover experiment (Definition 6) with dichotomous treatments \(A_{it} \in \mathopen{}\left\{0, 1\right\}\mathclose{}\), deterministic counterfactual outcomes, and consistency. Write \(Y_{it}^{a_t}\) for individual \(i\)’s outcome at \(t\) under treatment \(a_t\) at \(t\), and suppose that

    1. there is no carryover effect of treatment: \(Y_{i1}^{a_0, a_1} = Y_{i1}^{a_1}\) for all \(a_0, a_1\);
    1. the individual causal effect does not change over time: \(Y_{it}^{a_t = 1} - Y_{it}^{a_t = 0} = \alpha_i\) for \(t = 0, 1\);
    1. the outcome under no treatment does not change over time: \(Y_{it}^{a_t = 0} = \beta_i\) for \(t = 0, 1\).

If \(A_{i0} = 0\) and \(A_{i1} = 1\), then \(Y_{i1} - Y_{i0} = \alpha_i\); if \(A_{i0} = 1\) and \(A_{i1} = 0\), then \(Y_{i0} - Y_{i1} = \alpha_i\). So the observed change equals the individual causal effect \(\alpha_i\) (Hernán and Robins 2020, 16).

Proof. Suppose \(A_{i0} = 0\) and \(A_{i1} = 1\). By consistency, \(Y_{i0} = Y_{i0}^{a_0 = 0}\) and \(Y_{i1} = Y_{i1}^{a_0 = 0, a_1 = 1}\), which equals \(Y_{i1}^{a_1 = 1}\) by (i). Adding and subtracting \(Y_{i1}^{a_1 = 0}\), and then using (ii) and (iii), \[ \begin{aligned} Y_{i1} - Y_{i0} &= \mathopen{}\left(Y_{i1}^{a_1 = 1} - Y_{i1}^{a_1 = 0}\right)\mathclose{} + \mathopen{}\left(Y_{i1}^{a_1 = 0} - Y_{i0}^{a_0 = 0}\right)\mathclose{} \\ &= \alpha_i + (\beta_i - \beta_i) \\ &= \alpha_i . \end{aligned} \] If instead \(A_{i0} = 1\) and \(A_{i1} = 0\), the same steps with the periods swapped give \(Y_{i0} - Y_{i1} = \mathopen{}\left(Y_{i0}^{a_0 = 1} - Y_{i0}^{a_0 = 0}\right)\mathclose{} + \mathopen{}\left(Y_{i0}^{a_0 = 0} - Y_{i1}^{a_1 = 0}\right)\mathclose{} = \alpha_i + (\beta_i - \beta_i) = \alpha_i\).

WarningCrossover Designs Need Effects That Wear Off

Condition (i) of Proposition&nbsp;6 requires an outcome that appears abruptly and resolves completely before the next period. So a crossover design cannot study the effect of an irreversible action, such as a heart transplant, on an irreversible outcome, such as death (Hernán and Robins 2020, 16).

2 2.2 Conditional Randomization (pp.&nbsp;17-19)


Table 2.2 adds a prognostic factor \(L\) (1 if in critical condition, 0 otherwise), measured before treatment was assigned.

Table 2.2: Heart transplant study with prognostic factor \(L\) (Hernán and Robins 2020, 17)

Name \(L\) \(A\) \(Y\)
Rheia 0 0 0
Kronos 0 0 1
Demeter 0 0 0
Hades 0 0 0
Hestia 0 1 0
Poseidon 0 1 0
Hera 0 1 0
Zeus 0 1 1
Artemis 1 0 1
Apollo 1 0 1
Leto 1 0 0
Ares 1 1 1
Athena 1 1 1
Hephaestus 1 1 1
Aphrodite 1 1 1
Polyphemus 1 1 1
Persephone 1 1 1
Hermes 1 1 0
Hebe 1 1 0
Dionysus 1 1 0

Definition 7 (Marginally and conditionally randomized experiments) Consider a randomized experiment (Definition 1) with a dichotomous treatment \(A\) and a variable \(L\) measured before treatment is assigned. The experiment is marginally randomized if it uses a single randomization probability \(\Pr[A = 1]\), the same for everyone. It is conditionally randomized if the randomization probability \(\Pr[A = 1 \mid L = l]\) depends on the value \(l\) of \(L\), for example with a different coin for each level of \(L\) (Hernán and Robins 2020, 17).

Example 10 (Two designs for Table 2.2) Two mutually exclusive designs could each explain the treatment counts in Table 2.2:

  • Design 1 (marginally randomized): one loaded coin, with probability 0.65 of treatment, for all 20 individuals; it would explain why 13 of the 20 were treated.
  • Design 2 (conditionally randomized): a coin with probability 0.75 of treatment for those in critical condition (\(L = 1\)) and one with probability 0.5 for those in noncritical condition (\(L = 0\)); it would explain why 9 of the 12 with \(L = 1\) and 4 of the 8 with \(L = 0\) were treated (Hernán and Robins 2020, 17).

2.1 Which Design Produced Table 2.2?

As in Section 2.1, a marginally randomized experiment is expected to give exchangeability, \(Y^a \perp\!\!\!\perp A\). A conditionally randomized one generally does not: if the coin favors treatment in the sicker stratum, the treated start out sicker on average than the untreated.

Example 11 (Table 2.2 came from design 2) With each individual standing for 1 billion identical ones, 9 of the 13 treated (\(\approx 69\%\)) but only 3 of the 7 untreated (\(\approx 43\%\)) in Table 2.2 were in critical condition. Since critical condition signals a bad prognosis, the treated would have had a higher risk than the untreated had they remained untreated: \(A\) predicts \(Y^{a=0}\), and exchangeability (Definition&nbsp;3) fails. The study was randomized, so it must have been randomized conditional on \(L\): design 2 of Example 10.

2.2 Conditional Exchangeability

A conditionally randomized experiment is one marginally randomized experiment per level of \(L\): here two, one among those with \(L = 1\) and one among those with \(L = 0\). Within each stratum, the treated and the untreated should therefore be exchangeable.

Definition 8 (Conditional exchangeability) Let \(A\) be a treatment with finitely many values, \(Y\) an outcome with counterfactual outcomes \(Y^a\), and \(L\) a variable measured before treatment. The treated and the untreated are exchangeable within level \(l\) of \(L\), written \(Y^a \perp\!\!\!\perp A \mid L = l\), if \(Y^a\) and \(A\) are independent given \(L = l\). For a dichotomous treatment and outcome, and when both treatment values occur in level \(l\), this means \[ \Pr[Y^a = 1 \mid A = 1, L = l] = \Pr[Y^a = 1 \mid A = 0, L = l]. \tag{4}\] Conditional exchangeability, \(Y^a \perp\!\!\!\perp A \mid L\), holds if this is true for every treatment value \(a\) and every level \(l\) of \(L\) (Hernán and Robins 2020, 18).

Example 12 (Conditional exchangeability in design 2) In design 2 of Example 10, everyone in critical condition (\(L = 1\)) gets the same coin, with probability 0.75 of treatment, so within \(L = 1\) the experiment is marginally randomized, and, as in Section 2.1, it is expected to give \(Y^a \perp\!\!\!\perp A \mid L = 1\). Likewise the coin with probability 0.5 gives \(Y^a \perp\!\!\!\perp A \mid L = 0\). So conditional exchangeability (Definition 8) holds (the next proposition makes this precise), even though Example 11 indicated that exchangeability fails in the population as a whole.

Definition 9 (Positivity) Let \(A\) be a treatment with finitely many values and \(L\) a variable measured before treatment. Positivity holds if every treatment value has a nonzero probability in every level of \(L\) that occurs: \[ \Pr[A = a \mid L = l] > 0 \quad \text{for every } a \text{ and every } l \text{ with } \Pr[L = l] > 0 \tag{5}\] (Hernán and Robins 2020, 25).

Example 13 (Positivity in design 2) In design 2 of Example 10, \(\Pr[A = 1 \mid L = 1] = 0.75\), \(\Pr[A = 0 \mid L = 1] = 0.25\), and \(\Pr[A = 1 \mid L = 0] = \Pr[A = 0 \mid L = 0] = 0.5\). All four are positive, so positivity (Definition 9) holds. Had the investigators transplanted everyone in critical condition, \(\Pr[A = 0 \mid L = 1]\) would be 0, and positivity would fail.


Proposition 7 (What each design guarantees) Let \(A\) be a dichotomous treatment, \(Y\) an outcome with counterfactual outcomes \(Y^{a=0}\) and \(Y^{a=1}\) (dichotomous wherever Definition 3 is invoked), and \(L\) a variable measured before treatment. Suppose treatment is assigned by a random device so that, in a near-infinite population, \(0 < \Pr[A = 1 \mid L = l] < 1\) for every level \(l\) of \(L\), and \[ \Pr[A = 1 \mid L, Y^{a=0}, Y^{a=1}] = \Pr[A = 1 \mid L]. \tag{6}\]

  1. Conditional exchangeability holds: \(Y^a \perp\!\!\!\perp A \mid L\) for \(a = 0, 1\) (Definition 8).
  2. If, in addition, \(\Pr[A = 1 \mid L]\) is the same for every level of \(L\) (marginal randomization), then exchangeability also holds: \(Y^a \perp\!\!\!\perp A\) for \(a = 0, 1\) (Definition 3) (Hernán and Robins 2020, 18).

Proof. For a dichotomous \(A\), Equation 6 says that \(A\) is independent of the pair \((Y^{a=0}, Y^{a=1})\) given \(L\), so it is independent of each member of the pair given \(L\): \(Y^a \perp\!\!\!\perp A \mid L\). If moreover \(\Pr[A = 1 \mid L, Y^{a=0}, Y^{a=1}]\) equals one constant \(p\), then \(A\) is independent of \((L, Y^{a=0}, Y^{a=1})\) jointly, and in particular of \(Y^a\).

  • Marginal randomization (design 1) produces both exchangeability and conditional exchangeability.
  • Conditional randomization (design 2) produces conditional exchangeability, but not, in general, exchangeability (Example ;11).

2.3 A Missing-Data View

Definition 10 (Missing completely at random and missing at random) Let \(A\) be a dichotomous treatment, \(Y\) an outcome with counterfactual outcomes \(Y^{a=0}\) and \(Y^{a=1}\), and \(L\) a variable measured before treatment. One counterfactual outcome is missing for everyone: \(Y^{a=0}\) if \(A = 1\), and \(Y^{a=1}\) if \(A = 0\). Take the full data to be \((L, Y^{a=0}, Y^{a=1})\), of which \((L, Y^a)\) is observed when \(A = a\). The counterfactual outcomes are

  • missing completely at random (MCAR) if \(\Pr[A = a \mid L, Y^{a=1}, Y^{a=0}] = \Pr[A = a]\) for \(a = 0, 1\);
  • missing at random (MAR) if, for \(a = 0, 1\), \(\Pr[A = a \mid L, Y^{a=1}, Y^{a=0}]\) depends only on \((L, Y^a)\), the data that would be observed if \(A = a\);
  • missing not at random (MNAR) if they are not MAR (Hernán and Robins 2020, 18).

Example 14 (The two designs as missing-data mechanisms) In design 1 of Example 10, \(\Pr[A = 1 \mid L, Y^{a=1}, Y^{a=0}] = 0.65\) whatever the full data, so the counterfactual outcomes are MCAR (Definition 10). In design 2, \(\Pr[A = 1 \mid L, Y^{a=1}, Y^{a=0}]\) is 0.75 if \(L = 1\) and 0.5 if \(L = 0\), so it depends on \(L\) alone, and the counterfactual outcomes are MAR but not MCAR.

Proposition 8 (MAR is conditional randomization) Let \(A\) and \(Y\) be dichotomous, and suppose that for every level \(l\) of \(L\), each of the four combinations of \((Y^{a=0}, Y^{a=1})\) has positive probability given \(L = l\). Then the counterfactual outcomes are MAR (Definition 10) if and only if Equation 6 holds, that is, \(\Pr[A = a \mid L, Y^{a=1}, Y^{a=0}] = \Pr[A = a \mid L]\) for \(a = 0, 1\). The book’s margin note states the implication from MAR without the condition on \((Y^{a=0}, Y^{a=1})\), which is added here (the next example shows why) (after Hernán and Robins 2020, 18).

Proof. If Equation 6 holds, \(\Pr[A = a \mid L, Y^{a=1}, Y^{a=0}]\) depends on \(L\) alone, so MAR holds. Conversely, let \(g(l, y_0, y_1) = \Pr[A = 1 \mid L = l, Y^{a=0} = y_0, Y^{a=1} = y_1]\). Under MAR with \(a = 1\), \(g\) does not depend on \(y_0\). Under MAR with \(a = 0\), \(1 - g\), and hence \(g\), does not depend on \(y_1\). With all four combinations of \((y_0, y_1)\) possible given \(L = l\), \(g(l, y_0, y_1) = g(l, y_0', y_1) = g(l, y_0', y_1')\) for all of them, so \(g\) depends on \(l\) alone and therefore equals \(\Pr[A = 1 \mid L = l]\).

Example 15 (MAR without conditional randomization) The condition on \((Y^{a=0}, Y^{a=1})\) in Proposition 8 cannot simply be dropped. Suppose the sharp causal null holds, so that \(Y^{a=0} = Y^{a=1}\) for everyone, and suppose the probability of treatment is 0.8 for those with \(Y^{a=0} = Y^{a=1} = 1\) and 0.2 for the others, whatever their \(L\), and that in some level \(l\) of \(L\) both \(Y^a = 0\) and \(Y^a = 1\) occur. This probability is a function of \(Y^{a=1}\) alone and also of \(Y^{a=0}\) alone, so the counterfactual outcomes are MAR (Definition 10), yet \(A\) depends on \(Y^a\) given \(L\), so conditional exchangeability fails. Here only two of the four combinations of \((Y^{a=0}, Y^{a=1})\) occur.

Rubin (1976) and Marini, Olsen, and Rubin (1980) coined the labels MCAR, MAR, and MNAR (Hernán and Robins 2020, 18).

2.4 Two Targets

Example 16 (If Table 2.2 had come from design 1) Had the data of Table 2.2 come from a marginally randomized experiment, exchangeability would hold, and, assuming consistency, by Proposition&nbsp;2 the causal risk ratio would be the associational one: \[ \frac{\Pr[Y = 1 \mid A = 1]}{\Pr[Y = 1 \mid A = 0]} = \frac{7/13}{3/7} = \frac{49}{39} \approx 1.26 . \] Table 2.2 came from design 2 (Example 11), so this calculation does not apply (Hernán and Robins 2020, 18).

Under conditional randomization there are two targets.

Definition 11 (Stratification) Let \(A\) be a dichotomous treatment, \(Y\) a dichotomous outcome, and \(L\) a variable measured before treatment. Stratification computes causal effects separately within each level (stratum) \(l\) of \(L\) with \(\Pr[L = l] > 0\), for example the stratum-specific causal risk ratio \[ \frac{\Pr[Y^{a=1} = 1 \mid L = l]}{\Pr[Y^{a=0} = 1 \mid L = l]}, \] defined when \(\Pr[Y^{a=0} = 1 \mid L = l] > 0\) (Hernán and Robins 2020, 18).

Proposition 9 (Within a stratum, association is causation) Let \(A\) and \(Y\) be dichotomous, \(L\) a variable measured before treatment, and \(l\) a level with \(\Pr[L = l] > 0\). Suppose that consistency holds, that \(Y^a \perp\!\!\!\perp A \mid L = l\) for \(a = 0, 1\) (Definition 8), and that both treatment values occur in level \(l\) (positivity within level \(l\), as in Definition 9). Then, for \(a = 0, 1\), \[ \Pr[Y^a = 1 \mid L = l] = \Pr[Y = 1 \mid L = l, A = a], \tag{7}\] so the stratum-specific causal risk ratio equals the stratum-specific associational risk ratio \(\Pr[Y = 1 \mid L = l, A = 1] / \Pr[Y = 1 \mid L = l, A = 0]\) whenever the denominators are positive (Hernán and Robins 2020, 18).

Proof. Restrict attention to the stratum \(L = l\), viewed as a population in its own right. In it, treatment is dichotomous with both values occurring, consistency holds, and the treated and the untreated are exchangeable. Proposition 2 applied to that stratum gives Equation 7.

Example 17 (Stratum-specific effects in Table 2.2)  

  • \(L = 0\): 1 of the 4 treated died (Zeus) and 1 of the 4 untreated died (Kronos), so \(\Pr[Y = 1 \mid L = 0, A = 1] = \Pr[Y = 1 \mid L = 0, A = 0] = 1/4\).
  • \(L = 1\): 6 of the 9 treated died and 2 of the 3 untreated died (Artemis and Apollo), so \(\Pr[Y = 1 \mid L = 1, A = 1] = 6/9 = 2/3\) and \(\Pr[Y = 1 \mid L = 1, A = 0] = 2/3\).

Design 2 gives conditional exchangeability (Example 12, Proposition 7) and positivity (Example 13). Assuming consistency as well, Proposition 9 turns these into stratum-specific causal risk ratios (Definition 11): \((1/4)/(1/4) = 1\) when \(L = 0\) and \((2/3)/(2/3) = 1\) when \(L = 1\).

The two targets are then:

  1. The stratum-specific causal effects, by stratification. If they differ across levels of \(L\), there is effect modification by \(L\) (treatment effect heterogeneity), the topic of Chapter 4.
  2. The average causal effect in the whole population, \(\Pr[Y^{a=1} = 1] / \Pr[Y^{a=0} = 1]\), for example when \(L\) will not be available for future patients, so treatment decisions cannot depend on it. Until Chapter 4, this is our target; Sections 2.3 and 2.4 show two ways to compute it.

2.5 Risk Periods

Definition 12 (Risk and risk period (Fine Point 2.2)) The risk period is the stretch of follow-up over which outcomes are counted, and a risk is the fraction of individuals in whom the outcome occurs within it. Read as a 5-day mortality risk, for instance, \(\Pr[Y = 1 \mid A = 1]\) is the share of treated individuals dead by day 5. Once a risk period has been named, the book usually leaves it implicit (Hernán and Robins 2020, 19).

Example 18 (One trial, two risk ratios) Two analysts study the same randomized trial of antibiotics in elderly plague patients. One reports a causal risk ratio for death of 0.05; the other reports 1. They do not contradict each other: the first used a 1-year risk period (Definition 12), and the second a 100-year one, over which everyone dies whatever the treatment. So a treatment that “affects mortality” postpones deaths rather than abolishing them (Hernán and Robins 2020, 19).

TipName the Risk Period

When you report a risk or a risk ratio, say over what period it was measured, as Example 18 shows the same data can give very different numbers.

3 2.3 Standardization (pp. 19-20)


In our conditionally randomized study, hearts were assigned with probability 50% to the 8 individuals with \(L = 0\) and 75% to the 12 with \(L = 1\).

3.1 Stratum-Specific Risks

From Example&nbsp;17:

\(A = 1\) \(A = 0\)
\(L = 0\) (8 individuals) \(\Pr[Y = 1 \mid L = 0, A = 1] = 1/4\) \(\Pr[Y = 1 \mid L = 0, A = 0] = 1/4\)
\(L = 1\) (12 individuals) \(\Pr[Y = 1 \mid L = 1, A = 1] = 6/9 = 2/3\) \(\Pr[Y = 1 \mid L = 1, A = 0] = 2/3\)

Under design 2 (conditional exchangeability by Proposition 7, and positivity by Example 13) and consistency, Proposition&nbsp;9 says that each observed stratum risk equals the corresponding counterfactual risk, e.g. \(\Pr[Y = 1 \mid L = 0, A = 1] = \Pr[Y^{a=1} = 1 \mid L = 0]\). The risk if all 20 had been treated should then be an average of \(1/4\) (in \(L = 0\)) and \(2/3\) (in \(L = 1\)), weighted by the size of each stratum.

3.2 Standardized Means

Definition 13 (Standardization) Let \(A\) be a treatment, \(Y\) an outcome with finite mean, and \(L\) a discrete variable, with \(\Pr[A = a \mid L = l] > 0\) for every \(l\) with \(\Pr[L = l] > 0\). The standardized mean of \(Y\) for treatment level \(a\), with the whole population as the standard, is \[ \sum_l \operatorname{E}\mathopen{}\left[Y \mid L = l, A = a\right]\mathclose{} \Pr[L = l], \tag{8}\] the average of the stratum-specific means among those with \(A = a\), weighted by the distribution of \(L\) in the population. For a dichotomous outcome it is the standardized risk \(\sum_l \Pr[Y = 1 \mid L = l, A = a] \Pr[L = l]\). Computing causal effects this way is called standardization (Hernán and Robins 2020, 20).

Example 19 (Standardized risks in Table 2.2) The stratum weights are \(\Pr[L = 0] = 8/20 = 0.4\) and \(\Pr[L = 1] = 12/20 = 0.6\). With the stratum risks of Example 17, the standardized risks (Definition 13) are \[ \begin{aligned} \textstyle\sum_l \Pr[Y = 1 \mid L = l, A = 1] \Pr[L = l] &= \tfrac{1}{4} \times 0.4 + \tfrac{2}{3} \times 0.6 = 0.1 + 0.4 = 0.5, \\ \textstyle\sum_l \Pr[Y = 1 \mid L = l, A = 0] \Pr[L = l] &= \tfrac{1}{4} \times 0.4 + \tfrac{2}{3} \times 0.6 = 0.1 + 0.4 = 0.5 , \end{aligned} \] and their ratio is \(0.5/0.5 = 1\) (Hernán and Robins 2020, 19).

3.3 Identification

Definition 14 (Identification) Fix a set of assumptions about how the data arose. Under those assumptions, a counterfactual quantity, such as \(\Pr[Y^a = 1]\), is identified (identifiable) if it can be written as a function of the distribution of the observed data, such as the joint distribution of \((L, A, Y)\); otherwise it is unidentified (Hernán and Robins 2020, 20).

Example 20 (Identification in the coin-flip experiment) In Example 3, assume consistency and exchangeability. By Proposition 2, \(\Pr[Y^{a=1} = 1] = \Pr[Y = 1 \mid A = 1]\), a function of the joint distribution of the observed \((A, Y)\). So under those assumptions \(\Pr[Y^{a=1} = 1]\) is identified (Definition 14), and its value is 0.3.


Proposition 10 (Standardization identifies the counterfactual mean) Let \(A\) and \(L\) be discrete, with \(L\) measured before treatment, and let \(Y\) be an outcome with finite counterfactual means \(\operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{}\). Suppose that

  • consistency holds (\(Y = Y^A\));
  • conditional exchangeability holds, \(Y^a \perp\!\!\!\perp A \mid L\) (Definition&nbsp;8);
  • positivity holds, \(\Pr[A = a \mid L = l] > 0\) for every \(l\) with \(\Pr[L = l] >; 0\) (Definition 9).

Then \(\operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{}\) is identified (Definition 14) and equals the standardized mean (Definition 13): \[ \operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{} = \sum_l \operatorname{E}\mathopen{}\left[Y \mid L = l, A = a\right]\mathclose{} \Pr[L = l]. \tag{9}\] For a dichotomous outcome, \(\Pr[Y^a = 1]\) is the standardized risk, so, when \(\Pr[Y^{a=0} = 1] > 0\), the causal risk ratio is the ratio of the standardized risks: \[ \frac{\Pr[Y^{a=1} = 1]}{\Pr[Y^{a=0} = 1]} = \frac{\sum_l \Pr[Y = 1 \mid L = l, A = 1] \Pr[L = l]}{\sum_l \Pr[Y = 1 \mid L = l, A = 0] \Pr[L = l]} \tag{10}\] (Hernán and Robins 2020, 19–20, 25).

Proof. The sums are over the values \(l\) with \(\Pr[L = l] > 0\). \[ \begin{aligned} \operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{} &= \sum_l \operatorname{E}\mathopen{}\left[Y^a \mid L = l\right]\mathclose{} \Pr[L = l] && \text{(law of total expectation)} \\ &= \sum_l \operatorname{E}\mathopen{}\left[Y^a \mid A = a, L = l\right]\mathclose{} \Pr[L = l] && \text{(conditional exchangeability, positivity)} \\ &= \sum_l \operatorname{E}\mathopen{}\left[Y \mid A = a, L = l\right]\mathclose{} \Pr[L = l] && \text{(consistency)}. \end{aligned} \] The right side involves only the observed \(L\), \(A\), and \(Y\). For a dichotomous outcome, each mean is a risk.

Example 21 (The counterfactual risks in Table 2.2) In the conditionally randomized experiment of Table 2.2, the conditions of Proposition 10 hold: conditional exchangeability by design (Example 12, Proposition 7), positivity by Example 13, and consistency by assumption. So the standardized risks of Example 19 are the counterfactual risks: \(\Pr[Y^{a=1} = 1] = \Pr[Y^{a=0} = 1] = 0.5\). The causal risk ratio is \(0.5/0.5 = 1\), not the 1.26 of Example 16.

4 2.4 Inverse Probability Weighting (pp. 20-25)


The same causal risk ratio can be computed a second way, by reweighting the individuals.

4.1 The Tree (Figure 2.1)

Display Table 2.2 as a tree, from left to right:

  • first branching on \(L\): 8 with \(L = 0\) (\(\Pr[L = 0] = 0.4\)), 12 with \(L = 1\) (\(\Pr[L = 1] = 0.6\));
  • then on \(A\): in \(L = 0\), 4 untreated and 4 treated (\(\Pr[A = 0 \mid L = 0] = \Pr[A = 1 \mid L = 0] = 0.5\)); in \(L = 1\), 3 untreated and 9 treated (\(\Pr[A = 0 \mid L = 1] = 0.25\), \(\Pr[A = 1 \mid L = 1] = 0.75\));
  • then on \(Y\): e.g. in \((L = 0, A = 0)\), 3 survived and 1 died, so \(\Pr[Y = 1 \mid L = 0, A = 0] = 1/4\).

In the terminology of Robins (1986, 1987), Figure 2.1 represents a conditionally randomized experiment as an FRCISTG: a fully randomized causally interpreted structured tree graph. The book asks whether this wins “the prize for the worst acronym ever” (Hernán and Robins 2020, 20).

4.2 Simulating Everybody Untreated and Everybody Treated

Example 22 (Everybody untreated (Figure 2.2))  

  • \(L = 0\): 1 of the 4 untreated died. Had all 8 been untreated (twice as many), 2 would have died.
  • \(L = 1\): 2 of the 3 untreated died. Had all 12 been untreated (\(12 = 3 \times 4\)), \(2 \times 4 = 8\) would have died.

So \(\Pr[Y^{a=0} = 1] = (2 + 8)/(8 + 12) = 10/20 = 0.5\). This relies on exchangeability within each stratum (Definition&nbsp;8): the treated, had they been untreated, would have had the same risk as the untreated in their stratum (Hernán and Robins 2020, 21–22).

Example 23 (Everybody treated (Figure 2.2))  

  • \(L = 0\): 1 of the 4 treated died; scaled up to all 8: 2 deaths.
  • \(L = 1\): 6 of the 9 treated died; scaled up to all 12 (a factor \(12/9 = 4/3\)): \(6 \times 4/3 = 8\) deaths.

So \(\Pr[Y^{a=1} = 1] = (2 + 8)/20 = 0.5\), and with Example&nbsp;22 the causal risk ratio is \(0.5/0.5 = 1\), as with standardization (Example 19) (Hernán and Robins 2020, 22).

4.3 IP Weights and the Pseudo-Population

Both simulations scaled each group up by the inverse of the probability that its members received the treatment they did.

Definition 15 (IP weights) Let \(A\) and \(L\) be discrete, and let \(f[a \mid l] = \Pr[A = a \mid L = l]\) be the conditional probability of treatment value \(a\) given \(L = l\), assumed positive for every value \(a\) of \(A\) and every \(l\) with \(\Pr[L = l] > 0\). The inverse probability (IP) weight of an individual is \[ W^A = \frac{1}{f[A \mid L]}, \tag{11}\] the inverse of the probability of receiving the treatment value the individual actually received, given the individual’s own \(L\). For a dichotomous \(A\), a treated individual with \(L = l\) gets \(1/\Pr[A = 1 \mid L = l]\), and an untreated one with \(L = l'\) gets \(1/\Pr[A = 0 \mid L = l']\) (Hernán and Robins 2020, 22–23).

Example 24 (IP weights in Table 2.2) From the tree of Figure 2.1, the IP weights (Definition 15) and the size of each group after weighting are

  • \(L = 0\), \(A = 0\): weight \(1/0.5 = 2\), so the 4 individuals count as 8;
  • \(L = 0\), \(A = 1\): weight \(1/0.5 = 2\), so the 4 individuals count as 8;
  • \(L = 1\), \(A = 0\): weight \(1/0.25 = 4\), so the 3 individuals count as 12;
  • \(L = 1\), \(A = 1\): weight \(1/0.75 \approx 1.33\), so the 9 individuals count as 12.

Definition 16 (Pseudo-population) The pseudo-population created by the IP weights \(W^A\) (Definition 15) is the hypothetical population in which each individual of the original population is counted \(W^A\) times. Its expectations are IP weighted averages: for any function \(g\), \(\operatorname{E}_{ps}\mathopen{}\left[g(L, A, Y)\right]\mathclose{} = \operatorname{E}\mathopen{}\left[W^A g(L, A, Y)\right]\mathclose{} / \operatorname{E}\mathopen{}\left[W^A\right]\mathclose{}\). The book uses this rule for the particular functions in Technical Point 2.2; the general form is ours (adapted from Hernán and Robins 2020, 22–23).

Example 25 (The pseudo-population of Table 2.2 (Figure 2.3)) Weighting as in Example 24 gives a pseudo-population (Definition 16) of 40, twice the original 20: 8 treated and 8 untreated with \(L = 0\), and 12 treated and 12 untreated with \(L = 1\). It pools the two simulated trees of Example 22 and Example 23, so every stratum of the original population appears once in full as treated and once in full as untreated. Half of each stratum is treated, so \(L\) and \(A\) are independent in the pseudo-population (Hernán and Robins 2020, 22).


Definition 17 (IP weighted mean) Under the conditions of Definition 15, and for an outcome \(Y\) with finite mean, the IP weighted mean of \(Y\) for treatment level \(a\) is \[ \operatorname{E}\mathopen{}\left[\frac{\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{} Y}{f[A \mid L]}\right]\mathclose{}, \tag{12}\] where the indicator \(\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{}\) is 1 if \(A = a\) and 0 otherwise (Hernán and Robins 2020, 25).

Example 26 (IP weighted risks in Table 2.2) For a dichotomous outcome the IP weighted mean (Definition 17) is a risk. In Table 2.2, with the weights of Example 24, only the deaths among those with \(A = a\) contribute to the average over the 20 individuals:

  • \(a = 0\): 1 death with weight 2 and 2 deaths with weight 4, so the IP weighted risk is \((1 \times 2 + 2 \times 4)/20 = 0.5\);
  • \(a = 1\): 1 death with weight 2 and 6 deaths with weight \(4/3\), so the IP weighted risk is \((1 \times 2 + 6 \times 4/3)/20 = 0.5\).

These are the risks found in Example 22 and Example 23.

Proposition 11 (Properties of the pseudo-population) Let \(A\) take \(k\) values, assume the conditions of Definition 15, and let \(Y\) have finite mean. In the pseudo-population (Definition 16):

  1. \(L\) and \(A\) are independent, \(L\) has the same distribution as in the original population, and each treatment value has probability \(1/k\);
  2. the mean outcome among those with \(A = a\) is the IP weighted mean (Definition 17):

\[ \operatorname{E}_{ps}\mathopen{}\left[Y \mid A = a\right]\mathclose{} = \operatorname{E}\mathopen{}\left[\frac{\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{} Y}{f[A \mid L]}\right]\mathclose{} \tag{13}\] Part 2 is Technical Point 2.2; the book states only the independence in part 1, and the margins are added here (adapted from Hernán and Robins 2020, 22–23).

Proof. For 1, the weighted size of the group with \(A = a\) and \(L = l\) is \(\operatorname{E}\mathopen{}\left[W^A \mathbb{1}\mathopen{}\left(A = a, L = l\right)\mathclose{}\right]\mathclose{} = \Pr[A = a, L = l] / \Pr[A = a \mid L = l] = \Pr[L = l]\). Summing over the \(k\) values of \(a\) and the values of \(l\) gives a total size \(\operatorname{E}\mathopen{}\left[W^A\right]\mathclose{} = k\). So \(\Pr_{ps}[A = a, L = l] = \Pr[L = l] \times (1/k)\), a product of a function of \(l\) and a function of \(a\), which gives independence with the stated margins.

For 2, \[ \begin{aligned} \operatorname{E}_{ps}\mathopen{}\left[Y \mid A = a\right]\mathclose{} &= \frac{\operatorname{E}_{ps}\mathopen{}\left[Y \mathbb{1}\mathopen{}\left(A = a\right)\mathclose{}\right]\mathclose{}}{\operatorname{E}_{ps}\mathopen{}\left[\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{}\right]\mathclose{}} && \text{(laws of probability)} \\ &= \frac{\operatorname{E}\mathopen{}\left[W^A Y \mathbb{1}\mathopen{}\left(A = a\right)\mathclose{}\right]\mathclose{}}{\operatorname{E}\mathopen{}\left[W^A \mathbb{1}\mathopen{}\left(A = a\right)\mathclose{}\right]\mathclose{}} && \text{(definition of } \operatorname{E}_{ps}\mathopen{}\left[\cdot\right]\mathclose{}\text{)} \\ &= \frac{\operatorname{E}\mathopen{}\left[Y \mathbb{1}\mathopen{}\left(A = a\right)\mathclose{} / f[a \mid L]\right]\mathclose{}}{\operatorname{E}\mathopen{}\left[\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{} / f[a \mid L]\right]\mathclose{}} && \text{(} f[A \mid L] = f[a \mid L] \text{ when } A = a\text{)} \\ &= \operatorname{E}\mathopen{}\left[\frac{Y \mathbb{1}\mathopen{}\left(A = a\right)\mathclose{}}{f[a \mid L]}\right]\mathclose{} && \text{(denominator is 1)}, \end{aligned} \] because \(\operatorname{E}\mathopen{}\left[\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{} / f[a \mid L] \mid L\right]\mathclose{} = f[a \mid L] / f[a \mid L] = 1\). The last expression equals Equation 12, again because \(f[A \mid L] = f[a \mid L]\) whenever \(\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{} \neq 0\).

Remark 2 (Why IP weights use random arguments (Technical Point 2.2)). Each person’s weight plugs that person’s own treatment and covariate values into \(f[a \mid l]\). Substituting the random variables themselves for \(a\) and \(l\) gives \(f[A \mid L]\), a single formula that covers everyone. The tempting alternative \(\Pr[A = A \mid L = L]\) is useless, since it equals 1 for everyone. For a continuous \(A\), \(f\) would be a conditional probability density function (Hernán and Robins 2020, 23).

TipRead an IP Weight as a Head Count

An individual with weight \(W^A = 4\) counts as 4 members of the pseudo-population: the individual, plus 3 stand-ins for members of the same stratum of \(L\) who actually received the other treatment. Conditional exchangeability is what lets the stand-ins borrow this individual’s risk under the treatment the individual received.

IP weighted estimators date back to Horvitz and Thompson (1952), who designed them for surveys that sample units with unequal probabilities (Technical Point 12.1) (Hernán and Robins 2020, 22).

4.4 Standardization and IP Weighting Are Equivalent

Proposition 12 (IP weighting equals standardization (Technical Point 2.3)) Let \(A\) be discrete with finitely many values and \(L\) discrete, let \(Y\) have finite mean, and assume positivity (Definition 9): \(f[a \mid l] > 0\) for every \(l\) with \(\Pr[L = l] > 0\), which holds in a conditionally randomized experiment whose randomization probabilities are all strictly between 0 and 1. Then the IP weighted mean (Definition 17) equals the standardized mean (Definition 13): \[ \operatorname{E}\mathopen{}\left[\frac{\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{} Y}{f[A \mid L]}\right]\mathclose{} = \sum_l \operatorname{E}\mathopen{}\left[Y \mid A = a, L = l\right]\mathclose{} \Pr[L = l]. \tag{14}\] No counterfactuals are involved (Hernán and Robins 2020, 25).

Proof. Only individuals with \(A = a\) contribute to the left side, and for them \(f[A \mid L] = f[a \mid L]\). Conditioning on \(L\), \[ \begin{aligned} \operatorname{E}\mathopen{}\left[\frac{\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{} Y}{f[A \mid L]}\right]\mathclose{} &= \sum_l \frac{1}{f[a \mid l]} \operatorname{E}\mathopen{}\left[Y \mid A = a, L = l\right]\mathclose{} f[a \mid l] \Pr[L = l] \\ &= \sum_l \operatorname{E}\mathopen{}\left[Y \mid A = a, L = l\right]\mathclose{} \Pr[L = l], \end{aligned} \] after \(f[a \mid l]\) cancels. For a continuous \(L\), replace the sum by an integral.

Proposition 13 (IP weighting identifies the counterfactual mean (Technical Point 2.3)) Under the conditions of Proposition 12, suppose also that \(\operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{}\) is finite, and that consistency (\(Y = Y^A\)) and conditional exchangeability (\(Y^a \perp\!\!\!\perp A \mid L\), Definition 8) hold. Then the IP weighted mean equals the counterfactual mean: \[ \operatorname{E}\mathopen{}\left[\frac{\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{} Y}{f[A \mid L]}\right]\mathclose{} = \operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{}. \tag{15}\] So, by Proposition 11, for a dichotomous treatment and outcome with \(\Pr[Y^{a=0} = 1] > 0\), comparing the risks of treated and untreated members of the pseudo-population gives the causal risk ratio of the original population (Hernán and Robins 2020, 22, 25).

Proof. This follows from Proposition 12 and Proposition 10. A direct proof: \[ \begin{aligned} \operatorname{E}\mathopen{}\left[\frac{\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{}}{f[A \mid L]} Y\right]\mathclose{} &= \operatorname{E}\mathopen{}\left[\frac{\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{}}{f[a \mid L]} Y^a\right]\mathclose{} && \text{(consistency)} \\ &= \operatorname{E}\mathopen{}\left[\operatorname{E}\mathopen{}\left[\frac{\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{}}{f[a \mid L]} Y^a \;\middle|\; L\right]\mathclose{}\right]\mathclose{} && \text{(law of total expectation)} \\ &= \operatorname{E}\mathopen{}\left[\operatorname{E}\mathopen{}\left[\frac{\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{}}{f[a \mid L]} \;\middle|\; L\right]\mathclose{} \operatorname{E}\mathopen{}\left[Y^a \mid L\right]\mathclose{}\right]\mathclose{} && \text{(conditional exchangeability)} \\ &= \operatorname{E}\mathopen{}\left[\operatorname{E}\mathopen{}\left[Y^a \mid L\right]\mathclose{}\right]\mathclose{} && \text{(the inner mean is 1)} \\ &= \operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{} . \end{aligned} \] Positivity makes \(f[a \mid L]\) nonzero, so every ratio is defined.

Example 27 (Two methods, one answer in Table 2.2) Standardization (Example 19) and IP weighting (Example 26) both give \(\Pr[Y^{a=1} = 1] = \Pr[Y^{a=0} = 1] = 0.5\) in Table 2.2, and so a causal risk ratio of 1. By Proposition 12 this is no coincidence (Hernán and Robins 2020, 23).

Remark 3 (Two recipes for the same counterfactual tree). Both methods build a counterfactual tree in which everyone receives \(a\), from different pieces:

  • IP weighting uses the treatment probabilities \(\Pr[A = a \mid L = l]\);
  • standardization uses \(\Pr[L = l]\) and the outcome risks \(\Pr[Y = 1 \mid A = a, L = l]\) (Hernán and Robins 2020, 23).
WarningAnalytic Control Is Not Physical Control

Both methods mimic a world in which \(L\) played no part in how treatment was assigned, so we say that they adjust for \(L\). Saying that they “control for” \(L\) is a slight abuse of language: adjusting for \(L\) in the analysis is very different from the control that a randomized experiment exerts by design (Hernán and Robins 2020, 23).

WarningContinuous Treatments Break the Equivalence

With a continuous treatment, the IP weighted mean no longer equals the standardized mean, and it is biased for \(\operatorname{E}\mathopen{}\left[Y^a\right]\mathclose{}\) even under exchangeability. If \(f\) is a density, \(\operatorname{E}\mathopen{}\left[\mathbb{1}\mathopen{}\left(A = a\right)\mathclose{} / f(a \mid l) \mid L = l\right]\mathclose{}\) is 0, not 1; if \(f\) is a probability, \(f(a \mid L = l) = 0\) with probability 1, so positivity fails. Section 12.4 generalizes IP weighting to continuous treatments, and Technical Point 3.1 shows that the results above fail without positivity even for a discrete \(A\) (Hernán and Robins 2020, 25).

4.5 Why Not Finish the Book Here?

Remark 4 (Why not always run a randomized experiment?). An ideal randomized experiment plus standardization or IP weighting gives average causal effects. But such experiments are frequently unethical, infeasible, or too slow. For the heart transplant study:

  • ethics: donor hearts are in short supply, and allocating them by coin flip rather than by expected benefit would be hard to defend;
  • feasibility: nobody can be blinded to a transplant, patients randomized to medical therapy may seek one anyway, and a matching heart may not turn up for those randomized to receive one;
  • timeliness: results would arrive only after years, while patients need decisions now.

Often the least bad choice left is an observational study (Chapter 3) (Hernán and Robins 2020, 23–24).

5 Summary


  1. Randomization makes missing counterfactuals missing by chance and is expected to produce exchangeability, \(Y^a \perp\!\!\!\perp A\) (Definition&nbsp;3); in an ideal randomized experiment, association is causation (Proposition 2).
  2. \(Y^a \perp\!\!\!\perp A\) (exchangeability) is different from \(Y \perp\!\!\!\perp A\) (no association), as Proposition 5 shows.
  3. Conditional randomization (randomization probabilities depending on \(L\)) in general produces only conditional exchangeability, \(Y^a \perp\!\!\!\perp A \mid L\) (Definition 8, Proposition 7).
  4. Under consistency, conditional exchangeability, and positivity, the population causal effect is identified by standardization, \(\sum_l \operatorname{E}\mathopen{}\left[Y \mid L = l, A = a\right]\mathclose{} \Pr[L = l]\) (Proposition ;10), or equivalently by IP weighting with \(W^A = 1/f[A \mid L]\) (Proposition 13), which creates a pseudo-population in which \(L\) and \(A\) are independent (Proposition 11).
  5. In Table 2.2 both methods give a causal risk ratio of 1 (Example ;27), whereas the crude associational risk ratio is 1.26.

6 References


Hernán, Miguel A, and James M Robins. 2020. Causal Inference: What If. Chapman & Hall/CRC. https://miguelhernan.org/whatifbook.
Back to top