*
* Enders, Applied Econometric Time Series, 3rd edition
* Example from Section 5.12, pp 322-324
* Structural VAR
*
calendar(m) 1974:1
open data enders_holt.xls
data(org=cols,format=xls) * 2011:12
*
@varlagselect(lags=12,crit=aic)
# pe ex r pg
display %%autop
*
* 4 variable system
*
system(model=model1)
var pe ex r pg
lags 1 to 4
det constant
end(system)
*
estimate(residuals=resids1,cvout=v,ftests,sigma,noprint)
nonlin g11 g22 g33 g41 g42 g43 g44
dec frml[rect] g_form
frml g_form = ||g11,0.0,0.0,0.0|$
0.0,g22,0.0,0.0|$
0.0,0.0,g33,0.0|$
g41,g42,g43,g44||
*
* Guess values come from a complete factor of the covariance matrix
*
compute gfac=%decomp(v)
*
compute g11=gfac(1,1),g22=gfac(2,2),g33=gfac(3,3)
compute g41=gfac(4,1),g42=gfac(4,2),g43=gfac(4,3),g44=gfac(4,4)
*
cvmodel(factor=g,dmatrix=identity,b=g_form) v
*
nonlin g11 g22 g23 g33 g41 g42 g43 g44
frml g_form = ||g11,0.0,0.0,0.0|$
0.0,g22,g23,0.0|$
0.0,0.0,g33,0.0|$
g41,g42,g43,g44||
*
* We use the previous model estimates, then zero out g23 to start
*
compute g23=0.0
*
cvmodel(factor=g,dmatrix=identity,b=g_form) v
*
errors(model=model1,steps=24,factor=g)
impulse(model=model1,steps=24,factor=g,result=impulses)
*
* Scale responses to be relative to own shock size
*
set i1 = impulses(4,1)/impulses(4,4)
set i2 = impulses(4,2)/impulses(4,4)
set i3 = impulses(4,3)/impulses(4,4)
graph(footer="Figure 5.9 Responses of Grain to the Three Shocks",$
key=below,nokbox,number=0,$
klab=||"Energy","Ex Rate","Tbill"||,vlabels="standard deviations") 3
# i1
# i2
# i3