# How do you do bootstrapping with time series data?

I recently learned about using bootstrapping techniques to calculate standard errors and confidence intervals for estimators. What I learned was that if the data is IID, you can treat the sample data as the population, and do sampling with replacement and this will allow you to get multiple simulations of a test statistic.

In the case of time series, you clearly can't do this because autocorrelation is likely to exist. I have a time series and would like to calculate the mean of the data before and after a fixed date. Is there a correct way to do so using a modified version of bootstrapping?

• Key search term: Block bootstrap. Apr 2, 2012 at 16:31
• towardsdatascience.com/… Feb 2, 2021 at 23:20

As @cardinal points out, variations on the 'block bootstrap' are a natural approach. Here, depending on the method, you select stretches of the time series, either overlapping or not and of fixed length or random, which can guarantee stationarity in the samples (Politis and Romano, 1991) then stitch them back together to create resampled times series on which you compute your statistic. You can also try to build models of the temporal dependencies, leading to the Markov methods, autoregressive sieves and others. But block bootstrapping is probably the easiest of these methods to implement.

Gonçalves and Politis (2011) is a very short review with references. A book length treatment is Lahiri (2010).

• @statnub If this is related to your previous weekly sales intervention question, note that you'd bootstrap if you didn't trust the model assumptions you were deploying there. Using a justifiable time series model in the first place should ideally minimise the risk of things that would indicate this kind of bootstrapping... Apr 2, 2012 at 19:13
• Good answer. Let me just add that you can use tsboot in the boot package in R to do this. Apr 3, 2012 at 12:20

The resampling method introduced in Efron (1979) was designed for i.i.d. univariate data but is easily extended to multivariate data. As discussed in . If $$x_1,···,x_n$$ is a sample of vectors, to maintain the covariance structure of the data in the sample. It is not immediately obvious whether one can resample a time series $$x_1,x_2,···,x_n$$. A time series is essentially a sample of size 1 from a stochastic process. Resampling a sample is original sample, so one learns nothing by resampling. Therefore, resampling of a time series requires new ideas.

Model-based resampling is easily adopted to time series. The resamples are obtained by simulating the time series model. For example, if the model is ARIMA(p,d,q), then the resamples of an ARIMA(p, q) model with MLEs (from the differenced series) of the autoregressive and moving average coefficients and the noise variance. The resamples are the sequences of partial sum of the simulated ARIMA(p, q) process.

Model-free resampling of time series is accomplished by block resampling, also called block bootstrap, which can be implemented using the tsboot function in R’s boot package. The idea is to break the series into roughly equal-length blocks of consecutive observations, to resample the block with replacement, and then to paste the blocks together. For example, if the time series is of length 200 and one uses 10 blocks of length 20, then the blocks are the first 20 observations, the next 20, and so forth. A possible resample is the fourth block (observation 61 to 80), then the last block (observation 181 to 200), then the second block (observation 21 to 40), then the fourth block again, and so on until there are 10 blocks in the resample.

• There are other forms of block bootstrap methods including overlapping block bootstrap and circular block bootstrap which are described in detail in Lahiri's (2003) book "Resampling Methods for Dependent Data". These methods are applicable to stationary time series. Dec 8, 2017 at 5:55