panall.m (1035B)
1 % PANALL.m [rrho,rts]=panall(y,name,maxlag,tyes,all) 2 % Calls the ADF procedure for a series of countries/lags 3 % y: TxK matrix T years, K countries 4 % name: Name for dataset: 1 string 5 % maxlag: Max # of lags to include 6 % detx: 0=nothing 1=constant 2=fixed effects 7 % all: all=0 ==> print only min(SIC) else print all 8 9 function [rrho,rts] = panall(y,name,maxlag,detx,all); 10 11 [T K] = size(y); 12 fmt = '%4.0f %8.4f %8.4f %8.2f %8.2f %8.4f %8.4f %8.4f %8.4f'; 13 rrho=zeros(K,1); 14 rts =zeros(K,1); 15 fprintf([name(1,:) ' ']); 16 TF=T-maxlag; 17 rho=[]; tstat=[]; infc=[]; 18 for j=0:maxlag; 19 diary off; 20 [be ts tsll1 tsll2 ic] = panadf(y,j,TF,detx); 21 diary on; 22 rho=[rho; be]; 23 tstat=[tstat; ts tsll1]; 24 infc =[infc; ic]; 25 end; % j=Lags 26 if all; 27 disp ' '; 28 fprintf(1,fmt,[0:maxlag rho tstat infc]); disp ' '; 29 else; 30 [ic,k]=min(infc(:,1)); 31 fprintf(1,fmt,[k-1 rho(k,:) tstat(k,:) infc(k,1)]); 32 if detx==3; 33 fprintf('%8.4f %8.2f',infc(k,2:3)); 34 end; 35 rrho=rho(k,:); 36 rts =tstat(k,:); 37 end; % if all 38 disp ' '; 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54