Estimate optimal window length for time-series bootstraps


x (array_like) – A one-dimensional or two-dimensional array-like. Operates columns by column if 2-dimensional.


A DataFrame with two columns b_sb, the estimated optimal block size for the Stationary Bootstrap and b_cb, the estimated optimal block size for the circular bootstrap.

Return type


See also


Politis and Romano’s bootstrap with exp. distributed block lengths


Circular (wrap-around) bootstrap


Algorithm described in (1) its correction (2) depends on a tuning parameter m, which is chosen as the first value where k_n consecutive autocorrelations of x are all inside a conservative band of \(\pm 2\sqrt{\log_{10}(n)/n}\) where n is the sample size. The maximum value of m is set to \(\lceil \sqrt{n} + k_n \rceil\) where \(k_n=\max(5, \log_{10}(n))\). The block length is then computed as

\[b^{OPT}_i = \left(\frac{2g^2}{d_{i}} n\right)^{\frac{1}{3}}\]


\[\begin{split}g & = \sum_{k=-m}^m h\left(\frac{k}{m}\right)|k|\hat{\gamma_{k}} \\ h(x) & = \min(1, 2(1-|x|)) \\ d_{i} & = c_{i} \left(\hat{\sigma}^2\right)^2 \\ \hat{\sigma}^2 & = \sum_{k=-m}^m h\left(\frac{k}{m}\right)\hat{\gamma_{k}} \\ \hat{\gamma_{i}} & = n^{-1} \sum_{k=i+1}^n \left(x_k-\bar{x}\right)\left(x_{k-i}-\bar{x}\right) \\\end{split}\]

and the two remaining constants \(c_i\) are 2 for the Stationary bootstrap and 4/3 for the Circular bootstrap.

Some of the tuning parameters are taken from Andrew Patton’s MATLAB program that computes the optimal block length. The block lengths do not match this implementation since the autocovariances and autocorrelations are all computed using the maximum sample length rather than a common sampling length.



Dimitris N. Politis & Halbert White (2004) Automatic Block-Length Selection for the Dependent Bootstrap, Econometric Reviews, 23:1, 53-70, DOI: 10.1081/ETC-120028836.


Andrew Patton , Dimitris N. Politis & Halbert White (2009) Correction to “Automatic Block-Length Selection for the Dependent Bootstrap” by D. Politis and H. White, Econometric Reviews, 28:4, 372-375, DOI: 10.1080/07474930802459016.