Skip to content

chc.discovery

Stability tier: experimental.

Lagged causal-parent discovery for the dynamics -- a minimal, control-focused PC1 (not PCMCI).

For each next-state component x^j_t this finds which lagged variables {x^i_{t-tau}, u^k_{t-tau}} are its direct parents, by greedy forward selection with the MCI-calibrated partial-correlation test (chc.independence.partial_corr_test): at each step add the candidate with the strongest association given the already-selected parents, until none is significant. Conditioning on the selected parents (dominant autoregressive lags are picked first) removes indirect-path false positives -- x^i_{t-2} -> x^i_{t-1} -> x^j_t makes x^i_{t-2} look like a parent to a naive test, but not once x^i_{t-1} is conditioned on.

Deliberately minimal: lag-capped, next-state targets only, no contemporaneous-link search. The heavy algorithms (PCMCI+/LPCMCI) stay a lazy, opt-in tigramite adapter; the point here is to feed GraphResidual's adjacency and the effect estimators' adjustment set from data, not by hand.

LaggedGraph dataclass

Discovered lagged parents. state_parents[j, i, tau-1] = x^i_{t-tau} -> x^j_t.

adjacency()

State-to-state coupling collapsed over lags -- a GraphResidual adjacency (0/1).

node_adjacency(node_dim)

Collapse component parents to a node-level adjacency (nodes = blocks of node_dim).

adjacency[j, i] = 1 iff any component of node i is a discovered lagged parent of any component of node j -- the adjacency GraphResidual consumes when the flat state is n_nodes blocks of node_dim.

edges()

Every discovered edge as (target, source, lag, kind) (kind state/control).

TigramiteDiscovery dataclass

Adapter over tigramite's PCMCI (lazy import; requires tigramite installed).

A drop-in for discover_lagged_parents returning the same LaggedGraph, but with PCMCI + a tigramite conditional-independence test doing the work. Reach for it when the native minimal PC1 is not enough -- dense coupling, or nonlinear dependencies via a nonparametric test (cond_ind_test=GPDC()/CMIknn()). tigramite is GPL-3.0, so it stays bring-your-own-env and is never a chc dependency.

discover(series, controls=None, max_lag=3)

Run PCMCI on [series, controls] and return the state components' lagged parents.

discover_lagged_parents(series, controls=None, max_lag=3, alpha=0.01, max_parents=None)

Discover each state component's lagged parents from a trajectory; see the module docstring.

series is (T, d_state); controls an optional (T, d_control). max_parents caps the forward selection per target (default: the candidate count). Returns a LaggedGraph.