' estimate VAR and forecast
' replicates example in Lutkepohl (1991) pp.70-73, pp.89-91
' 1/7/2000 h
' last checked 10/27/2000 h

'change path to program path
%path = @runpath
cd "{%path}"

' load workfile
load lut1

' estimate VAR
smpl 1960:1 1978:4
var1.ls 1 2 y1 y2 y3 @ c

' replicates p.72, (3.2.22) & (3.2.24)
' note that the variables are ordered differently
freeze(out1) var1.output
show out1

' make model out of estimated VAR
var1.makemodel(mod1)

' change sample to forecast period
smpl 1979:1 1980:1
' solve model to obtain dynamic forecasts
mod1.solve

' plot actual and forecasts
smpl 1975:1 1980:1
for !i=1 to var1.@neqn
	group gtmp y{!i} y{!i}_0
	freeze(gra{!i}) gtmp.line
	%gname = %gname + "gra" + @str(!i) + " "
next

' merge all graphs into one
freeze(gfcst) {%gname}
gfcst.options size(8,2)
gfcst.align(1, 0.1, 0.5)
gfcst.legend position(0.1,0.1)
'gfcst.scale(left) +zeroline
gfcst.draw( dashline,left,rgb(155,155,155) ) 0.0

show gfcst

