Causal Inference under Time Varying Confounding

302 concepts206 papers1 proposal

When estimating the causal effect of a treatment over time, we inevitably run into a fundamental feedback loop: past treatments influence future covariates, which in turn influence future treatment decisions. This phenomenon, known as time-varying confounding (or treatment-confounder feedback), creates a statistical catch-22 that invalidates standard static causal inference methods.

To understand why this happens and how modern machine learning frameworks resolve it, we must look at the mechanics of sequential decision-making.

The Catch-22 of Sequential Feedback

Imagine tracking a patient's health over time. At time $t=1$, a doctor administers an initial treatment ($A_1$). By time $t=2$, this treatment alters the patient's laboratory markers ($X_2$). The doctor then reviews these updated markers to determine the next treatment dose ($A_2$). Finally, we observe the ultimate health outcome ($Y$).

A_1 ----------> X_2 ----------> A_2 ----------> Y
 \             ^               ^             ^
  \___________/_______________/_____________/

In this system, $X_2$ plays two conflicting roles simultaneously:

  1. It is a mediator for $A_1$, because $A_1$ affects $Y$ partly through its impact on $X_2$.
  2. It is a confounder for $A_2$, because it simultaneously influences the choice of $A_2$ and the final outcome $Y$.

If we want to estimate the joint causal effect of the sequence $(A_1, A_2)$ on $Y$, standard regression techniques fail regardless of whether we include or exclude $X_2$. As noted by Dennis Frauen et al., if we condition on $X_2$ to block the confounding bias threatening $A_2$, we inadvertently block the causal pathway of $A_1$, erasing its downstream impact. Conversely, if we do not condition on $X_2$, the estimate for $A_2$ becomes heavily biased because sicker patients receive different treatments than healthier ones.

This violation of strict exogeneity means that traditional panel data models, such as two-way fixed effects or standard linear mixed models, yield severely biased estimates. As demonstrated by Tianchen Qian et al., even when treatments are randomized at each step (as in mobile health apps), endogenous feedback loops prevent standard models from capturing true population-level average effects. Similarly, Licheng Liu et al. point out that omitting these time-varying trends leads to severe selection bias when future treatment assignments depend on past outcomes.

Breaking the Loop with G-Methods

To resolve this paradox, epidemiologists and computer scientists utilize "g-methods," which adjust for confounding without conditioning on intermediate variables in a way that blocks causal pathways. Two primary paradigms dominate this space: Inverse Probability Weighting (IPW) and G-Computation.

Recurrent Marginal Structural Networks (IPW)

Instead of altering the regression equation, Inverse Probability Weighting changes the data distribution itself. It creates a "pseudo-population" by weighting each observation by the inverse probability of receiving the treatment they actually received, given their past history.

Mathematically, this removes the arrow from the covariate $X_2$ to the treatment $A_2$. In this weighted pseudo-population, treatment assignments act as if they were randomized at each step, completely untangling the feedback loop. Bryan Lim modernized this approach by combining it with deep learning in Recurrent Marginal Structural Networks (R-MSNs). By using Long Short-Term Memory (LSTM) networks to compute these propensity weights over long, variable-length histories, the model can generate unbiased multi-step forecasts of treatment responses.

Iterative G-Computation

Rather than reweighting the data, G-computation uses a generative approach. It explicitly models the sequential transitions of the system step-by-step. To evaluate a hypothetical treatment path, the model simulates forward: it predicts the next covariate state given the past, fixes the treatment to the desired counterfactual action, and repeats the process recursively until the final time step.

Because it simulates the counterfactual trajectories explicitly, it never needs to condition on the observed intermediate covariates in a single static model. Dennis Frauen et al. scaled this concept to complex sequences using the G-Transformer (or IGC-Net). By replacing high-variance propensity scores with a regression-based recursive network, they bypassed the need for expensive joint distribution modeling, providing stable personalized medical outcome predictions. To handle continuous-time systems where treatments and confounders interact incessantly, Andrew Ying introduced martingale projections, providing a rigorous mathematical framework to resolve uncountably infinite feedback loops.

The Challenge of Hidden Confounders

The validity of both IPW and G-computation relies on the assumption of no unobserved confounding—the belief that we have recorded every variable driving both the treatment decisions and the outcomes. In real-world scenarios, this assumption rarely holds. Unobserved patient frailty or shifting environmental factors frequently introduce hidden bias.

To address this, Ioana Bica et al. developed the Time Series Deconfounder. This method exploits a unique property of modern data: doctors often prescribe multiple treatments simultaneously (e.g., combinations of different medications).

Hidden Confounder (Z_t)  ---> [Doctor's Latent Intent]
       /          \                  /          \
      v            v                v            v
Treatment A_t   Treatment B_t   Outcome Y_{t+1}  Covariates X_{t+1}

Because an unobserved confounder affects the assignments of all simultaneous treatments, the multi-treatment assignment pattern over time carries a signature of the hidden variable. By training a recurrent neural network factor model on the history of assigned treatments, the authors can "back out" a latent variable that acts as a proxy for the unobserved confounder. This transforms an unobserved confounding problem into an observed one, allowing for unbiased counterfactual estimation.

Scaling to Long Sequences and Continuous States

As the field moves toward real-time monitoring—such as mobile health applications and continuous intensive care tracking—models must scale to handle long sequences without suffering from compounding simulation errors or exponential variance inflation.

Recent architectures replace standard recurrent networks with state-space models and contrastive learning objectives to improve stability:

  • State-Space Representations: Haotian Wang et al. introduced Mamba-CDSP, which leverages structured state-space models alongside a covariate-based decorrelation mechanism. This allows the model to process long sequences efficiently while stripping out the confounding bias embedded within the hidden states.
  • Information-Theoretic Objectives: Rather than predicting every fine-grained future covariate to perform G-computation, Mouad El Bouchattaoui proposed Causal CPC. This framework uses contrastive predictive coding to maximize the mutual information between historical representations and future outcomes, avoiding the compounding errors that occur when forcing a model to simulate high-dimensional intermediate states over long horizons.

By shifting from static adjustments to dynamic sequence modeling, these frameworks allow researchers to reliably answer "what if" questions from observational data, even when the actions of the past continuously reshape the conditions of the future.

History & citationVersion 2 · 2026-10-04

Current · Permanent link

  1. Version 2 (latest) · 2026-10-04 · 213 papers
  2. Version 1 · 2026-10-04 · 215 papers
Cite this direction

Latest version (a living page):

@misc{lacuna_time_varying_confounding_1dcc3ad0,
  title = {time-varying confounding},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/time-varying-confounding/rdr_1dcc3ad0d3a1432faf030c79db20ae5a},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-25},
}

This exact version (version 2, frozen text):

@misc{lacuna_time_varying_confounding_1dcc3ad0_v2,
  title = {time-varying confounding},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/time-varying-confounding/rdr_1dcc3ad0d3a1432faf030c79db20ae5a/v/2},
  note = {Version 2, frozen 2026-10-04. Accessed 2026-11-25},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake