* * GARCHVIRFDIAG.RPF * Example of computing the Volatility Impulse Response (VIRF) for a GARCH model * which doesn't have a "VECH" form. * 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}) * dec vect[strings] glabels(3) compute glabels=||"Japan","France","Switzerland"|| * * This can be applied to models estimated with restricted correlations * (CC or DCC), with VARIANCES=SIMPLE (default), SPILLOVER or VARMA. It * does not work with VARIANCES=EXPONENTIAL or KOUTMOS as those don't * have closed-form variance extrapolations. * garch(p=1,q=1,mv=cc,variances=spillover,pmethod=simplex,piters=20,hmatrices=hh,rvectors=rv) / xjpn xfra xsui * * This pulls the matrices for a variance recursion out of the output * from the GARCH model. Do this immediately after the GARCH instruction * and repeat the VARIANCES option. * @MVGARCHVarMats(variances=spillover) * * Compute VIRF at t=1241 * compute t0=1241 compute eps0=rv(t0).^2 compute sigma0=%xdiag(hh(t0)) * compute shock=eps0-sigma0 * compute nstep=100 * dec vect[series] virf1241(%nvar) do i=1,%nvar set virf1241(i) 1 nstep = 0.0 end do i * do step=1,nstep if step==1 compute hvec=%%var_a*shock else compute hvec=(%%var_a+%%var_b)*hvec compute %pt(virf1241,step,hvec) end do step * spgraph(vfields=%nvar,ylabels=glabels,header="VIRF to Shock at 1241") do i=1,%nvar graph(min=0.0,column=1,row=i,picture="*.###",vticks=5) # virf1241(i) 1 nstep end do i spgraph(done)