博客
关于我
Introduction of moving block bootstrap (MBB)algorithm
阅读量:243 次
发布时间:2019-03-01

本文共 2880 字,大约阅读时间需要 9 分钟。

Because we can not use usual bootstrap sampling method to get subsamples from time series dataset, then the MBB was proposed to address this issue.

Suppose we have the time series following :
X 1 X_1 X1, X 2 X_2 X2, . . . . .... ...., X 10 X_{10} X10. Note that you can extend the footnote with other number or a symbol.
First step is to split the series into several blocks in which one should figure out the size of each block. Assume we let the size of each block equal to 2, then our blocked data would look like :

X 1 , X 2 ⏞ b l o c k   1 , X 3 , X 4 ⏞ b l o c k   2 , . . . . . . X 9 , X 10 ⏞ b l o c k   5 \overbrace{X_1,X_2}^{block\,1},\overbrace{X_3,X_4}^{block\,2},......\overbrace{X_9,X_{10}}^{block\,5} X1,X2 block1,X3,X4 block2,......X9,X10 block5

with the above blocks we get, now we can apply the bootstrap algorithm by taking a random sample of the blocks with replacement. The order in which the blocks are drawn is the position that they are placed in the bootstrap series. Hence, one probably blocks might be

b l o c k   1 , b l o c k 3   , b l o c k   5 , b l o c k   1 , b l o c k   2 block\,1, block3\,, block \,5, block\,1,block\,2 block1,block3,block5,block1,block2
and the corresponding original time series is
X 1 , X 2 ,       X 5 , X 6       X 9 , X 10       X 1 , X 2 ,       X 3 , X 4 ,       X_1,X_2,\,\,\,\,\,X_5,X_6\,\,\,\,\,X_9,X_{10}\,\,\,\,\,X_1,X_2,\,\,\,\,\,X_3,X_4,\,\,\,\,\, X1,X2,X5,X6X9,X10X1,X2,X3,X4,

These are the basic process of MBB for time series data. This can help us to get a new sample series with similar short term dependence data structure to the original data.

In python, you can rely on the pkg of “arch”, following I present a simple toy code from the with a minor revision.

from arch.bootstrap import MovingBlockBootstrap from numpy.random import RandomState  from numpy.random import standard_normalimport numpy as npy = standard_normal((6, 1))# to generate a time series with standard norm distribution.bs = MovingBlockBootstrap(2, y,random_state=RandomState(1234))# 2 is block size, y is your time series data, random_state #                                                        														is for reproducibility when requiredi=0bs_x=[ ] # an empty list to store the bootstrap series#here for is to look what the bootstrap looks like for each iteration, in our demonstrated case, we do boostrap only for 2 times.for data in bs.bootstrap(2):    print(data)    bs_y.append(data[0][0])     print(bs_y)    i=i+1# fc is function to compute the bootstrap series mean value.,you can replace it with your own definitiondef fc(a):    return a.mean(0)results = bs.apply(fc,2) ###to apply  a function defined by yourself to the bootstrap replicated data, "2" means apply the fc 2times to calculate the average of the boostrap data. of course , you can figure it with any number you want. print(results)

Thx for ur reading.

转载地址:http://uaet.baihongyu.com/

你可能感兴趣的文章
Mysql5.7版本单机版my.cnf配置文件
查看>>
mysql5.7的安装和Navicat的安装
查看>>
mysql5.7示例数据库_Linux MySQL5.7多实例数据库配置
查看>>
Mysql8 数据库安装及主从配置 | Spring Cloud 2
查看>>
mysql8 配置文件配置group 问题 sql语句group不能使用报错解决 mysql8.X版本的my.cnf配置文件 my.cnf文件 能够使用的my.cnf配置文件
查看>>
MySQL8.0.29启动报错Different lower_case_table_names settings for server (‘0‘) and data dictionary (‘1‘)
查看>>
MYSQL8.0以上忘记root密码
查看>>
Mysql8.0以上重置初始密码的方法
查看>>
mysql8.0新特性-自增变量的持久化
查看>>
Mysql8.0注意url变更写法
查看>>
Mysql8.0的特性
查看>>
MySQL8修改密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
查看>>
MySQL8修改密码的方法
查看>>
Mysql8在Centos上安装后忘记root密码如何重新设置
查看>>
Mysql8在Windows上离线安装时忘记root密码
查看>>
MySQL8找不到my.ini配置文件以及报sql_mode=only_full_group_by解决方案
查看>>
mysql8的安装与卸载
查看>>
MySQL8,体验不一样的安装方式!
查看>>
MySQL: Host '127.0.0.1' is not allowed to connect to this MySQL server
查看>>
Mysql: 对换(替换)两条记录的同一个字段值
查看>>