In the earlier chapters of this book we examined methods for estimating the causal effect of a time-fixed treatment — one that is assigned once at the start of follow-up and then held constant throughout the study period. In practice, many interventions and exposures unfold over time: a patient may initiate, discontinue, and restart a medication; a worker may change jobs or occupational exposures from year to year; a diet may evolve across decades of life. Part III of the textbook extends the causal inference framework to these time-varying treatments.
Let time be indexed by \(k = 0, 1, \ldots, K\), where \(k = 0\) is the baseline and \(K\) is the end of the study period. The time-varying treatment at time \(k\) is denoted \(A_k\), which may be binary (e.g., \(A_k = 1\) if the individual is on treatment at time \(k\), 0 otherwise) or take more general values.
The observed treatment history up to time \(k\) is the vector
\[\bar{A}_k = (A_0, A_1, \ldots, A_k).\]
Similarly, define the covariate history up to time \(k\) as
\[\bar{L}_k = (L_0, L_1, \ldots, L_k),\]
where \(L_k\) represents all measured covariates recorded at time \(k\) (e.g., clinical measurements, lab values, questionnaire responses).
The outcome \(Y\) is measured at the end of follow-up, after \(A_K\). A common data structure in person-time format is therefore:
\[L_0 \to A_0 \to L_1 \to A_1 \to \cdots \to L_K \to A_K \to Y.\]
Definition 1 (Potential Outcome Under a Treatment History) For a fully specified treatment history \(\bar{a}_K = (a_0, a_1, \ldots, a_K)\), the potential outcome \(Y^{\bar{a}_K}\) is the outcome that would have been observed had the individual’s treatment been set to \(\bar{a}_K\) throughout the follow-up, regardless of what treatment they actually received.
When \(K = 0\) this reduces to the familiar time-fixed potential outcome \(Y^a\). With \(K\) time points, the number of distinct potential outcomes grows exponentially with \(K\), which motivates the use of treatment strategies rather than enumerating all histories.
The average causal effect of treatment history \(\bar{a}_K\) versus \(\bar{a}_K^*\) is
\[\text{E}{\left[Y^{\bar{a}_K}\right]} - \text{E}{\left[Y^{\bar{a}_K^*}\right]}.\]
When the treatment is binary at each time point, there are \(2^{K+1}\) possible histories, so comparing all pairs quickly becomes unwieldy. In most applications we focus on a small number of pre-specified treatment strategies, described in the next section.
A treatment strategy (also called a treatment regime or dynamic treatment regime) is a rule \(g\) that specifies, at each time \(k\), what treatment value \(a_k\) should be assigned, possibly as a function of the individual’s past treatment and covariate history.
Definition 2 (Treatment Strategy) A treatment strategy \(g = (g_0, g_1, \ldots, g_K)\) is a collection of decision functions where each \(g_k\) maps the observed history \((\bar{a}_{k-1}, \bar{l}_k)\) to a treatment value:
\[g_k : (\bar{a}_{k-1}, \bar{l}_k) \mapsto a_k.\]
The counterfactual outcome under strategy \(g\) is denoted \(Y^g\).
A static strategy assigns the same treatment value at every time point regardless of the evolving covariate history. Examples:
The potential outcome under “always treat” is \(Y^{\bar{a}_K = (1,1,\ldots,1)}\), often written \(Y^{\bar{1}}\), and under “never treat” it is \(Y^{\bar{0}}\).
A dynamic strategy adapts treatment decisions based on the individual’s evolving history. For example:
Dynamic strategies are clinically natural: many real-world treatment guidelines are themselves dynamic. The counterfactual \(Y^g\) under a dynamic strategy \(g\) is defined analogously to the static case — it is the outcome that would have been observed if, at every time \(k\), treatment had been set according to \(g_k\) applied to the individual’s counterfactual covariate history under \(g\).
The conceptual benchmark for estimating the effects of time-varying treatments is the sequentially randomized experiment.
Definition 3 (Sequentially Randomized Experiment) A sequentially randomized experiment is a longitudinal study in which, at each time \(k\), the treatment \(A_k\) is randomly assigned with probabilities that may depend on the observed past \((\bar{A}_{k-1}, \bar{L}_k)\), but not on any unmeasured variables.
In a sequentially randomized experiment, at each time \(k\) the treatment probability satisfies
\[\Pr[A_k = a_k \mid \bar{A}_{k-1} = \bar{a}_{k-1}, \bar{L}_k = \bar{l}_k, U] = \Pr[A_k = a_k \mid \bar{A}_{k-1} = \bar{a}_{k-1}, \bar{L}_k = \bar{l}_k]\]
for all values of unmeasured variables \(U\). This is the time-varying analogue of single-time-point randomization: within each “stratum” defined by \((\bar{A}_{k-1}, \bar{L}_k)\), treatment at time \(k\) is effectively randomized.
In a sequentially randomized experiment, the counterfactual mean under strategy \(g\) equals
\[\text{E}{\left[Y^g\right]} = \sum_{\bar{l}_K} \text{E}{\left[Y \mid \bar{A}_K = g(\bar{l}_K), \bar{L}_K = \bar{l}_K\right]} \prod_{k=0}^K f(l_k \mid \bar{A}_{k-1} = g_{k-1}(\bar{l}_{k-1}), \bar{L}_{k-1} = \bar{l}_{k-1}),\]
an expression that we will expand in Chapter 21. For now, the key point is that sequential randomization ensures identification: the counterfactual mean can be expressed as a function of observable data.
In observational studies we cannot guarantee randomization at any time point. The identifying assumption that replaces sequential randomization is sequential (or time-varying) exchangeability.
Definition 4 (Sequential Exchangeability) Sequential exchangeability holds if, for every time \(k\) and every strategy \(g\),
\[Y^g \perp\!\!\!\perp A_k \mid \bar{A}_{k-1} = \bar{g}_{k-1}(\bar{L}_{k-1}), \bar{L}_k,\]
where \(\bar{g}_{k-1}\) denotes the treatment history up to \(k-1\) as dictated by \(g\).
Intuitively, this condition says: among individuals who followed strategy \(g\) up to time \(k-1\) and share the same covariate history \(\bar{L}_k\), the treatment actually received at time \(k\) is independent of all potential outcomes. In other words, all variables that jointly predict \(A_k\) and are prognostic for \(Y^g\) have been measured in \(\bar{L}_k\).
In the time-fixed setting, exchangeability reads \(Y^a \perp\!\!\!\perp A \mid L\): potential outcomes are independent of treatment, given measured covariates. Sequential exchangeability extends this to every time point in sequence.
A sufficient (but not necessary) condition for sequential exchangeability is that \(\bar{L}_k\) contains all common causes of \(A_k\) and \(Y^g\) that are not caused by past treatment. This is often formalized using a DAG: sequential exchangeability holds if all backdoor paths from \(A_k\) to \(Y\) that are not mediated by past treatment are blocked by \(\bar{L}_k\).
In addition to sequential exchangeability, identification requires sequential positivity: for each time \(k\) and every combination of \((\bar{a}_{k-1}, \bar{l}_k)\) that can occur under strategy \(g\),
\[\Pr[A_k = g_k(\bar{a}_{k-1}, \bar{l}_k) \mid \bar{A}_{k-1} = \bar{a}_{k-1}, \bar{L}_k = \bar{l}_k] > 0.\]
This says that the treatment mandated by strategy \(g\) at time \(k\) must be possible for every subgroup defined by the observed history. Violations of positivity are common in longitudinal data when, for example, clinical guidelines forbid certain treatment sequences, or when patients with particular covariate histories are never observed to receive a given treatment.
An important subtlety in the time-varying setting is that sequential exchangeability and positivity may hold for some strategies but not for others.
Consider a study in which patients are treated based on their measured covariate history. The strategy “treat if \(L_k > c\)” respects the observed treatment assignment mechanism, so positivity holds by construction. By contrast, the strategy “treat if \(L_k > c\) and the patient’s unmeasured frailty is low” cannot be evaluated because the unmeasured component violates exchangeability.
Definition 5 (Identifiable Strategy) A strategy \(g\) is identifiable from the observed data if:
When only a subset of strategies is identifiable, we restrict inference to that subset and explicitly acknowledge which strategies cannot be compared from the available data.
This identifiability result has direct implications for how studies should be designed and how results should be interpreted:
A central complication in the analysis of time-varying treatments is the presence of time-varying confounders — covariates that change over time and that are causally affected by past treatment while simultaneously confounding future treatment assignments.
Definition 6 (Time-Varying Confounder) A variable \(L_k\) (\(k \geq 1\)) is a time-varying confounder for the effect of \(A_k\) on \(Y\) if it simultaneously satisfies:
The quintessential example is an intermediate outcome (e.g., CD4 cell count) that is measured repeatedly, is affected by prior antiretroviral therapy, and also predicts both future treatment assignment (physicians adjust the regimen based on CD4) and the ultimate outcome (AIDS or death).
The defining feature of time-varying confounding is a treatment–confounder feedback loop:
\[A_{k-1} \to L_k \to A_k \to Y.\]
Here, \(L_k\) lies on the causal path from past treatment to future treatment (through its effect on \(A_k\)) and also on an independent path to the outcome. This creates a situation in which \(L_k\) is simultaneously:
This double role is precisely what makes time-varying confounding so challenging. Standard regression-based methods that condition on \(\bar{L}_k\) cannot handle it correctly (see Chapter 20 for a detailed analysis). The methods of Chapter 21 — the g-formula, IP weighting, and g-estimation — are specifically designed to handle time-varying confounders in the presence of feedback.