dirconn.SSGC#
- class dirconn.SSGC(order: int | str = 'bic', max_order: int = 10, n_freqs: int = 128, fmax: float | None = None, freqs: Any = None, ridge: float = 0.0, demean: bool = True, n_folds: int = 5, check_order_stability: bool = True, check_whiteness: bool = True, conditional: bool = True)#
Spectral Granger causality from the state-space form of the VAR (Barnett and Seth 2015).
values[i, j, f]is the Geweke spectral Granger causality from channelito channeljat frequencyf, in nats. One VAR model of all channels is fitted; written in innovations form, it gives every reduced model exactly by one discrete algebraic Riccati equation per conditioning set (seedirconn.methods.statespace), so no reduced model is refitted and no non-parametric spectral factorisation is needed. Withconditional=True(default) the influence ofionjis conditioned on all other channels,f_{i->j|rest}(f); withconditional=Falseeach pair is judged from its bivariate subprocess of the same fit, which for two channels is Geweke’s (1982) formula.The mean over the whole unit circle (the trapezoid mean over the default grid from 0 to the Nyquist frequency) is the time-domain value of
GC(method="state_space"). The values do not depend on the scale of the channels. UnlikeMTGCthe measure is parametric and conditional, so it suits short segments and more than two channels; like every MVAR measure it needs a stationary, well-specified model, and an unstable fit raisesValueError.- Parameters:
order – As for
DTF. Withridge > 0the penalised fit and its residual covariance define the model.max_order – As for
DTF. Withridge > 0the penalised fit and its residual covariance define the model.n_freqs – As for
DTF. Withridge > 0the penalised fit and its residual covariance define the model.fmax – As for
DTF. Withridge > 0the penalised fit and its residual covariance define the model.freqs – As for
DTF. Withridge > 0the penalised fit and its residual covariance define the model.ridge – As for
DTF. Withridge > 0the penalised fit and its residual covariance define the model.demean – As for
DTF. Withridge > 0the penalised fit and its residual covariance define the model.n_folds – As for
DTF. Withridge > 0the penalised fit and its residual covariance define the model.conditional (bool) – Condition on all other channels (default) or judge channel pairs separately. Costs one Riccati equation per channel, or one per pair and per channel.
check_order_stability (bool) – As for
DTF; the order-stability check compares with least-squares GC refits in the same mode (conditional or pairwise).check_whiteness (bool) – As for
DTF; the order-stability check compares with least-squares GC refits in the same mode (conditional or pairwise).
- __init__(order: int | str = 'bic', max_order: int = 10, n_freqs: int = 128, fmax: float | None = None, freqs: Any = None, ridge: float = 0.0, demean: bool = True, n_folds: int = 5, check_order_stability: bool = True, check_whiteness: bool = True, conditional: bool = True) None#
Methods
__init__([order, max_order, n_freqs, fmax, ...])fit(data)Estimate directed connectivity.
get_params()Return the constructor parameters as a dictionary.
Attributes
check_order_stabilitycheck_whitenessconditionaldemeanfmaxfreqsinfomax_ordern_foldsn_freqsorderridge