Today, let me update a previous blog of mine to show you how to retrieve the series for the impulses response functions, the forecast error variance decompositions, and historical decompositions. We will use the ‘Long-run Zero Restrictions’ example. I encourage you to read the following blog before diving into this one:
We are going to retrieve the series for the following results:
Impulse Response Function
Forecast Error Variance Decomposition
Historical Decomposition
After running the code for the ‘Long Run and Zero Restriction’ use the following code to store the results into series in Stata:
// List the matrix in memory
mat dir

Let us start with the IRF[40,4] matrix, the estimates show the IRF for the reaction of GDP growth and Unemployment to GDP Growth shocks (IRF 1 and 2). Besides, we also have the reaction of GDP growth and Unemployment to Unemployment shocks (IRF 3 and 4):
mat list IRF
svmat double IRF

The series for the FEDV and their confidence bands can be obtained in the following way:
mat list FEVD
svmat double FEVD
mat list inf_mat_temp
svmat double inf_mat_temp
mat list sup_mat_temp
svmat double sup_mat_temp

Finally, the series for the historical decompositions can be obtained using the following code snippet:
list hdmat_temp*

For the IRF confidence bands, run the program with only the IRF band function in the mata part:
mata
// only plot GDP growth
opts.shck_plt = "GDPGrowth"
// compute IRF, bands, plot
IRFB = irf_bands_funct(VAR,opts)
irf_plot(IRF,IRFB,VAR,opts)
end
Then, convert the matrixes into Stata series:
// List the matrix in memory
mat dir
// Create variables
mat list inf_mat_temp
svmat double inf_mat_temp
mat list sup_mat_temp
svmat double sup_mat_temp


A last point underlined by Matteo Falagiarda, consider to replace IRF = irf_funct(VAR,opts)
by sr_analysis_funct("irf",SR,opts)
if you are using models involving sign and narrative restrictions.
As we have seen in this blog, this toolbox allows estimating sign and narrative restrictions in Stata. The files for replicating this blog are available on my GitHub.