【发布时间】:2019-10-08 19:30:57
【问题描述】:
我有一些来自 Rapach、Strauss 和 Zhou (2013)、Journal of Finance 的代码。
它为单边假设检验计算引导 p 值,
H0: B=0 against H1: B>0
我是否可以修改此代码来计算假设检验:
H0: B=0 against H1: B\=0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Computing statistics for wild bootstrapped pseudo samples
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
stats_boot=zeros(N+1,N,B);
for b=1:B;
for j=1:N;
[results_j_star,R_squared_j_star]=...
Estimate_Granger_pairwise_GMM(Y_star(:,:,b),...
Y_star(:,:,b),X_1_star(:,:,b),X_2_star(:,:,b),j);
for i=1:(N-1);
if j==1;
stats_boot(i+1,j,b)=results_j_star(i,2);
else
if i<j;
stats_boot(i,j,b)=results_j_star(i,2);
else
stats_boot(i+1,j,b)=results_j_star(i,2);
end;
end;
end;
stats_boot(N+1,j,b)=results_j_star(end,2);
disp([b j]);
end;
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Computing wild bootstrapped p-values
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for j=1:N;
for i=1:N+1;
stats_boot_i_j=stats_boot(i,j,:);
stats_p_i_j=stats_boot_i_j>results_all(2,j,i);
results_all(3,j,i)=sum(stats_p_i_j)/B;
end;
end;
【问题讨论】:
标签: matlab statistics regression linear-regression