rlp_irf: Estimate regime-dependent impulse response functions

Description Usage Arguments Value See Also Examples

View source: R/lp_irf.R

Description

Estimate regime-dependent impulse response functions

Usage

1
rlp_irf(rlp, CI = c(0.1, 0.9))

Arguments

rlp

RLP output

CI

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

Value

list of long-form data.frame with one row per target-shock-horizon identifier

See Also

LP()

lp_irf()

RLP()

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
  # 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)
  # add regime
  Data = dplyr::mutate(Data, reg = dplyr::if_else(AA > median(AA), 1, 0))

  # local projection forecasts
  rlp =
    sovereign::RLP(
      data = Data,
      regime = 'reg',
      horizon = c(1:10),
      freq = 'month',
      p = 1,,
      type =  'const',
      NW = TRUE,
      NW_lags = 1,
      NW_prewhite = FALSE)

 # impulse response function
 rirf = sovereign::rlp_irf(rlp)

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