pantrend.m (826B)
1 % pantrend.m x=pantrend(y,lags,detx); 2 % Similar to panlag.m, except merely computes a common trend (detx==3) 3 % or country-specific trends (detx==4) with the lengths determined by 4 % the underlying data in y. (detx==5) ==> time dummies. 5 % 6 % Note: the key is adjusting for missing values in y ==> see panlag. 7 % 8 % terms=1 ==> linear trend 9 % terms=2 ==> quadratic trend 10 11 12 function x=pantrend(y,lags,detx,terms); 13 14 if exist('terms')~=1; terms=1; end; 15 16 N = size(y,2); 17 for i=1:N; % Loop over Countries = N 18 T=length(packr(y(:,i)))-lags; 19 if detx==3; 20 if terms==1; x=[x; demean((1:T)')]; 21 elseif terms==2; x=[x; [demean((1:T)') demean(((1:T).^2)')]]; 22 end; 23 elseif detx==4; 24 x=[x; [zeros(T,i-1) demean((1:T)') zeros(T,N-i)]]; 25 elseif detx==5; % Time dummies 26 x=[x; eye(T)]; 27 end; 28 end %i