'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

