Causal discovery for time series with endogenous context variables
Abstract
Many real-world systems exhibit both context- and time-dependent causal dynamics, where the dynamical system state also influences its context. For instance, soil moisture is driven by precipitation, yet also provides the context for heat-flux realization. We capture such dynamics in Structural Causal Models (SCMs) by introducing endogenous and time-dependent discrete context variables, also allowing for possibly lagged dependencies with the system variables. While context variables are discrete, they may also be proxies of continuous variables. The enabling assumptions for causal discovery of our model are either persistence of the context or sparsity of the context–system dependencies. We design two new PCMCI-based algorithms for causal discovery with endogenous context variables for time series and prove their soundness. A systematic evaluation on synthetic benchmarks and an application to a real-world land-atmosphere feedback problem demonstrate their effectiveness and applicability.
Lay Summary
Many real-world systems such as climate, financial markets, or the brain, operate under shifting causal regimes, which we call contexts: the same variable can have different causes depending on the system's current state. Crucially, this state often emerges from the system itself. Soil moisture drives how surface temperatures respond to radiation, but is also driven by precipitation. Most causal discovery methods either ignore these context shifts or assume the context is externally imposed. This assumption introduces systematic errors when the context feeds back into the system. We developed two algorithms, PAC-PCMCI+ and SAC-PCMCI+, that learn separate causal graphs for each context from time series data, while correctly handling the feedback between context and system. The key insight is that two natural properties: contexts that persist over time, and causal mechanisms governed by only one or few drivers at a time, make the problem tractable. Our algorithms propose a combined conditional independence testing approach which adaptively selects whether to test from the data pooled across contexts, or the data from individual contexts, to avoid selection bias and return the context-specific graphs and the union graph which display the shared dynamics. Applied to ERA5 climate reanalysis data, our methods recover meaningful land-atmosphere feedbacks across dry, normal, and moist soil conditions. This opens a path toward more reliable causal modeling of any system where internal dynamics drive context change.