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.
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
# \donttest{ # 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)#> Error in n.lag(., lags = p): could not find function "n.lag"# correct VAR for COVID shock var = sovereign::covid_volatility_correction(var)#> Error in var$model: object of type 'closure' is not subsettable#> Error in var$model: object of type 'closure' is not subsettable#> Error in var$model: object of type 'closure' is not subsettable#> Error in var$model: object of type 'closure' is not subsettable# }