'replicate example 2.4.1 (pp.23-28)
'Johansen (1995) Likelihood-based Inference in Cointegrated
'Vector Auto-regressive Models, Oxford University Press
'
'version 4
' last checked 10/27/2000 h
'change path to program path
%path = @runpath
cd "{%path}"
'create workfile
workfile denmark q 1974:1 1987:3
'fetch data from database
'data downloaded from johansen's website at
'http://www.math.ku.dk/~sjo/data/data.html
fetch(d=var_dat) lrm lry ibo ide
'create centered seasonal dummies
for !i=1 to 3
series d{!i} = @seas(!i) - 0.25
next
'estimate unrestricted VAR
var var1.ls 1 2 lrm lry ibo ide @ c d1 d2 d3
'replicate residual correlation matrix
'Table 2.4 (p.24)
freeze(tab24) var1.residcor
show tab24
'replicate univariate residual diagnostics
'Table 2.5 (p.25)
'note that Johansen reports *excess* kurtosis relative to 3.0
'also JB statistic does not match; why?
var1.makeresid(name=gres) res1 res2 res3 res4
freeze(tab25) gres.stats
show tab25
'replicate roots in Table 2.6 (p.25)
freeze(tab26) var1.arroots
show tab26
'show roots in unit circle
freeze(gra26) var1.arroots(graph)
show gra26
'replicate auto-correlation functions
'Fig 2.3 (p.28)
'note that eviews graph is transpose of Fig 2.3
freeze(fig23) var1.correl(15,graph)
fig23.options size(4,2)
fig23.align(4,1,1)
show fig23
The program also illustrates how to carry out weak exogeneity tests (by testing zero restrictions on the adjustment coefficients) conditional on restrictions imposed on the cointegrating vector. Currently, EViews only carries out joint restriction tests so you have to manually compute the LR test statistic for conditional tests.
'Johansen cointegration restrictions
'replicate example 7.3.1 (pp.112-116)
'Johansen (1995) Likelihood-based Inference in Cointegrated
'Vector Auto-regressive Models, Oxford University Press
'
'version 4
' last checked 10/27/2000 h
'change path to program path
%path = @runpath
cd "{%path}"
'create workfile
workfile denmark q 1974:1 1987:3
'fetch data from database
'data downloaded from johansen's website at
'http://www.math.ku.dk/~sjo/data/data.html
fetch(d=var_dat) lrm lry ibo ide
'create centered seasonal dummies
for !i=1 to 3
series d{!i} = @seas(!i) - 0.25
next
'estimate VEC with intercept restricted in cointegrating relation
var vec1.ec(b,1) 1 1 lrm lry ibo ide @ d1 d2 d3
'show cointegration test results
'replicates Tables 7.1 (p.113), 7.2 (p.113), 7.3 (p.114)
'note that EViews uses slightly different critical values
'note also that EViews reports *transpose* of Table 7.2
freeze(tab71) vec1.coint(b,1)
show tab71
'show unrestricted cointegrating relation
'replicate Fig 7.1 (left graph)
vec1.makecoint gcoint
freeze(fig71) gcoint.line
fig71.draw(dashline,left) 0.0
show fig71
'-------------------------------------------------------------------------------
'test b1+b2=0
'-------------------------------------------------------------------------------
vec1.cleartext(coint)
vec1.append(coint) b(1,1) + b(1,2) = 0
freeze(test1) vec1.coint(b,1,restrict,c=1e-5,m=100)
show test1
'-------------------------------------------------------------------------------
'test b1+b2=0 and b3+b4=0
'note that this test is different from the test reported in Johansen (p.115)
'which is a test of b3+b4=0 conditional on b1+b2=0
'-------------------------------------------------------------------------------
vec1.append(coint) b(1,3) + b(1,4) = 0
vec1.append(coint) b(1,1) = 1.0
'save restricted logl in mat2 for later use
freeze(test2) vec1.coint(b,1,restrict,c=1e-5,m=100,save=mat2)
show test2
'get restricted cointegrating vector
vec1.ec(b,1,restrict,c=1e-5,m=100) 1 1 lrm lry ibo ide @ d1 d2 d3
matrix cv1 = vec1.@cointvec
show cv1
'-------------------------------------------------------------------------------
'test weak exogeneity a3=a4=0 conditional on b1+b2=0 and b3+b4=0
'-------------------------------------------------------------------------------
vec1.append(coint) a(3,1) = 0
vec1.append(coint) a(4,1) = 0
'joint test on b and a
'save restricted logl of joint test in mat3
freeze(test3) vec1.coint(b,1,restrict,c=1e-5,m=100,save=mat3)
show test3
'compute manually LR statistic for testing a3=a4=0
'conditional on b1+b2=b3+b4=0
'replicates first paragraph of p.116
table out
out(1,1) = "Weak exogeneity test (a3=a4=0) conditional on b1+b2=b3+b4=0"
out(2,1) = "LR statistic = "
!lr = 2.0*(mat2(1,4) - mat3(1,4))
out(2,2) = !lr
out(2,3) = "p-value = "
out(2,4) = 1.0 - @cchisq(!lr,2)
show out