IRF: Estimate impulse response functions

Description Usage Arguments Value See Also Examples

View source: R/analysis_wrappers.R

Description

See VAR, RVAR, LP, and RLP documentation for details regarding models and structural errors.

Usage

1
2
3
4
5
6
7
8
9
IRF(
  model,
  horizon = 10,
  CI = c(0.1, 0.9),
  bootstrap.type = "auto",
  bootstrap.num = 100,
  bootstrap.parallel = FALSE,
  bootstrap.cores = -1
)

Arguments

model

VAR, RVAR, LP, or RLP class object

horizon

int: number of periods

CI

numeric vector: c(lower ci bound, upper ci bound)

bootstrap.type

string: bootstrapping technique to use ('auto', 'standard', or 'wild'); if auto then wild is used for IV or IV-short, else standard is used

bootstrap.num

int: number of bootstraps

bootstrap.parallel

boolean: create IRF draws in parallel

bootstrap.cores

int: number of cores to use in parallel processing; -1 detects and uses half the available cores

Value

data frame with columns target, shock, horizon, response.lower, response, response.upper; regime-based models return a list with a data frame per regime.

See Also

var_irf()

rvar_irf()

lp_irf()

rlp_irf()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 # simple time series
 AA = c(1:100) + rnorm(100)
 BB = c(1:100) + rnorm(100)
 CC = AA + BB + rnorm(100)
 date = seq.Date(from = as.Date('2000-01-01'), by = 'month', length.out = 100)
 Data = data.frame(date = date, AA, BB, CC)

 # estimate VAR
  var =
    sovereign::VAR(
      data = Data,
      horizon = 10,
      freq = 'month',
      lag.ic = 'BIC',
      lag.max = 4
    )

 # impulse response function
 var.irf = sovereign::IRF(var)

  # local projection forecasts
  lp =
    sovereign::LP(
      data = Data,
      horizon = c(1:10),
      lag.ic = 'AIC',
      lag.max = 4,
      type =  'both',
      freq = 'month')

  # LP impulse response function
  lp.irf = sovereign::IRF(lp)

sovereign documentation built on Jan. 5, 2022, 1:08 a.m.