irf
Generate vector autoregression (VAR) model impulse responses
Description
The irf
function returns the dynamic response, or the impulse response
function (IRF), to a one-standard-deviation shock to each variable in a VAR(p)
model. A fully specified varm
model object characterizes the VAR
model.
To estimate or plot the IRF of a dynamic linear model characterized by structural,
autoregression, or moving average coefficient matrices, see armairf
.
IRFs trace the effects of an innovation shock to one variable on the response of all
variables in the system. In contrast, the forecast error variance decomposition (FEVD)
provides information about the relative importance of each innovation in affecting all
variables in the system. To estimate the FEVD of a VAR model characterized by a
varm
model object, see fevd
.
uses additional options specified by one or more name-value pair arguments. For example,
Response
= irf(Mdl
,Name,Value
)'NumObs',10,'Method',"generalized"
specifies estimating a generalized
IRF for 10 time points starting at time 0, during which irf
applies the shock, and ending at period 9.
[
uses any of the input argument combinations in the previous syntaxes and returns lower and
upper 95% confidence bounds for each period and variable in the IRF:Response
,Lower
,Upper
] = irf(___)
If you specify series of residuals by using the
E
name-value pair argument, thenirf
estimates the confidence bounds by bootstrapping the specified residuals.Otherwise,
irf
estimates confidence bounds by conducting Monte Carlo simulation.
If Mdl
is a custom varm
model object (an object not returned by estimate
or modified after estimation), irf
might
require a sample size for the simulation SampleSize
or presample
responses Y0
.
Examples
Input Arguments
Output Arguments
More About
Algorithms
NaN
values inY0
,X
, andE
indicate missing data.irf
removes missing data from these arguments by list-wise deletion. Each argument, if a row contains at least oneNaN
, thenirf
removes the entire row.List-wise deletion reduces the sample size, can create irregular time series, and can cause
E
andX
to be unsynchronized.If
Method
is"orthogonalized"
, then the resulting IRF depends on the order of the variables in the time series model. IfMethod
is"generalized"
, then the resulting IRF is invariant to the order of the variables. Therefore, the two methods generally produce different results.If
Mdl.Covariance
is a diagonal matrix, then the resulting generalized and orthogonalized IRFs are identical. Otherwise, the resulting generalized and orthogonalized IRFs are identical only when the first variable shocks all variables (that is, all else being the same, both methods yield the same value ofResponse(:,1,:)
).The predictor data
X
represents a single path of exogenous multivariate time series. If you specifyX
and the VAR modelMdl
has a regression component (Mdl.Beta
is not an empty array),irf
applies the same exogenous data to all paths used for confidence interval estimation.irf
conducts a simulation to estimate the confidence boundsLower
andUpper
.If you do not specify residuals
E
, thenirf
conducts a Monte Carlo simulation by following this procedure:Simulate
NumPaths
response paths of lengthSampleSize
fromMdl
.Fit
NumPaths
models that have the same structure asMdl
to the simulated response paths. IfMdl
contains a regression component and you specifyX
, thenirf
fits theNumPaths
models to the simulated response paths andX
(the same predictor data for all paths).Estimate
NumPaths
IRFs from theNumPaths
estimated models.For each time point t = 0,…,
NumObs
, estimate the confidence intervals by computing 1 –Confidence
andConfidence
quantiles (upper and lower bounds, respectively).
If you specify residuals
E
, thenirf
conducts a nonparametric bootstrap by following this procedure:Resample, with replacement,
SampleSize
residuals fromE
. Perform this stepNumPaths
times to obtainNumPaths
paths.Center each path of bootstrapped residuals.
Filter each path of centered, bootstrapped residuals through
Mdl
to obtainNumPaths
bootstrapped response paths of lengthSampleSize
.Complete steps 2 through 4 of the Monte Carlo simulation, but replace the simulated response paths with the bootstrapped response paths.
References
[1] Hamilton, James D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.
[2] Lütkepohl, Helmut. New Introduction to Multiple Time Series Analysis. New York, NY: Springer-Verlag, 2007.
[3] Pesaran, H. H., and Y. Shin. "Generalized Impulse Response Analysis in Linear Multivariate Models." Economic Letters. Vol. 58, 1998, pp. 17–29.