rvar_fevd: Estimate regime-dependent forecast error variance...

Description Usage Arguments Value See Also Examples

View source: R/var_fevd.R

Description

Estimate forecast error variance decomposition for RVARs with either short or 'IV-short' structural errors.

Usage

1
rvar_fevd(rvar, horizon = 10, scale = TRUE)

Arguments

rvar

RVAR output

horizon

int: number of periods

scale

boolean: scale variable contribution as percent of total error

Value

list, each regime returns its own long-form data.frame

See Also

VAR()

var_irf()

var_fevd()

var_hd()

RVAR()

rvar_irf()

rvar_fevd()

rvar_hd()

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

 # estimate VAR
  rvar =
    sovereign::RVAR(
      data = Data,
      horizon = 10,
      freq = 'month',
      regime.method = 'rf',
      regime.n = 2,
      lag.ic = 'BIC',
      lag.max = 4)

# impulse response functions
rvar.irf = sovereign::rvar_irf(rvar)

# forecast error variance decomposition
rvar.fevd = sovereign::rvar_fevd(rvar)

# historical shock decomposition
rvar.hd = sovereign::rvar_hd(rvar)

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