bootstrap()
- tsbootstrap.bootstrap(X: object, *, method: BaseMethodSpec, n_bootstraps: int = 999, random_state: int | Generator | SeedSequence | None = None, exog: object | None = None, dtype: Literal['float64', 'float32'] = 'float64', backend: Literal['numpy', 'compiled'] = 'numpy') BootstrapResult[source]
Generate bootstrap replicates of a time series.
- Parameters:
X (array-like) – Observations, shape
(n,)or(n, d).method (BaseMethodSpec) – A method spec (e.g.
MovingBlock(block_length="auto")).n_bootstraps (int, default 999) – Number of replicates.
random_state (int | numpy Generator | SeedSequence | None) – Reproducibility seed. Replicate
iis bound to its own generator, so results are reproducible for a given seed and environment (OS, hardware, BLAS, NumPy), as with NumPy/scikit-learn.exog (array-like or None) – Optional exogenous regressors, shape
(n,)or(n, k), aligned withX, held fixed during regeneration. Supported forResidualBootstrapwith anAR(ARX),VAR(VARX), orARIMA(ARIMAX) model, and forSieveAR. ARX/VARX requireinitial="fixed"andburn_in=0(the exog must align with each step); ARIMAX has no such constraint (exog enters at the level after inverse-differencing).dtype ({"float64", "float32"}, default "float64") – Precision of the returned replicate values. The model fit, autocovariance, and every reduction always run in
float64; only the final simulation/path tensor is cast todtype, halving its memory atfloat32for largeB. Lower precisions are reserved for a future GPU backend.backend ({"numpy", "compiled"}, default "numpy") –
"numpy"is the default reproducible path (one PCG64 stream per replicate)."compiled"selects an opt-in numba kernel that builds indices and gathers in one replicate-parallel pass, a large speed-up on the observation methods (IID and the block families). It uses a distinct counter-based RNG stream with its own reproducibility goldens, so its replicates are equal in distribution to the numpy path but not bit-identical, and it is never engaged unless requested. It does not support the recursive (model-based) methods and requires the[accel]extra.
- Returns:
Sequence of
BootstrapSampleplus metadata.- Return type: