from Weak form market efficiency tests by Anis Ben Hassen
market efficiency tests

[CD1,CD2,p1,p2]=chow_test(X,l)
function [CD1,CD2,p1,p2]=chow_test(X,l)
% -----------------------------------------------------------------
% 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:
% CD1 and CD2 are the statistics of chow and denning joint variance
% ratio test under the homoscedastic and heteroscedastic assumptions
% respectively
% p1 and p2 are p-values under approximative normal distribution
%******************************************************************
% Input:
% X: a time series matrix with column variables and row observations 
% l: an integer representing the total number of VR to test jointly
% (S in paper)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[T,N]=size(X);
z1=zeros(l,N);
z2=z1;
for j=1:N,
    for i=2:l+1,
        [vr,z1(i-1,j),z2(i-1,j)]=vrt(X(:,j),i);
    end
end
alpha=norminv(1-.5*(1-.95^(1/l)));
CD1=max(abs(z1));
CD2=max(abs(z2));
p1=CD1>=alpha;
p2=CD2>=alpha;

Contact us at files@mathworks.com