irf: Impulse response function In tsDyn: Nonlinear Time Series Models with Regime Switching

Description

Use the `fevd` function from package vars to tompute the impulse response coefficients of a VAR(p) (or transformed VECM to VAR(p)) for `n.ahead` steps.

Usage

 ```1 2 3 4``` ```## S3 method for class 'nlVar' 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 ‘`VAR`’; generated by `lineVar()`, or object of class ‘`VECM`’; generated by`VECM()`. `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.

Details

The function converts the VAR or VECM computed by package tsDyn into an object of class ‘`vec2var`’, on which then the `irf` method is applied. For details, see the relevant package.

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)`’.

Bernhard Pfaff

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Ã¼tkepohl, H. (2006), New Introduction to Multiple Time Series Analysis, Springer, New York.

`plot` for the plot method. `lineVar`, `VECM` for the models.

Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```data(barry) ## For VAR mod_var <- lineVar(barry, lag = 2) irf(mod_var, impulse = "dolcan", response = c("dolcan", "cpiUSA", "cpiCAN"), boot = FALSE) ## For VECM mod_VECM <- VECM(barry, lag = 2, estim="ML", r=2) irf(mod_VECM, impulse = "dolcan", response = c("dolcan", "cpiUSA", "cpiCAN"), boot = FALSE) ```

Example output

```Impulse response coefficients
\$dolcan
dolcan        cpiUSA        cpiCAN
[1,] 0.01263041 -0.0048261838 -0.0123959584
[2,] 0.01442056 -0.0003017074 -0.0089117109
[3,] 0.01439029  0.0018221283 -0.0050181633
[4,] 0.01407837  0.0017585360 -0.0023138114
[5,] 0.01373609  0.0005588836 -0.0003808992
[6,] 0.01339939 -0.0011470315  0.0011612521
[7,] 0.01307097 -0.0030532930  0.0025146740
[8,] 0.01274968 -0.0050206825  0.0037743835
[9,] 0.01243458 -0.0069875398  0.0049833475
[10,] 0.01212512 -0.0089270518  0.0061607665
[11,] 0.01182103 -0.0108278553  0.0073152342

Warning messages:
1: In x/sqrt(t(x) %*% S11 %*% x) :
Recycling array of length 1 in vector-array arithmetic is deprecated.

2: In x/sqrt(t(x) %*% S11 %*% x) :
Recycling array of length 1 in vector-array arithmetic is deprecated.

3: In x/sqrt(t(x) %*% S11 %*% x) :
Recycling array of length 1 in vector-array arithmetic is deprecated.

Impulse response coefficients
\$dolcan
dolcan        cpiUSA        cpiCAN
[1,] 0.01254489 -0.0029302360 -7.383446e-03
[2,] 0.01434484  0.0035655133 -2.087037e-03
[3,] 0.01398363 -0.0006891768 -3.406078e-03
[4,] 0.01356168 -0.0043964840 -2.535065e-03
[5,] 0.01324901 -0.0069522987 -2.187395e-03
[6,] 0.01294200 -0.0086735230 -1.091890e-03
[7,] 0.01263782 -0.0101398959  8.207361e-05
[8,] 0.01233276 -0.0114414225  1.432537e-03
[9,] 0.01203124 -0.0126614792  2.808676e-03
[10,] 0.01173367 -0.0138198949  4.209197e-03
[11,] 0.01144100 -0.0149378777  5.600684e-03
```

tsDyn documentation built on June 4, 2018, 1:04 a.m.