function res=wild_boot(X,l,n)
% -----------------------------------------------------------------
% Elaborated by : BEN HASSEN Anis
% "Institut Suprieur de Gestion de Tunis" (ISG Tunis)
% University of Tunis
% 41, rue de la Libert - Cit Bouchoucha - C.P. : 2000 Le Bardo
% Tunisia
% University e-mail: http://www.isg.rnu.tn/
% Personal e-mail: benhassenanis@yahoo.com
% _________________________________________________________________
% January 14, 2004.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Output:
% res: a matrix which first and third columns correspond to the statistics
% of the joint version of the variance ratio test for the homoscedasctic
% and heteroscedastic assumptions respectively (CD1 and CD2 in paper), and
% which second and fourth columns are the corresponding p-values under the
% RW null hypothesis.
%******************************************************************
% Input:
% X: a matrix of time series (prices Pt) with variables in columns and
% observations in rows.
% l: >1 representing the total number of VR to test jointly
% (S in paper)
% n: number of wild bootstrap simulations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
t=cputime;
[MV1,MV2]=chow_test(X,l);
[T,N]=size(X);
X0=X(1,:);
R=diff(log(X));
Mv1=zeros(N,n);
Mv2=Mv1;
for i=1:n,
z=randn(T-1,N);
Rb=z.*R;
Xb=ret2price(Rb,X0);
[Mv1(:,i),Mv2(:,i)]=chow_test(Xb,l);
end
for i=1:N,
p1(i)=1/n*sum(Mv1(i,:)>MV1(i));
p2(i)=1/n*sum(Mv2(i,:)>MV2(i));
end
p1=p1';
p2=p2';
res=[MV1',p1,MV2',p2];
Time_elapsed=cputime-t