JOHANSE.EXP

Published by @alf on 2017-12-12

@ JOHANSE.EXP for Johansen’s Rank Test @
@ Written by Kyungho Jang (Last Reviseion by Jang: 11/12/2001) @
new;
@**************** Start of Modification ****************@
@ *************************************************************** @
@ ---------------- Step 1: Specifiy Output File ----------------- @
@ *************************************************************** @
outfile = "johansen.out";
@ *************************************************************** @
@ ---------------- Step 2: Prepare the Data --------------------- @
@ *************************************************************** @
@ 1. Reading in data @
load dat[176,3] = sample2.dat;     @ nondurables, duralble goods, price @
@ 2. Specify the series for test @
nondurab = ln(dat[1:176,1]); @ Define the series for CCR @
durable = ln(dat[1:176,2]); @ Define the series for CCR @
price = ln(dat[1:176,3]); @ Define the series for CCR @
@ *************************************************************** @
@ ---------------- Step 3: Define variables and parameters ------ @
@ *************************************************************** @
@ Define variables @
yi1 = price~nondurab~durable; @ Specify endogenous I(1) varibales @
yi0 = 0;   @ Specify stationary variables, otherwise set yi0=0 @
xi1nc = 0; @ Specify I(1) exogenous variables, otherwise set xi1nc=0 @
xi1ci = 0; @ Specify I(1) exogenous variables, otherwise set xi1ci=0 @
xi0 = 0;   @ Specify I(0) exogenous variables, otherwise set xi0=0 @
dum = 0;   @ Specify dummy variables, otherwise set dum=0 @
sflag = 0; @ 1 = Seasonal Dummy (Centered), 0 = No Seasonal @
@ Set parameters for estimation @
varlag=6;
freq = 4;
n = 3;
r = 1;
k=n-r; @#ofcommontrends@
let bn[1,1] = 1; @ r x 1, Normalization of cointegrating Vector @ let names = P2 C1 C2; @ Labels of variables @
conf_lev = 95; @ Confidence intervals for the rank test @
              @ Availables for 50%, 75%, 80%, 85%, 90%, 95%, 97.5%, 99% @
hflag = 3;   @ Johansen Model @
     @ 1 = H(r)  : Quadratic Trend @
     @ 2 = H*(r) : Linear Trend @
     @ 3 = H1(r) : Linear Trend, Deterministic Cointegration @
     @ 4 = H1*(r): No Trend, Det’c Cointegration @
     @ 5 = H2(r) : No Trend, No Constant, Det’c Cointegration @
@ Set control parameters for data @
mtag = 1; @ Cointegrating Vectors: 1 = Unrestricted, 2 = Restricted @
ptag = 0;    @ 1 = print detailed output, 0 = No print @
if mtag == 2;
    @ Restrictions on Beta : H*phi = Beta @
        let h1[3,1] = 1
                     -1
                      1; @ n x (n-q), q: # of restrictions @
h = h1;
letngv=1; @#ofvectoroneachgroup@
let rgv = 2; @ # of restrictions on each group @ sgv=n-rgv; @#ofcolumnoneachHmatrics@
endif;
@ *************************************************************** @
@ ----------------        End of Modification         ----------- @
@ *************************************************************** @
@ThelaglengthofVAR:DGP-6,9,12,13@
 @ Frequency: 4 = Quarterly, 12 = Monthly @
@ # of variables @
@ # of cointegrating vectors @
output file = ^outfile reset;
outfile;
datestr(0);
timestr(0);
#include johansen.set;
@ Define the Table for Trace Test @
if hflag == 2;
   names = "trend"|names;
elseif hflag == 4;
   names = "const"|names;
endif;
{z0,zk,z1,ctag,ttag} = trans(yi1,yi0,xi1nc,xi1ci,xi0,dum,varlag,hflag,sflag,freq);
n = cols(z0);
t = rows(z0);
{s00,s0k,skk} = rfu(z0,zk,z1);
format /rdn 14,4;
"*********** The rank tests ***********";
{va,ve} = evnorm(n,s00,s0k,skk,symm);
ranktst(va,ve,t,names,hflag,conf_lev);
"*********** Estimating alpha and pi ***********";
{va,ve} = evnorm(r,s00,s0k,skk,symm);
"* Unrestricted beta (normalized)";
{va,ve} = betanorm(va,ve,bn,names);
betaun = ve;
beta = betaun;
if mtag == 1;
   beta = betaun;
elseif mtag == 2;
   if rows(ngv) == 1;
{s00,s0k_h,h_skk_h,h} = rfhhflag(z0,zk,z1,h,hflag);
{va,ve} = evnorm(r,s00,s0k_h,h_skk_h,symm);
beta = h*ve;
   else;
{beta} = rfghflag(z0,zk,z1,h,betaun,ngv,rgv,hflag);
endif;
endif;
"";
"* Estimation of parameters using given beta";
{beta,alpha,pi0,talpha,tpi0} = esthflag(va,beta,bn,s00,s0k,skk,t,names,hflag);
end;

2015-2018 Mokum.place