我目前正在使用时间序列数据,我想为股票收益生成 1000 个合成数据。目前我使用的是 CircularBlockBootstrap,但对于股票回报来说这没有意义。在这里你可以看到我目前使用的代码:
从 arch.bootstrap 导入 CircularBlockBootstrap
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)
simulated_returns.append(tmp)
simulations = pd.concat(simulated_returns, axis=1, ignore_index=True)
return simulations
我的时间序列数据是下载的每日股票回报。也许有人可以解释我如何使用简单的块引导而不是圆形块引导来生成合成数据,我可以在其中使用一个np.random()
因子定义块长度?