Learn R Programming

vars (version 1.5-3)

irf: Impulse response function

Description

Computes the impulse response coefficients of a VAR(p) (or transformed VECM to VAR(p)) or a SVAR for n.ahead steps.

Usage

# S3 method for varest
irf(x, impulse = NULL, response = NULL, n.ahead = 10,
ortho = TRUE, cumulative = FALSE, boot = TRUE, ci = 0.95,
runs = 100, seed = NULL, ...)
# S3 method for svarest
irf(x, impulse = NULL, response = NULL, n.ahead = 10,
ortho = TRUE, cumulative = FALSE, boot = TRUE, ci = 0.95,
runs = 100, seed = NULL, ...)
# S3 method for vec2var
irf(x, impulse = NULL, response = NULL, n.ahead = 10,
ortho = TRUE, cumulative = FALSE, boot = TRUE, ci = 0.95,
runs = 100, seed = NULL, ...)
# S3 method for svecest
irf(x, impulse = NULL, response = NULL, n.ahead = 10,
ortho = TRUE, cumulative = FALSE, boot = TRUE, ci = 0.95,
runs = 100, seed = NULL, ...)

Arguments

x

Object of class ‘varest’; generated by VAR(), or object of class ‘svarest’; generated by SVAR(), or object of class ‘vec2var’; generated by vec2var(), or object of class ‘svecest’; generated by SVEC().

impulse

A character vector of the impulses, default is all variables.

response

A character vector of the responses, default is all variables.

n.ahead

Integer specifying the steps.

ortho

Logical, if TRUE (the default) the orthogonalised impulse response coefficients are computed (only for objects of class ‘varest’).

cumulative

Logical, if TRUE the cumulated impulse response coefficients are computed. The default value is false.

boot

Logical, if TRUE (the default) bootstrapped error bands for the imuplse response coefficients are computed.

ci

Numeric, the confidence interval for the bootstrapped errors bands.

runs

An integer, specifying the runs for the bootstrap.

seed

An integer, specifying the seed for the rng of the bootstrap.

...

Currently not used.

Value

A list of class ‘varirf’ with the following elements is returned:

irf

A list with matrices for each of the impulse variables containing the impulse response coefficients.

Lower

If boot = TRUE, a list with matrices for each of the impulse variables containing the lower bands.

Upper

If boot = TRUE, a list with matrices for each of the impulse variables containing the upper bands.

response

Character vector holding the names of the response variables.

impulse

Character vector holding the names of the impulse variables.

ortho

Logical, if TRUE, orthogonalised impulse reponses have been computed.

cumulative

Logical, if TRUE, cumulated impulse reponses have been computed.

runs

An integer, specifying the number of bootstrap runs.

ci

Numeric, defining the confidence level.

boot

Logical, if TRUE bootstrapped error bands have been computed.

model

Character, containing ‘class(x)’.

Details

The impulse response coefficients of a VAR(p) for n.ahead steps are computed by utilising either the function Phi() or Psi(). If boot = TRUE (the default), confidence bands for a given width specified by ci are derived from runs bootstrap. Hereby, it is at the users leisure to set a seed for the random number generator. The standard percentile interval is defined as: $$ CI_s = [s_{\alpha/2}^*, s_{1 - \alpha/2}^*] \quad , $$ with \(s_{\alpha/2}^*\) and \(s_{1 - \alpha/2}^*\) are the \(\alpha/2\) and \(1 - \alpha/2\) quantiles of the bootstrap distribution of \(\Psi^*\) or \(\Phi^*\) depending whether ortho = TRUE. In case cumulative = TRUE, the confidence bands are calculated from the cumulated impulse response coefficients.

References

Efron, B. and R. J. Tibshirani (1993), An Introduction to the Bootstrap, Chapman \& Hall, New York.

Hamilton, J. (1994), Time Series Analysis, Princeton University Press, Princeton.

L<U+34AE5C2F>hl, H. (2006), New Introduction to Multiple Time Series Analysis, Springer, New York.

See Also

VAR, SVAR, vec2var, SVEC, Phi, Psi, plot

Examples

Run this code
# NOT RUN {
data(Canada)
## For VAR
var.2c <- VAR(Canada, p = 2, type = "const")
irf(var.2c, impulse = "e", response = c("prod", "rw", "U"), boot =
FALSE)
## For SVAR
amat <- diag(4)
diag(amat) <- NA
svar.a <- SVAR(var.2c, estmethod = "direct", Amat = amat)
irf(svar.a, impulse = "e", response = c("prod", "rw", "U"), boot =
FALSE)
# }

Run the code above in your browser using DataLab