arch.bootstrap.optimal_block_length¶
- arch.bootstrap.optimal_block_length(x: ndarray | Series | DataFrame) DataFrame [source]¶
Estimate optimal window length for time-series bootstraps
- Parameters:¶
- Returns:¶
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
arch.bootstrap.StationaryBootstrap
Politis and Romano’s bootstrap with exp. distributed block lengths
arch.bootstrap.CircularBlockBootstrap
Circular (wrap-around) bootstrap
Notes
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}}\]where
\[\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.
References