mmkuang / mf-bavart

MF-BAVART model introduced in "Nowcasting in a Pandemic using Non-Parametric Mixed Frequency VARs"

Home Page:https://www.sciencedirect.com/science/article/pii/S0304407620303936

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Nowcasting in a Pandemic using Non-Parametric Mixed Frequency VARs"
by Huber, F., Koop, G., Onorante, L., Pfarrhofer, M., and J. Schreiner,
Journal of Econometrics (forthcoming)
- Published at        https://www.sciencedirect.com/science/article/pii/S0304407620303936
- Working paper at    https://arxiv.org/abs/2008.12706

These files create a function mfbavart(...) to estimate the MF-BAVART model.
- mfbavart_func.R contains the main function
- aux_func.R collects several auxiliary functions
- example.R contains an example code for using the function.

In addition to the baseline model in the paper, the code also includes an option
to introduce stochastic volatility (SV) in the error terms. Several parts of the original code
used for the paper in directory "replication" have been replaced to improve 
computational efficiency. For replication files only, see "replication."

This code comes without technical support of any kind. Please report any typos
or errors to: michael.pfarrhofer@sbg.ac.at. The code is free to use for academic
purposes only, provided that the paper is cited properly.

Some codes and helper functions are taken or adapted from the "mfbvar" package.
Thanks to Vincent Dorie (mtn. of "dbarts") and Sebastian Ankargren (mtn. of "mfbvar")
for technical support regarding their excellent packages.

Inputs for mfbavart(...):
- data            a list that contains ts-objects of different frequencies in its 
                  M (number of endogenous variables) slots, such that high-frequency (monthly)
                  series are ordered first and followed by low-frequency series (quarterly)
- itr             intertermporal restriction ("lvl" or "grw") of length 
                  corresponding to number of low frequency series
- p               numeric, lag-length of the VAR (minimum of 5 if itr=="grw", and 3 if itr=="lvl")
- fhorz           numeric, forecast horizon in months (3 per quarter)
- cons            TRUE/FALSE, whether a constant should be included
- exact           TRUE/FALSE, whether BART fit is stored in output values or 
                  filtered data based on approximation
- sv              TRUE/FALSE, whether structural errors feature stochastic volatility
- var.thrsh       numeric, threshold for resampling coefficients by draw (for sampler stability)
- max.count.var   numeric, maximum number of resampling steps
- cgm.level       numeric \in (0,1), \alpha in the paper (probability of terminal node)
- cgm.exp         numeric > 0, \beta in the paper (probability of terminal node)
- sd.mu           numeric, \gamma in the paper
- num.trees       numeric, number of trees for BART, S in the paper
- prior.sig       numeric of length 2, [1] nu_j, [2] v in the paper, 
                  if VAR.mean=="linear" shape/rate of iG prior
- nburn           numeric, number of burnins
- nsave           numeric, number of draws for posterior/predictive inference
- thinfac         numeric, thinning factor
- quiet           TRUE/FALSE, whether progress bar is indicated during sampling

Function returns:
- Y              [nsave,T,M] array that contains the latent states (see also option "exact")
- fcst           [nsave,fhorz,M] array that contains forecasts
- Yq             [nsave,T+fhorz,M] array that contains aggregated filtered and forecasted series

About

MF-BAVART model introduced in "Nowcasting in a Pandemic using Non-Parametric Mixed Frequency VARs"

https://www.sciencedirect.com/science/article/pii/S0304407620303936

License:Apache License 2.0


Languages

Language:R 100.0%