elephant.causality.granger.conditional_granger

elephant.causality.granger.conditional_granger(signals, max_order, information_criterion='aic')[source]

Determine conditional Granger Causality of the second time series on the first time series, given the third time series. In other words, for time series X_t, Y_t and Z_t, this function tests if Y_t influences X_t via Z_t.

Parameters:
signals(N, 3) np.ndarray or neo.AnalogSignal

A matrix with three time series (second dimension) that have N time points (first dimension). The time series to be conditioned on is the third.

max_orderint

Maximal order of autoregressive model.

information_criterion{‘aic’, ‘bic’}, optional

A function to compute the information criterion:

  • bic for Bayesian information_criterion,

  • aic for Akaike information criterion,

Default: ‘aic’

Returns:
conditional_causality_xy_z_roundfloat

The value of conditional causality of Y_t on X_t given Z_t. Zero value indicates that causality of Y_t on X_t is solely dependent on Z_t.

Raises:
ValueError

If the provided signal does not have a shape of Nx3.

Notes

The formulas used in this implementation follows (Ding et al., 2006). Specifically, the Eq 35.