* * Enders, Applied Econometric Time Series, 3rd edition * Example from pp 173-174 * Multivariate GARCH, Volatility Impulse Response Function (VIRF) * * This uses the same data set as p169. * open data exratesdaily.xls calendar(d) 2000:1:3 data(format=xls,org=columns) 2000:01:03 2013:04:26 euro pound sw * * Replace missing values in the exchange rates by the last observed value. * set euro = %if(%valid(euro),euro,euro{1}) set pound = %if(%valid(pound),pound,pound{1}) set sw = %if(%valid(sw),sw,sw{1}) * * Flip the order on the Swiss Franc * set sw = 1/sw * * We generally recommend that the returns be multiplied up by 100, which * changes the scales on the variances by 10000. This puts the * coefficients in the GARCH within a few orders of magnitude of 1, which * makes them easier to read. It also makes it easier to estimate the * model. Note that this doesn't affect the lagged variance or lagged * squared residual terms in the GARCH specification; just the means * (which will be higher by x 100) and the constants in the GARCH, which * will be higher by x 10000. * set reuro = 100.0*log(euro/euro{1}) set rpound = 100.0*log(pound/pound{1}) set rsw = 100.0*log(sw/sw{1}) * * This uses only the Euro and UK pound * garch(mv=BEKK,rvectors=rd,hmatrices=hh,\$ pmethod=simplex,piters=20,iters=500) / reuro rpound * Transform the BEKK model to its equivalent VECH representation * @MVGARCHtoVECH(mv=BEKK) eigen(cvalues=cv) %%vech_a+%%vech_b disp "Eigenvalues from BEKK-t" *.### cv * * VIRF with historical incidents * Financial Crisis shocks. These are computed using a baseline of the * estimated volatility state, so they are excess over the predicted * covariance. * * This generates responses for the 3 elements of the covariance matrix, * which will be (in order) the (1,1),(1,2) and (2,2). * dec vect[series] fincrisisvirf(3) compute nstep=400 do i=1,3 set fincrisisvirf(i) 1 nstep = 0.0 end do i compute fincrisis=2008:10:29 compute eps0=rd(fincrisis) compute sigma0=hh(fincrisis) compute shock=%vec(%outerxx(eps0)-sigma0) do step=1,nstep if step==1 compute hvec=%%vech_a*shock else compute hvec=(%%vech_a+%%vech_b)*hvec compute %pt(fincrisisvirf,step,hvec) end do step move fincrisisvirf(1) 1 nstep f1 (2008:10:29)+1 move fincrisisvirf(2) 1 nstep f2 (2008:10:29)+1 move fincrisisvirf(3) 1 nstep f3 (2008:10:29)+1 spgraph(vfields=3,hfields=1,\$ footer="Figure 3.17 Variance Impulse Responses from Oct. 29, 2008") graph(vticks=5,hlabel="Panel a: Volatility Response of the Euro",noaxis,max=0.4,min=0.) # f1 graph(vticks=5,hlabel="Panel b: Response of the Covariance") # f2 graph(vticks=5,hlabel="Panel c: Volatility Response of the Pound") # f3 spgraph(done) * * Now shock only one variable * com eps0(1) = 0. compute sigma0=hh(fincrisis) compute shock=%vec(%outerxx(eps0)-sigma0) do step=1,nstep if step==1 compute hvec=%%vech_a*shock else compute hvec=(%%vech_a+%%vech_b)*hvec compute %pt(fincrisisvirf,step,hvec) end do step move fincrisisvirf(1) 1 nstep f1 (2008:10:29)+1 move fincrisisvirf(2) 1 nstep f2 (2008:10:29)+1 move fincrisisvirf(3) 1 nstep f3 (2008:10:29)+1 spgraph(vfields=3,hfields=1,\$ footer="VIRF to isolated shock only in Euro") graph(vticks=5,hlabel="Panel d: Response of Euro",noaxis) # f1 graph(vticks=5,hlabel="Panel e: Response of Covariance") # f2 graph(vticks=5,hlabel="Panel f: Response of Pound") # f3 spgraph(done)