Why Mediation Needs Nested Counterfactuals
A treatment may affect an outcome through a mediator: for example, a program may change a health behavior, which may in turn change a later health measure. To describe this pathway precisely, it is not enough to compare people with different observed mediator values. We need notation for the mediator value a unit would have under each treatment, and for the outcome that would follow if treatment and mediator values were set to specified levels.
This tutorial develops that notation for binary treatment and mediator variables. The central construction combines an outcome counterfactual under one treatment level with the mediator counterfactual under another. It lets us state a mediator-shift contrast clearly, while keeping separate the individual counterfactual contrast and its population average.
The two treatment inputs in \(Y_i(a,M_i(a'))\) have different roles. The first, \(a\), specifies the treatment used in the outcome counterfactual. The second, \(a'\), specifies which treatment-specific mediator value is inserted into that outcome. When \(a\ne a'\), the notation combines counterfactual quantities associated with different treatment settings for the same unit. That combination is a defined causal target; it is not generally an observed outcome.
Reading the Notation Carefully
Suppose treatment and mediator are coded as 0 and 1. Then \(M_i(0)\) and \(M_i(1)\) are each either 0 or 1, and \(Y_i(a,0)\) and \(Y_i(a,1)\) are the outcomes under the two possible mediator settings while treatment is held at \(a\). For example, \(Y_i(1,M_i(0))\) means: use treatment level 1 in the outcome, but set the mediator to the value unit \(i\) would have had under treatment level 0.
The potential outcomes are defined before any estimation method is chosen. If a unit actually receives \(A_i=a\), consistency links its observed variables to the corresponding counterfactuals: \(M_i=M_i(a)\) and \(Y_i=Y_i(a,M_i(a))\). This does not make all the counterfactuals observable. For a given unit, only the mediator and outcome under the treatment actually received are observed, and the mediator itself is not generally assigned independently of treatment.
The notation presumes that the treatment levels and mediator settings correspond to sufficiently well-defined interventions. It does not, by itself, establish that a contrast can be identified from observed data. Identification requires additional assumptions and methods; a counterfactual expression first tells us what quantity is being discussed.
Worked Example: Constructing One Unit’s Nested Outcomes
Consider one hypothetical unit with \(M_i(0)=0\) and \(M_i(1)=1\). Suppose the unit’s binary outcome counterfactuals are \(Y_i(1,0)=0\) and \(Y_i(1,1)=1\). These values are stipulated for illustration; they are not presented as observed data from a real study.
Under treatment 1 and the mediator value the unit would have under treatment 0, the nested outcome is \(Y_i(1,M_i(0))=Y_i(1,0)=0\), because \(M_i(0)=0\).
Under treatment 1 and the mediator value the unit would have under treatment 1, it is \(Y_i(1,M_i(1))=Y_i(1,1)=1\), because \(M_i(1)=1\).
The individual mediator-shift contrast at treatment level 1 is therefore \(Y_i(1,M_i(1))-Y_i(1,M_i(0))=1-0=1\). This is a difference in the unit’s binary outcome values, in outcome units. It is not a difference in probabilities: this single unit’s contrast is 1, not one percentage point.
Mediator-Shift Contrasts
A useful contrast holds the treatment input of the outcome counterfactual fixed and changes which treatment-specific mediator value is inserted. For a specified treatment level \(a\), the individual contrast is \(Y_i(a,M_i(1))-Y_i(a,M_i(0))\). It compares the two nested outcomes for the same unit, not the observed outcomes of two groups.
There are two versions because the outcome treatment level can be held at 0 or at 1. These contrasts need not be equal: the outcome response to the mediator can depend on treatment. Each contrast also depends on how the treatment changes the mediator for the unit. In particular, if \(M_i(1)=M_i(0)\), both nested outcomes use the same mediator value, so the contrast is zero.
For binary mediators, the nested contrast has a simple algebraic form. Because \(M_i(a')\) is either 0 or 1, selecting between \(Y_i(a,0)\) and \(Y_i(a,1)\) can be written as a weighted sum:
If \(M_i(a')=0\), the first weight is 1 and the expression equals \(Y_i(a,0)\). If \(M_i(a')=1\), the second weight is 1 and it equals \(Y_i(a,1)\). Subtract the expression for \(a'=0\) from that for \(a'=1\):
Thus the individual contrast is the product of the unit’s treatment-related change in mediator value and the unit’s outcome contrast between mediator levels, holding treatment fixed. If treatment does not change the mediator, the first factor is zero. If the outcome counterfactual is unchanged between mediator levels at treatment \(a\), the second factor is zero. The identity follows from the binary coding; it is not an estimation formula.
Worked Example: Averaging Individual Contrasts
The following four hypothetical units define a complete set of counterfactual values for this illustration. The outcome is binary. In the table, \(Y_{am}\) denotes \(Y_i(a,m)\); no row is claimed to be a real person’s observed and counterfactual data.
| Unit | \(M_i(0)\) | \(M_i(1)\) | \(Y_{10}\) | \(Y_{11}\) | \(Y_{00}\) | \(Y_{01}\) |
|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 0 | 1 | 0 | 0 |
| 2 | 1 | 1 | 0 | 1 | 0 | 1 |
| 3 | 1 | 0 | 1 | 0 | 0 | 1 |
| 4 | 0 | 0 | 0 | 0 | 1 | 1 |
First calculate the individual contrasts holding treatment at 1. For unit 1, the nested outcomes are \(Y_1(1,M_1(1))=Y_{11}=1\) and \(Y_1(1,M_1(0))=Y_{10}=0\), giving \(1-0=1\). Unit 2 has mediator value 1 under both treatment levels, so the contrast is \(Y_{11}-Y_{11}=0\). Unit 3 has \(M_3(1)=0\) and \(M_3(0)=1\), giving \(Y_{10}-Y_{11}=1-0=1\). Unit 4 has the same mediator value under both treatments, so its contrast is 0.
The four individual contrasts are therefore \(1,0,1,0\). Their equally weighted population mean is \((1+0+1+0)/4=0.5\) outcome units. Because the outcome is binary, the mean of each nested outcome is a probability. Directly, the mean of \(Y_i(1,M_i(1))\) is \((1+1+1+0)/4=0.75\), and the mean of \(Y_i(1,M_i(0))\) is \((0+1+0+0)/4=0.25\). Their difference is \(0.75-0.25=0.50\), or 50 percentage points.
For treatment fixed at 0, the individual contrasts are \(0,0,-1,0\): unit 3 contributes \(Y_{00}-Y_{01}=0-1=-1\). Their mean is \(-1/4=-0.25\). Equivalently, the means of \(Y_i(0,M_i(1))\) and \(Y_i(0,M_i(0))\) are \(0.50\) and \(0.75\), respectively, giving \(0.50-0.75=-0.25\), or -25 percentage points. The example shows why the treatment level held fixed must be stated: these two population contrasts differ.
Individual and Population Quantities
For a population of units, take the expectation of the individual nested contrast. For a binary outcome, the expectation of a potential outcome is its probability of equaling 1. Consequently, the population contrast at fixed treatment \(a\) can be written as a difference of probabilities:
The individual contrast and the population contrast should not be described interchangeably. For a binary outcome, an individual difference is in binary outcome units and can be \(-1\), \(0\), or \(1\). The population mean contrast is a difference in probabilities, often reported in percentage points. For a numerical outcome measured in a physical unit, the individual contrast is in that outcome’s units, and the population mean contrast is in the same units.
The population expectation averages over the target population’s distribution of potential mediator and outcome values. It is not automatically the difference between observed treatment groups, nor is it automatically an estimate of the displayed counterfactual quantity. Those conclusions require separate identification and estimation arguments.
Worked Example: Treatment Can Change the Mediator Effect
Suppose a hypothetical unit has a continuous outcome measured in hours, with \(M_i(0)=0\) and \(M_i(1)=1\). Let its outcome counterfactuals be \(Y_i(0,0)=10\), \(Y_i(0,1)=12\), \(Y_i(1,0)=10\), and \(Y_i(1,1)=16\) hours.
With the outcome treatment held at 0, the mediator-shift contrast is \(Y_i(0,M_i(1))-Y_i(0,M_i(0))=Y_i(0,1)-Y_i(0,0)=12-10=2\) hours.
With the outcome treatment held at 1, it is \(Y_i(1,M_i(1))-Y_i(1,M_i(0))=Y_i(1,1)-Y_i(1,0)=16-10=6\) hours.
The two contrasts differ by 4 hours because the specified outcome counterfactuals have a larger difference between mediator values under treatment 1. The numbers illustrate that a mediated contrast is indexed by the treatment level held fixed in the outcome; it does not have one universal value for this unit.
Common Mistakes and Interpretation
- Swapping the inputs. In \(Y_i(a,M_i(a'))\), \(a\) is the treatment in the outcome counterfactual, while \(a'\) determines the mediator value. State both roles before interpreting a nested outcome.
- Calling an individual difference a probability difference. A binary individual outcome contrast is a difference in outcome values, which can be \(-1\), 0, or 1. A population mean contrast for a binary outcome is a difference in probabilities.
- Treating nested outcomes as observed data. A person’s observed mediator and outcome reveal only the values corresponding to the treatment actually received. Other potential outcomes remain counterfactual, even when the notation is clear.
- Assuming the contrast is the same at both treatment levels. The contrast at fixed \(a=0\) and the contrast at fixed \(a=1\) can differ, as the continuous-outcome example demonstrates.
- Reading a defined contrast as an identified effect. Defining a counterfactual target does not show that observed data suffice to recover it. Identification and estimation require additional conditions.
Check Your Understanding
Use the notation and distinctions developed above to answer the following.
- In \(Y_i(0,M_i(1))\), which treatment level is used in the outcome counterfactual, and which determines the mediator value?
- If \(M_i(0)=M_i(1)\), what is \(Y_i(a,M_i(1))-Y_i(a,M_i(0))\), for either treatment level \(a\)? Explain.
- For a binary outcome, what values can an individual nested-outcome difference take? How does the interpretation of its population mean differ?
- Using the four-unit table, verify the mean mediator-shift contrast at fixed treatment 0 by averaging the four individual contrasts.
- Does defining \(Y_i(a,M_i(a'))\) establish that it can be estimated from observed data? Explain why or why not.