thepragmaticquant.com

Explainers · Uncertainty and numerical verification

How do I bootstrap a time series without destroying the dependence in it?

Resample structures that carry the dependence, not individual observations: contiguous blocks, model residuals, a fitted sieve, or wild multipliers. Which one is right depends on which assumption your data actually breaks, and no single method is best across all of them.

August 10, 2026 · evidenced by tsbootstrap

The failure, stated plainly

The ordinary bootstrap resamples observations independently and with replacement. That procedure is justified by an assumption: that the observations were independent to begin with. A time series is the standard example of data where they are not — yesterday’s value tells you something about today’s — and resampling at the level of the individual observation destroys exactly that link.

What you get back is a resampled series with the marginal distribution of the original and none of its serial structure. The standard errors computed from it are too small, sometimes by a lot, and the confidence intervals built on them are too narrow. Nothing in the output warns you. The procedure runs, returns numbers, and the numbers are wrong in the direction that makes you more confident.

The four families that fix it

Each one preserves dependence by resampling a different structure.

Block bootstrap. Resample contiguous runs of observations instead of single points. Dependence inside a block survives intact; dependence across the block boundary does not. The tuning parameter is the block length, and it is a real trade-off: too short and you have reinvented the independent bootstrap, too long and you have very few distinct blocks and almost no resampling variety. Moving, circular and stationary variants differ in how blocks are chosen and how the series ends are handled.

Residual bootstrap. Fit a model, take the residuals, resample those, and rebuild series by pushing the resampled residuals back through the fitted model. The dependence is carried by the model rather than by the resampling, so this is the strongest method when your model is right and the worst when it is not. Its assumption is that the residuals are independent and identically distributed, which is a claim you should check rather than inherit.

Sieve bootstrap. Approximate the process by an autoregression whose order grows with the sample size, then bootstrap that. It buys you the residual bootstrap’s efficiency without committing to a fixed parametric model, at the cost of needing enough data for the order selection to mean something.

Wild bootstrap. Keep each residual where it is and multiply it by a random variable with mean zero and variance one. Nothing moves, so any structure in the residual sequence is preserved, and the method survives heteroskedasticity — residual variance that changes over the series — which is precisely where the plain residual bootstrap breaks.

How to choose

Ask which assumption your data actually violates, and pick the method that does not need it.

  • Serial dependence and no model you trust: block.
  • A model you do trust, with well-behaved residuals: residual.
  • Dependence you want captured non-parametrically, with enough data: sieve.
  • Residual variance that changes over time: wild.

The honest answer to “which is best” is that it is not a property of the method. It is a property of the pairing between the method and the way your particular series departs from independence. A library that recommends one universally is telling you about its author’s data, not yours.

How to tell whether it worked

Do not accept the intervals on faith; the whole point is that the broken version also returns intervals. Two checks are cheap.

The first is a coverage check on data whose truth you control. Simulate a process with known dependence and a known parameter, run the whole procedure, and count how often the nominal 95 percent interval contains the true value. If you get 80 percent, the procedure is not delivering what it says on the label — and running that same check with the plain independent bootstrap is the fastest way to see the size of the problem you started with.

The second is a structure check on the resamples. Compute the autocorrelation function of the original series and of a few hundred resampled ones and compare them. A resampling scheme that has destroyed the dependence shows it here immediately, at whatever lag it destroyed.

What is already built

tsbootstrap is published on PyPI: version 0.7.1, MIT-licensed, 18 releases, shipping block, residual, sieve and wild resampling for dependent data behind a single interface, with a conformal layer for prediction intervals on top. Every method named above is in it, so the choice above is a one-line change rather than a reimplementation.

Check this yourself

tsbootstrap is published on PyPI: version 0.7.1, MIT-licensed, 18 releases, shipping block, residual, sieve and wild resampling for dependent data.

If this is your problem

I consult on intervals and numerical kernels that are wrong in ways a passing test suite cannot see. The entry point is a uncertainty and numerics audit: a written assessment of where your intervals and your accumulators break: which independence assumption is doing the work, which kernel drifts, and how far off the reported figure is on your own data.

Email me about an engagement What to put in it →

Tell me which of the above you have already tried, and what it did instead. sankalp.gilda@gmail.com