dirconn.bootstrap#

dirconn.bootstrap(estimator: Estimator, data: TimeSeries, *, n_boot: int, seed: int, ci: float = 0.95, block_size: int | None = None, reduce: Callable[[Connectivity], Connectivity] | str | Sequence[float] | None = None) → BootstrapResult#

Bootstrap an estimator’s result.

Resample i uses RNGController(seed).child(i) to draw n_units indices with replacement, so results do not depend on how the work is split.

Parameters:
  • estimator (Estimator) – Any dirconn estimator; its whole procedure, including order selection, is repeated.

  • data (TimeSeries) – Epoched data are resampled by trial and need at least two trials; warns below 20. Continuous data need block_size: the record is cut into non-overlapping blocks that are resampled and stored as separate trials, so no model is fitted across a seam. The observed result is still computed on the unbroken record, which uses a few more regression rows than a resample does.

  • n_boot (int) – Number of resamples.

  • seed (int) – Required.

  • ci (float) – Confidence level, strictly between 0 and 1.

  • block_size (int, optional) – Block length in samples; continuous data only. Choose it longer than the memory of the process (model order, autocorrelation time), or the blocks break the dependence being estimated.

  • reduce (callable, str or (float, float), optional) – Applied to every fit before the bands are computed (see surrogate_test()).

Return type:

BootstrapResult

Raises:

ValueError – For invalid arguments, fewer than two trials or blocks, or a resampled fit that leaves a cell undefined that is defined on the data.