I am currently trying to Block-Bootstrap my Stock-return data in Python. I am doing that to generate synthetic data. I came across the CircularBlockBootstrap but found in a few discussions here that it isn't recommended for such data. Now I am trying to find a simple BlockBootstrap Library in Python unfortunately I can't find any such library. Currently this is my code:

def WBB(s, blocksize, N_paths):
    simulated_returns = []
bs = CircularBlockBootstrap(blocksize,s)
for i, data in enumerate(bs.bootstrap(N_paths)):
    tmp = data[0][0].reset_index(drop=True)
simulations = pd.concat(simulated_returns, axis=1, ignore_index=True)
return simulations

Can someone maybe explain to me how I can change my currently CircularBlockBootstrap to a simple BlockBootstrap?


The arch package have time-series bootstrap methods:

The arch package in Python have implemented the stationary (block) bootstrap (among others, see this link) of Politis and Romano (1994), that keep the bootstrap re-samples stationary and avoid breaking the dependence structure in the data. This method is commonly used when bootstrapping time-series data.

In this example the author describes how to use the stationary bootstrap approach to construct confidence intervals for Sharpe ratios. Furthermore, he illustrates how to find the optimal block-length for the bootstrap procedure, which is also theoretically described in Politis & White (2004).

This bootstrap method should solve your problem. I hope this helps.

  • 1
    $\begingroup$ I also like the StationaryBootstrap of Politis and Romano (I think it is better than the Block Bootstrap) But if you prefer the BlockBootstrap, you can find one in the arch package also under the name MovingBlockBootstrap. $\endgroup$
    – noob2
    Jun 13 '21 at 15:57
  • $\begingroup$ Thank you guys for your great input. Another question: Is it possible to make those Bootstrap NOT overlapping? Because when I read the ARCH package document I couldn't find a possibility to produce those Block-Bootstraps without overlapping blocks. Or did I maybe understood it wrong and those blocks are by default not overlapping? $\endgroup$ Jun 14 '21 at 11:38
  • $\begingroup$ Could you please elaborate on why you do not want to have overlapping block bootstrap? In general, overlapping and non-overlapping block bootstraps provides the same relative efficiency, when dealing with a large sample size. This is also detailed in this paper, which might be of use (see eg. section 3). $\endgroup$
    – Pleb
    Jun 14 '21 at 12:19
  • $\begingroup$ Of course I can. I am triying to test an Investment Strategy on Autocorrelation as a Feature. The challenge that I have here is to use non-overlapping Block, by default. I am aware of the issue that with f.e. 10'000 synthetic datasets the difference won't be big on such a big data-set but I would like to know do I understand the ARCH package completely. So that is why I am asking is the ARCH package using overlapping or none overlapping procedure? $\endgroup$ Jun 14 '21 at 12:41
  • 1
    $\begingroup$ I will do that and as soon as I know it I will keep you updated. So far thank you for your help. $\endgroup$ Jun 14 '21 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.