Description Usage Arguments Value See Also Examples
View source: R/covid_correction.R
Implement the deterministic volatility correction method of Lenza, Michele and Giorgio Primiceri "How to Estimate a VAR after March 2020" (2020) [NBER Working Paper]. Correction factors are estimated via maximum likelihood.
1 | covid_volatility_correction(var, theta_initial = c(5, 2, 1.5, 0.8))
|
var |
VAR object |
theta_initial |
double: four element vector with scaling parameters, theta in Lenza and Primiceri (2020) |
var object
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('2018-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)
# correct VAR for COVID shock
var = sovereign::covid_volatility_correction(var)
# impulse response functions
var.irf = sovereign::var_irf(var)
# forecast error variance decomposition
var.fevd = sovereign::var_fevd(var)
# historical shock decomposition
var.hd = sovereign::var_hd(var)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.