# 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, then`irf`

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 in`Y0`

,`X`

, and`E`

indicate missing data.`irf`

removes missing data from these arguments by list-wise deletion. Each argument, if a row contains at least one`NaN`

, then`irf`

removes the entire row.List-wise deletion reduces the sample size, can create irregular time series, and can cause

`E`

and`X`

to be unsynchronized.If

`Method`

is`"orthogonalized"`

, then the resulting IRF depends on the order of the variables in the time series model. If`Method`

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 of`Response(:,1,:)`

).The predictor data

`X`

represents a single path of exogenous multivariate time series. If you specify`X`

and the VAR model`Mdl`

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 bounds`Lower`

and`Upper`

.If you do not specify residuals

`E`

, then`irf`

conducts a Monte Carlo simulation by following this procedure:Simulate

`NumPaths`

response paths of length`SampleSize`

from`Mdl`

.Fit

`NumPaths`

models that have the same structure as`Mdl`

to the simulated response paths. If`Mdl`

contains a regression component and you specify`X`

, then`irf`

fits the`NumPaths`

models to the simulated response paths and`X`

(the same predictor data for all paths).Estimate

`NumPaths`

IRFs from the`NumPaths`

estimated models.For each time point

*t*= 0,…,`NumObs`

, estimate the confidence intervals by computing 1 –`Confidence`

and`Confidence`

quantiles (upper and lower bounds, respectively).

If you specify residuals

`E`

, then`irf`

conducts a nonparametric bootstrap by following this procedure:Resample, with replacement,

`SampleSize`

residuals from`E`

. Perform this step`NumPaths`

times to obtain`NumPaths`

paths.Center each path of bootstrapped residuals.

Filter each path of centered, bootstrapped residuals through

`Mdl`

to obtain`NumPaths`

bootstrapped response paths of length`SampleSize`

.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.

## Version History

**Introduced in R2019a**