reverse-shooting

Matlab scripts for reverse shooting
Log | Files | Refs | README

adf.m (1049B)


      1 % ADF.m    adf(y,x,lag)
      2 %     Augmented Dickey-Fuller test on y
      3 %	x=deterministic component
      4 %	lag=# of lagged changes to include.
      5 
      6 function [b,ts,ic] = adf(y,x,lag,TF);
      7 
      8 [y ylag] =lagx(y,1);
      9 if lag==0;
     10 	x=x(2:length(x),:);
     11 	rhs=[x ylag];
     12 else;
     13 	[d1 d2]=lagx(delta(ylag),lag-1);
     14 	dylag=[d1 d2];
     15 	begn=length(y)-length(dylag)+1;    % Correct size of y and ylag
     16 	y=y(begn:length(y));
     17 	ylag=ylag(begn:length(ylag));
     18 	x=x(begn+1:length(x),:);
     19 	rhs=[x ylag dylag];
     20 end;
     21 
     22 disp ' ';
     23 tle = 'Augmented Dickey-Fuller (1979) Test';
     24 depv= 'Delta Y';
     25 [rw colm] = size(x);
     26 indv= [vdummy('X',colm); 'YLag    '; vdummy('DYLag',lag)];
     27 
     28 [u,N,K,stdest,b,vcv] = ols(y-ylag,rhs,tle,depv,indv);
     29 ts=b./sqrt(diag(vcv));
     30 sigma2=stdest^2;
     31 if TF==0; TF=length(y); end;
     32 hqic=zeros(1,3);
     33 sic     = log(sigma2) + lag*log(TF)/TF;
     34 hqic(1) = log(sigma2) +lag*2*1.0*log(log(TF))/TF;
     35 hqic(2) = log(sigma2) +lag*2*1.5*log(log(TF))/TF;
     36 hqic(3) = log(sigma2) +lag*2*2.0*log(log(TF))/TF;
     37 disp 'Information Criteria:  SIC HQIC(1)(1.5)(2)';
     38 ic = [sic hqic];
     39 fprintf(1,'%8.4f',ic);
     40 disp ' ';