VARIRF Procedure |
@VARIRF organizes the graphs of an impulse response function from an already estimated VAR. This does only the point estimates—if you want to do error bands, you will have to use @MonteVAR for relatively simple models or some more complicated sampling or bootstrapping process for more complicated ones. Examples of the more involved methods are are MONTESVAR.RPF for a structural VAR, MONTESUR.RPF for a near-VAR and MONTEVECM.RPF for a Vector Error Correction Model.
@VARIRF(model=VAR model,other options) (no parameters)
Options
MODEL=VAR model whose IRF's are to be calculated
FACTOR=Factor of the covariance matrix [Cholesky of %SIGMA]
STEPS=number of forecast steps[48]
SHOCKLABELS=VECT[STRINGS] of labels for the shocks [dependent variables]
VARLABELS=VECT[STRING] of labels for the variables [dependent variables]
HEADER="title for graph"
FOOTER="footer for graph"
PAGE=[ALL]/ONE/BYSHOCK/BYVARIABLE
COLUMNS=# of columns on a page [depends upon number of graphs]
The PAGE option selects the layout of a single page of graphs.
PAGE=ALL (the default) does all responses to all shocks on a single page (shocks in columns, dependent variables in rows). Note that the panes get a bit small when you get more than four variables.
PAGE=ONE does one combination of shock and variable per page.
PAGE=BYSHOCK does a separate page for each shock, with all responses arranged in one or more columns.
PAGE=BYVARIABLE does a separate page for each variable, with all shocks arranged in one or more columns.
ERRORS/[NOERRORS]
Produce a forecast error variance decomposition
ACCUMULATE=||vector of positions||
Indicates which variables (by position in the model) need to be accumulated (integrated)
INCLUDE=||list of dependent variables to show (in order, by position in model)|| [all]
INCLUDE can be used to eliminate some variables which aren't of special interest or to rearrange the panes on a graph. For instance, in a 6 variable VAR, INCLUDE=||6,1,3,4|| will show only the responses of those four variables (based upon their positions in the model) and will put the 6th variable in the top left.
Examples
This is a simple two variable VAR which does Cholesky factor shocks, with a separate graph page for each variable (using the standard variable names of "starts" and "completions").
system(model=varmodel)
variables starts completions
lags 1 to 4
det constant
end(system)
*
estimate(ftests) * 1991:12
@varirf(model=varmodel,steps=36,page=byvariable,errors)
This is a four variable VAR with a structural factorization computed using short-and long-run restrictions. Because it has structural shocks, we need labels for them (SHOCKS option, short for SHOCKLABELS), and we also relabel the variables themselves (VARIABLES option). This does the default arrangement which is a page with a 4 x 4 array of graphs (arranged by variables reading across and shocks down). The first three variables are put in the VAR in growth rates, but the ACCUM option is used to accumulate them (just 1, 2 and 3, not 4 which are interest rates) up to (log) levels. (The graph produced is shown below).
set trend = t
system(model=peersman)
variables groil grout grp r
lags 1 2 3
det constant trend
end(system)
*
estimate(sigma) 1979:5 *
*
dec rect lr(4,4) sr(4,4)
*
* Shock order is oil, AS, AD, money
*
input lr
. . . .
. . 0 0
. . . .
. . . .
input sr
. 0 0 0
. . . 0
. . . .
. . . .
*
@shortandlong(factor=f,lr=lr,sr=sr,masum=inv(%varlagsums)) %sigma
disp "Impact Responses" f
disp "Long-Run Responses" inv(%varlagsums)*f
*
* The responses of the three growth variables are accumulated
* (accum=||1,2,3|| option). Both shocks and variables are given
* meaningful labels.
*
@varirf(shocks=||"Oil Price","Supply Shock","Demand Shock","Money Shock"||,$
variables=||"Oil Price","Output","Price","Interest Rate"||,$
steps=40,model=peersman,factor=f,accum=||1,2,3||,$
footer="Figure 14.6 Impulse responses of the Peersman model of the U.S.")
Graph
Copyright © 2025 Thomas A. Doan