dirconn.surrogate_test#
- dirconn.surrogate_test(estimator: Estimator, data: TimeSeries, generator: SurrogateGenerator, *, n_surrogates: int, seed: int, reduce: Callable[[Connectivity], Connectivity] | str | Sequence[float] | None = None, alpha: float = 0.05) SurrogateTestResult#
Test an estimator’s result against surrogates of the data.
The whole pipeline of
estimatoris repeated on every surrogate, including a model order chosen by a criterion, so that the null distribution reflects the same procedure as the observed value.- Parameters:
estimator (Estimator) – Any dirconn estimator.
data (TimeSeries) – Input data.
generator (SurrogateGenerator) – Defines the null hypothesis; see
dirconn.stats.surrogates.n_surrogates (int) – Number of surrogates. The smallest p-value is
1 / (n_surrogates + 1).seed (int) – Required. Surrogate
iusesRNGController(seed).child(i).reduce (callable, str or (float, float), optional) – Applied to the result of every fit before testing; this defines the family of tests. A callable maps a
Connectivityto another one, a band name or a pair of frequencies reduces the frequency axis with the mean (Connectivity.reduce_freq()).alpha (float) – Significance level used for the power check: a Bonferroni-type family of
mdefined cells (onlyi < jfor an antisymmetric method) needsn_surrogates >= m / alpha - 1, otherwise no cell can reachalpha / m.
- Return type:
- Raises:
ValueError – If a surrogate fit leaves a cell undefined that is defined on the data (a p-value there would be meaningless), or for invalid arguments.