reverse-shooting

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

arxc.m (1106B)


      1 % ARXc.m    arxc(y,nlag,X,Xlag,Xname,TF,tyes)
      2 %	Estimates the dynamic model
      3 %	  y = a + A(L)y(-1) + B(L)X + e
      4 %	where A(L) is of order ylag.
      5 %	Note:  X is TxK matrix and xlag is a 1xK vector of lags...
      6 %	and   B(L) is of order xlag+1.
      7 
      8 function [u,N,K,stdest,b,vcv,ic] = arxc(y,nlag,X,Xlag,Xname,TF,tyes);
      9 
     10 [T K] = size(X);
     11 lags=nlag+sum(Xlag);
     12 data  = mlag([y X],[nlag Xlag]);
     13 [rw cl] = size(data);
     14 y=data(:,1);
     15 ylag=data(:,2:nlag+1);		
     16 X=data(:,nlag+2:cl);
     17 
     18 % We've got the data, now construct the lag varnames and run OLS
     19 names=vdummy('YLag',nlag);
     20 
     21 for i=1:K;
     22 	names=[names; Xname(i,:); vdummy(Xname(i,1:4),Xlag(i))];
     23 end;
     24 names=['Constant'; names];
     25 
     26 rhs=[ones(length(y),1) ylag X];
     27 tle='ARX Dynamic Model';
     28 [u,N,K,stdest,b,vcv] = ols(y,rhs,tle,'Y',names);
     29 
     30 % Information Criteria
     31 sigma2=stdest^2;
     32 hqic=zeros(1,3);
     33 sic=log(sigma2)+lags*log(TF)/TF;
     34 hqic(1) = log(sigma2) +lags*2*1.0*log(log(TF))/TF;
     35 hqic(2) = log(sigma2) +lags*2*1.5*log(log(TF))/TF;
     36 hqic(3) = log(sigma2) +lags*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 ' ';