|
Examples / GARCHGIRF.RPF |
GARCHGIRF.RPF is an example of the calculation of a Variance GIRF (Generalized Impulse Response Function) for a multivariate GARCH model. A more detailed example is provided in the Hafner and Herwartz(2006) replication. Note that this is much more complicated than impulse responses for the mean of a process since a variance is naturally non-zero so what constitutes a "shock" is not as clear. (Hafner and Herwartz look at responses to historical episodes). Also, not all typical multivariate GARCH models even admit a Variance GIRF—a DVECH, for instance, has a highly uninteresting Variance GIRF since each component has a separate recursion.
This does the calculations in VECH form.
Full Program
open data g10xrate.xls
data(format=xls,org=columns) 1 6237 usxjpn usxfra usxsui
*
set xjpn = 100.0*log(usxjpn/usxjpn{1})
set xfra = 100.0*log(usxfra/usxfra{1})
set xsui = 100.0*log(usxsui/usxsui{1})
*
garch(p=1,q=1,mv=bekk,pmethod=simplex,piters=10,vechmats=vechcomps) / xjpn xfra xsui
compute vcs=vechcomps("C")
compute vas=vechcomps("A")
compute vbs=vechcomps("B")
*
compute n=%nvar
*
* Solve for the steady-state covariance matrix.
*
compute h0vech=%solve(%identity(%rows(vas))-vas-vbs,vcs)
compute h0=%vectosymm(h0vech,n)
*
compute nstep=20
dec rect[series] girfs(n,n)
do j=1,n
do i=1,n
set girfs(i,j) 1 nstep = 0.0
end do j
*
* Compute the mean of eps given H0 covariance matrix and shock to
* variable j (defined as have a value double the steady-state
* standard deviation) and take its outer product.
*
compute vechirf=h0(j,j)*%vech(%outerxx(%unitv(n,j)))
*
do step=1,nstep
if step==1
compute vechirf=vas*vechirf
else
compute vechirf=(vas+vbs)*vechirf
compute varirf=%vectosymm(vechirf,n)
do i=1,n
compute girfs(i,j)(step)=varirf(i,i)
end do i
end do step
end do j
*
spgraph(vfields=n,hfields=n,header="Variance Responses in GARCH Model",$
xlabels=||"Japan","France","Switzerland"||,ylabels=||"Japan","France","Switzerland"||)
dec vect[series] resp(n)
do i=1,n
compute minlower=maxupper=0.0
do j=1,n
set resp(j) 1 nstep = girfs(i,j)
end do j
table(noprint) 1 nstep resp
compute maxupper=%max(0.0,%maximum)
compute minlower=%min(0.0,%minimum)
do j=1,n
graph(row=i,col=j,max=maxupper,min=minlower)
# girfs(i,j)
end do j
end do i
spgraph(done)
Output
MV-GARCH, BEKK - Estimation by BFGS
Convergence in 86 Iterations. Final criterion was 0.0000086 <= 0.0000100
Usable Observations 6236
Log Likelihood -11821.7457
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Mean(XJPN) 0.005284238 0.005779110 0.91437 0.36052308
2. Mean(XFRA) -0.002360430 0.004150748 -0.56868 0.56957616
3. Mean(XSUI) -0.002505826 0.004919824 -0.50933 0.61051925
4. C(1,1) 0.082827551 0.005082889 16.29537 0.00000000
5. C(2,1) 0.029966933 0.006774462 4.42352 0.00000971
6. C(2,2) 0.055802023 0.004748283 11.75204 0.00000000
7. C(3,1) 0.037995437 0.007654196 4.96400 0.00000069
8. C(3,2) -0.004017902 0.006806450 -0.59031 0.55498413
9. C(3,3) 0.058506480 0.006245748 9.36741 0.00000000
10. A(1,1) 0.359535262 0.012077169 29.76983 0.00000000
11. A(1,2) 0.102691494 0.009048917 11.34848 0.00000000
12. A(1,3) 0.111082248 0.011812194 9.40403 0.00000000
13. A(2,1) 0.038123247 0.014041254 2.71509 0.00662580
14. A(2,2) 0.403444341 0.016261862 24.80923 0.00000000
15. A(2,3) -0.066355330 0.013370391 -4.96286 0.00000069
16. A(3,1) -0.047522551 0.010449514 -4.54782 0.00000542
17. A(3,2) -0.125553482 0.012149506 -10.33404 0.00000000
18. A(3,3) 0.291344292 0.010526939 27.67607 0.00000000
19. B(1,1) 0.935272064 0.003791535 246.67373 0.00000000
20. B(1,2) -0.026717483 0.003105677 -8.60279 0.00000000
21. B(1,3) -0.028574502 0.004086792 -6.99192 0.00000000
22. B(2,1) -0.012475081 0.005562790 -2.24259 0.02492300
23. B(2,2) 0.909746081 0.006295125 144.51597 0.00000000
24. B(2,3) 0.029269416 0.005403727 5.41652 0.00000006
25. B(3,1) 0.016548608 0.004489013 3.68647 0.00022739
26. B(3,2) 0.048830173 0.004991829 9.78202 0.00000000
27. B(3,3) 0.946852761 0.004722801 200.48544 0.00000000
Graph
.png)
Copyright © 2026 Thomas A. Doan