Last data update: 2014.03.03

R: Impulse Response Function (IRF) Computation for a VAR
irfR Documentation

Impulse Response Function (IRF) Computation for a VAR

Description

Computes the impulse response function (IRF) or moving average representation (MAR) for an m-dimensional set of VAR/BVAR/B-SVAR coefficients.

Usage

irf(varobj, nsteps, A0=NULL)

Arguments

varobj

VAR, BVAR, or BSVAR objects for a fitted VAR, BVAR, or BSVAR model from szbvar, szbsvar or reduced.form.var

nsteps

Number or steps, or the horizon over which to compute the IRFs (typically 1.5 to 2 times the lag length used in estimation

A0

Decomposition contemporaneous error covariance of a VAR/BVAR/BSVAR, default is a Cholesky decomposition of the error covariance matrix for VAR and BVAR models, A0 = chol(varobj$mean.S), and the inverse of A(0) for B-SVAR models, A0 = solve(varobj$A0.mode)

Details

This function should rarely be called by the user. It is a working function to compute the IRFs for a VAR model. Users will typically want to used one of the simulation functions that also compute error bands for the IRF, such as mc.irf which calls this function and simulates its multivariate posterior distribution.

Value

A list of the AR coefficients used in computing the IRF and the impulse response matrices:

B

m x m x nstep Autoregressive coefficient matrices in lag order. Note that all AR coefficient matrices for nstep > p are zero.

mhat

m x m x nstep impulse response matrices. mhat[,,i] are the impulses for the i'th period for the m variables.

Note

The IRF depends on the ordering of the variables and the structure of the decomposition in A0.

Author(s)

Patrick T. Brandt

References

Sims, C.A. and Tao Zha. 1999. "Error Bands for Impulse Responses." Econometrica 67(5): 1113-1156.

Hamilton, James. 1994. Time Series Analysis. Chapter 11.

See Also

See also dfev for the related decompositions of the forecast error variance, mc.irf for Bayesian and frequentist computations of IRFs and their variances (which is what you probably really want).

Examples

data(IsraelPalestineConflict)
rf.var <- reduced.form.var(IsraelPalestineConflict, p=6)
plot(irf(rf.var, nsteps = 12))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(MSBVAR)
##
## MSBVAR Package v.0.9-2
## Build date:  Mon Jul  4 19:53:00 2016 
## Copyright (C) 2005-2016, Patrick T. Brandt
## Written by Patrick T. Brandt
##
## Support provided by the U.S. National Science Foundation
## (Grants SES-0351179, SES-0351205, SES-0540816, and SES-0921051)
##

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MSBVAR/irf.Rd_%03d_medium.png", width=480, height=480)
> ### Name: irf
> ### Title: Impulse Response Function (IRF) Computation for a VAR
> ### Aliases: irf irf.VAR irf.BVAR irf.BSVAR
> ### Keywords: ts models
> 
> ### ** Examples
> 
> data(IsraelPalestineConflict)
> rf.var <- reduced.form.var(IsraelPalestineConflict, p=6)
> plot(irf(rf.var, nsteps = 12))
         [,1]      [,2]
[1,]  0.00000  3.386248
[2,] 60.58718 24.067998
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>