reverse-shooting

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

panlag.m (639B)


      1 % PanLag.m    panlag(y,lag,mean0):  The panel data equivalent of LAGX
      2 %    	
      3 %	y:   A TxN matrix of data (T years  N countries)
      4 %  Return:   N*(T-lag)x(1+lag) matrix 
      5 %
      6 %	Notice that the return is stacked and ready to be included
      7 % 	in a regression.  Deletes missing values by column...
      8 
      9 function [sy,sylag] = panlag(y,lag,mean0);
     10 
     11 sylag=zeros(1,lag);			% We will stack things here
     12 sy   =zeros(1,1);
     13 [T N] = size(y);
     14 for i=1:N;				% Loop over Countries = N
     15 	[s1 s2] = lagx(packr(y(:,i)),lag);
     16 	if mean0; 
     17 		s1=demean(s1); s2=demean(s2);
     18 	end; % demeaning
     19 	sy=[sy; s1];
     20 	sylag = [sylag; s2];
     21 end %i
     22 if lag~=0; sylag(1,:)=[]; end;
     23 sy(1)=[];