⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 block_bootstrap.m

📁 经济类的实用的时间序列分析软件包
💻 M
字号:
function [bsdata, indexes]=block_bootstrap(data,w,B);
% PURPOSE:
%   Implements a block bootstrap for bootstrapping stationary, dependant series
% 
% USAGE:
%     [bsdata, indexes]=block_bootstrap(data,w,B);
% 
% INPUTS:
%     data: T by 1 matrix of data to be bootstrapped(shoudl be unit root)
%     w:    Desired average windows length
%     B:    Number fo bootstraps
% 
% OUTPUTS:
%     bsdata: T x B matrix of bootstrapped data
%     indexes: T by B matrix of location sof the original data(data(indexes)=bsdata;
% 
% COMMENTS:
% 
% Author: Kevin Sheppard
% kevin.sheppard@economics.ox.ac.uk
% Revision: 2    Date: 12/31/2001

[t,k]=size(data);
data=[data;data(1:w)];
s=ceil(t/w);
Bs=rand(s,B);
indexes=zeros(t,B);
index=1;
for i=1:t
    if mod(i,w)==1
        indexes(i,:)=ceil(Bs(index,:)*t);
        index=index+1;    
    else
        indexes(i,:)=indexes(i-1,:)+1;
    end
end

bsdata=data(indexes);


    








⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -