Impulse responses and variance decompositions Impulse response functions show the effects of shocks on the adjustment path of the variables. Forecast error variance decompositions measure the contribution of each type of shock to the forecast error variance. Both computations are useful in assessing how shocks to economic variables reverberate through a system. Impulse response functions (IRFs) and forecast error variance decompositions (FEVD) can be produced after using the varbasic command. The results can be presented in a table or a graph. In this example we illustrate both. After the varbasic command, we use the irf table command to generate IRFs and FEVDs: use fred, clear varbasic D.lc D.ly, lags(1/1) step(12) nograph valmar Sample: 1960q3 Log likelihood = FPE = Det(Sigma_ml) = Equation 2009q4 1400.444 2.62e-09 2.46e-09 Parms D_lc D_ly 3 3 Coef. No. of obs AIC HQIC SBIC RMSE .006575 .008562 R-sq chi2 P>chi2 0.1205 0.1118 27.12459 24.92656 0.0000 0.0000 = 198 = -14.0853 = -14.04496 = -13.98565 Std. Err. z P>|z| [95% Conf. Interval] D_lc lc LD. .2156068 .0741801 2.91 0.004 .0702164 .3609972 ly LD. .1493798 .0572953 2.61 0.009 .0370832 .2616765 _cons .0052776 .0007516 7.02 0.000 .0038046 .0067507 lc LD. .4754276 .0965863 4.92 0.000 .286122 .6647332 ly LD. -.2171679 .0746013 -2.91 0.004 -.3633839 -.070952 _cons .0060367 .0009786 6.17 0.000 .0041187 .0079547 D_ly . varlmar Lagrange-multiplier test lag chi2 df 1 2 9.5086 5.6784 4 4 Prob > chi2 0.04957 0.22449 H0: no autocorrelation at lag order Pick lag lengths using varsoc. . varsoc D.lc D.ly, maxlag(4) Selection-order criteria Sample: 1961q2 - 2009q4 lag 0 1 2 3 4 LL LR 1355.02 1379.09 1383.92 1388.24 1391.6 Endogenous: Exogenous: 48.129 9.6655* 8.6379 6.7149 Number of obs df p 4 4 4 4 0.000 0.046 0.071 0.152 FPE 3.2e-09 2.6e-09 2.6e-09 2.6e-09* 2.6e-09 AIC -13.8772 -14.083 -14.0915 -14.0948* -14.0882 = HQIC -13.8636 -14.0422* -14.0235 -13.9996 -13.9659 195 SBIC -13.8436 -13.9823* -13.9237 -13.8598 -13.7861 D.lc D.ly _cons Only the FPE picks a lag longer than one. Now run the VAR again with a single lag and limit the step forecasts to 12 (that is plenty for these data). qui varbasic D.lc D.ly, lags(1/1) step(12) irf table irf irf table fevd The syntax for irf table is: irf table [stat] [, options] where stat can be any of the following: irf oirf dm cirf coirf cdm fevd sirf sfevd impulse-response function orthogonalized impulse-response function dynamic-multiplier function cumulative impulse-response function cumulative orthogonalized impulse-response function cumulative dynamic-multiplier function Cholesky forecast-error variance decomposition structural impulse-response function structural forecast-error variance decomposition The results from the IRF and FEVD tables are: . irf table irf Results from varbasic (1) irf step 0 1 2 3 4 5 6 7 8 9 10 11 12 1 .215607 .117506 .025224 .013808 .002951 .001623 .000345 .000191 .00004 .000022 4.7e-06 2.6e-06 (3) irf step 0 1 2 3 4 5 6 7 8 9 10 11 12 95% (1) (2) (3) (4) 0 .14938 -.000233 .017604 -.000055 .002075 -9.7e-06 .000244 -1.5e-06 .000029 -2.2e-07 3.4e-06 -3.2e-08 lower and irfname = irfname = irfname = irfname = (1) Lower 1 .070216 .042463 -.014994 -.003806 -.004713 -.001478 -.000905 -.000295 -.000148 -.000049 -.000022 -7.4e-06 (3) Lower 0 .037083 -.027858 -.000946 -.006566 -.001028 -.001161 -.000241 -.000182 -.000043 -.000027 -6.9e-06 -3.8e-06 (1) Upper (2) irf 1 .360997 .192549 .065442 .031422 .010615 .004723 .001595 .000676 .000228 .000094 .000032 .000013 0 .475428 -.000742 .056027 -.000175 .006603 -.000031 .000778 -4.9e-06 .000092 -7.2e-07 .000011 -1.0e-07 (3) Upper (4) irf 0 .261676 .027392 .036153 .006456 .005177 .001141 .00073 .000179 .000101 .000026 .000014 3.7e-06 1 -.217168 .118181 -.025776 .013967 -.003059 .001651 -.000363 .000195 -.000043 .000023 -5.1e-06 2.7e-06 upper bounds reported varbasic, impulse = D.lc, varbasic, impulse = D.lc, varbasic, impulse = D.ly, varbasic, impulse = D.ly, and and and and response response response response (2) Lower 0 .286122 -.088665 .007234 -.020898 -.002593 -.003694 -.000719 -.000581 -.000134 -.000086 -.000022 -.000012 (4) Lower = = = = 1 -.363384 .043031 -.066356 -.003818 -.010845 -.001506 -.001642 -.000303 -.000237 -.000051 -.000033 -7.7e-06 (2) Upper 0 .664733 .087181 .104819 .020548 .015799 .003632 .002275 .000571 .000317 .000084 .000043 .000012 (4) Upper 1 -.070952 .193332 .014804 .031752 .004726 .004807 .000916 .000693 .000151 .000097 .000023 .000013 D.lc D.ly D.lc D.ly The results appear in four quadrants and a key is given at the bottom of the table. In quadrant one (northwest) is the response in ln(RCPE) to a shock in itself. You’ll remember that this series is stationary and therefore shocks are not persistent; their effects eventually die out. Shocks to ln(RPDI) are not persistent either. More interesting is how ln(RPDI) responds to shocks in the ln(RCPE), and vice versa. Quadrant 2 (northeast) shows a shocks to ln(RCPE) affects ln(RPDI) for one period, but dies out very quickly. Shocks to the ln(RRDI) create a smaller, but significant response in ln(RCPE) (quadrant 3), though once again if falls to zero very quickly. A separate command called irf graph basically does the same thing as irf table, except the results appear as a graph rather than in tabular form. irf graph varbasic, D.lc, D.lc varbasic, D.lc, D.ly varbasic, D.ly, D.lc varbasic, D.ly, D.ly 1 .5 0 -.5 1 .5 0 -.5 0 5 10 15 0 5 10 15 step 95% CI impulse response function (irf) Graphs by irfname, impulse variable, and response variable This is merely the data produced by irf table in graphical form. It should also be noted that these graphs are actually produced automatically by varbasic. Recall that we used the nograph option, which suppresses the graphs. As this shows, the graphs in memory can be summoned later if desired. Like the impulse responses, the FEVDs can be produced in either tabular or graphical form. The commands are, respectively: irf table fevd irf graph fevd The results are arranged in the same way, by quadrant with a key at the bottom. . irf table fevd Results from varbasic step 0 1 2 3 4 5 6 7 (1) fevd 0 1 .97297 .973298 .972967 .972972 .972967 .972967 (1) Lower (1) Upper 0 1 .932729 .933619 .93271 .932723 .932709 .932709 0 1 1.01321 1.01298 1.01322 1.01322 1.01323 1.01323 (2) fevd 0 .198552 .2438 .243198 .243752 .243743 .24375 .24375 (2) Lower (2) Upper 0 .099067 .146908 .145308 .145393 .145351 .145347 .145346 0 .298037 .340692 .341087 .34211 .342135 .342153 .342154 (3) fevd step 0 1 2 3 4 5 6 95% (1) (2) (3) (4) 0 0 .02703 .026702 .027033 .027028 .027033 lower and irfname = irfname = irfname = irfname = (3) Lower (3) Upper 0 0 -.013212 -.012977 -.013225 -.01322 -.013225 0 0 .067271 .066381 .06729 .067277 .067291 upper bounds reported varbasic, impulse = D.lc, varbasic, impulse = D.lc, varbasic, impulse = D.ly, varbasic, impulse = D.ly, and and and and (4) fevd 0 .801448 .7562 .756802 .756248 .756257 .75625 response response response response = = = = (4) Lower (4) Upper 0 .701963 .659308 .658913 .65789 .657865 .657847 0 .900933 .853092 .854692 .854607 .854649 .854653 D.lc D.ly D.lc D.ly And graph varbasic, D.lc, D.lc varbasic, D.lc, D.ly varbasic, D.ly, D.lc varbasic, D.ly, D.ly 1 .5 0 1 .5 0 0 5 10 15 0 5 10 15 step 95% CI fraction of mse due to impulse Graphs by irfname, impulse variable, and response variable The tabulation and graphing functions in Stata for IRFs and FEVDs are really very flexible. You can combine tables, overlay graphs, and do many other things using either the language or the dialog boxes. Choose Statistics > Multivariate time series > IRF and FEVD analysis to reveal the final box: Here you have a number of choices including the ones we’ve just discussed. However, you can also use these dialogs to overlay graphs, combine graphs, or select specific portions of the tables or graphs to use in your output. Feel free to experiment!
© Copyright 2026 Paperzz