Causal Inference in the Closed-Loop: Marginal Structural Models for Sequential Excursion Effects

Alexander W. Levis, Gabriel Loewinger, Francisco Pereira

Abstract

Optogenetics is a powerful neuroscience technique for studying how neural circuit manipulation affects behavior. Standard analysis conventions discard information and severely limit the scope of the causal questions that can be probed. To address this gap, we 1) draw connections to the causal inference literature on sequentially randomized experiments, 2) propose a non-parametric framework for analyzing "open-loop" (static regime) optogenetics behavioral experiments, 3) derive extensions of history-restricted marginal structural models for dynamic treatment regimes with positivity violations for "closed-loop" designs, and 4) propose a taxonomy of identifiable causal effects that encompass a far richer collection of scientific questions compared to standard methods. From another view, our work extends "excursion effect" methods, popularized recently in the mobile health literature, to enable estimation of causal contrasts for treatment sequences in the presence of positivity violations. We describe sufficient conditions for identifiability of the proposed causal estimands, and provide asymptotic statistical guarantees for a proposed inverse probability-weighted estimator, a multiply-robust estimator (for two intervention timepoints), a framework for hypothesis testing, and a computationally scalable implementation. Finally, we apply our framework to data from a recent neuroscience study and show how it provides insight into causal effects of optogenetics on behavior that are obscured by standard analyses.

Introduction

Optogenetics allows researchers to manipulate specific neurons with millisecond precision. However, traditional analysis methods often rely on "macro" comparisons—aggregating behavioral counts over long intervals to compare control and experimental groups. This approach has two major flaws: it ignores the "micro" temporal structure of stimulation sequences and fails in "closed-loop" settings. In closed-loop experiments, the laser is triggered by the animal's behavior, creating a feedback loop where past behavior acts as both a cause of future treatment and a mediator of past treatment effects. This "treatment-confounder feedback" can mask significant neural effects in standard regression analyses.

Methods: Sequential Excursion Effects and HR-MSMs

We propose a new nonparametric framework using History-Restricted Marginal Structural Models (HR-MSMs) to estimate Sequential Excursion Effects. Instead of analyzing the entire experiment as a single block, we examine a small temporal window ($\Gamma$). We ask: "If we intervened to force a specific sequence of laser pulses over the last few seconds, how would the behavior change right now?"

Taxonomy of causal effects and the HR-MSM framework. Panels A-C illustrate blip, dissipation, and dose-response effects. Panel D shows the closed-loop DAG, and Panel E details the HR-MSM structure.

A key challenge in closed-loop designs is "positivity violations," where treatment is only possible when the animal is in a specific state (e.g., near a lever). Our framework defines "availability-respecting" policies that only consider interventions feasible within the experimental design. We developed an Inverse Probability Weighted (IPW) estimator to un-bias results using known randomization probabilities and a Multiply-Robust (MR) estimator for two-timepoint interventions to ensure accuracy even under partial model misspecification.

Key Results and Insights

Applying our framework to both synthetic and real-world datasets (Markowitz et al., 2023) revealed dynamics that were previously invisible:

  • The Cancellation Effect: We found that treatments can have massive immediate effects that are cancelled out in global averages. For instance, a stimulus might stop a behavior immediately but increase the likelihood of its recurrence shortly after, resulting in a net-zero "macro" count.
  • Dose-Response and Dissipation: We successfully mapped dose-response curves, showing how additional stimulation opportunities within a 5-timepoint window increase behavioral odds. We also quantified how the effect of a single stimulation rises and then dissipates over time.
  • Cross-Disciplinary Adaptation: By recognizing that closed-loop mouse experiments are statistically similar to "micro-randomized trials" in mobile health, we adapted excursion effect methods to provide a high-resolution view of neural influence on learning.

Limitations and Future Work

While powerful, the framework requires researchers to choose an appropriate window size ($\Gamma$) based on domain expertise. Additionally, the "curse of dimensionality" makes analyzing very long treatment sequences computationally challenging. Future work aims to extend robust estimators to longer sequences and improve scalability for small-sample neuroscience studies.

Summary updated

BibTeX
@inproceedings{levis2024causal,
  author = {Alexander W. Levis and Gabriel Loewinger and Francisco Pereira},
  title = {{Causal Inference in the Closed-Loop: Marginal Structural Models for Sequential Excursion Effects}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=BgZcuEsYU8},
}
Figure