dirconn.TRGC#

class dirconn.TRGC(order: int | str = 'bic', max_order: int = 10, conditional: bool = True, ridge: float = 0.0, demean: bool = True, n_folds: int = 5, check_order_stability: bool = True, check_whiteness: bool = True)#

Time-reversed Granger causality, difference-based (Haufe et al. 2013; Winkler et al. 2016).

values[i, j] = (F_ij - F_ji) - (R_ij - R_ji), where F is GC on the data and R is GC on the data reversed in time. A lagged influence of i on j makes the first bracket positive and, because the reversal turns it around, the second negative, so both add up; an instantaneous mixture makes both brackets alike, so it cancels. The result is antisymmetric (values[j, i] = -values[i, j]), in nats, with an undefined (NaN) diagonal; a positive value means net predictive flow from i to j. This is predictive influence, not interventional causality.

The order is chosen once, on the data, and reused for the reversed data. The two net flows are recorded in the provenance (net_forward and net_reversed, NaN as null), and so are the two Granger matrices.

Parameters:
  • order – As for GC; conditional decides whether both Granger fits condition on all other channels. The order-stability and whiteness checks run on the forward fit only.

  • max_order – As for GC; conditional decides whether both Granger fits condition on all other channels. The order-stability and whiteness checks run on the forward fit only.

  • conditional – As for GC; conditional decides whether both Granger fits condition on all other channels. The order-stability and whiteness checks run on the forward fit only.

  • ridge – As for GC; conditional decides whether both Granger fits condition on all other channels. The order-stability and whiteness checks run on the forward fit only.

  • demean – As for GC; conditional decides whether both Granger fits condition on all other channels. The order-stability and whiteness checks run on the forward fit only.

  • n_folds – As for GC; conditional decides whether both Granger fits condition on all other channels. The order-stability and whiteness checks run on the forward fit only.

  • check_order_stability – As for GC; conditional decides whether both Granger fits condition on all other channels. The order-stability and whiteness checks run on the forward fit only.

  • check_whiteness – As for GC; conditional decides whether both Granger fits condition on all other channels. The order-stability and whiteness checks run on the forward fit only.

__init__(order: int | str = 'bic', max_order: int = 10, conditional: bool = True, ridge: float = 0.0, demean: bool = True, n_folds: int = 5, check_order_stability: bool = True, check_whiteness: bool = True) → None#

Methods

__init__([order, max_order, conditional, ...])

fit(data)

Estimate directed connectivity.

get_params()

Return the constructor parameters as a dictionary.

Attributes

check_order_stability

check_whiteness

conditional

demean

info

max_order

n_folds

order

ridge