Niko Hauzenberger, Florian Huber, and Luca Onorante, "Combining Shrinkage and Sparsity in Conjugate Vector Autoregressive Models", Journal of Applied Econometrics, Vol. 36, No. 3, 2021, pp. 304-327. All files except the on-line appendix are zipped in the file hho-files.zip. Text files are in DOS format. ####-------------------------- I. DATA ------------------------------------#### For the simulation study we use artificial data, as outlined in Section 4 in the paper. The data can be simulated with the file: "xx_data.sim.script.R". In the paper we take 150 replications per DGP. For the empirical exercise we use quarterly macroeconomic data for the US, obtained from the FRED-QD database (https://research.stlouisfed.org/econ/mccracken/fred-databases/). We provide the raw-data as a .csv file (FREDdata/2019Q2.csv) with the columns referring to the different variables. Additionally, we provide the already transformed dataset as a .rda-object (FREDdata/Xraw_Q.rda). The .rda-object contains two objects. Here, "Xraw.stat" refers to the stationary data and contains the variables used for the forecasting exercise, while "Xraw.int" stores the data in levels and is not used. Our dataset spans from 1959:Q1 up to 2018:Q4 and is taken from the vintage July 2019. In Appendix A. we provide detailed informations on the transformation applied for each variable. We transform the data to stationarity, according to the suggestions of McCracken and Ng (2016). Moreover, Table A1 shows the specific set of variables included in each specification in Section 5. ####-------------------- II. SOFTWARE INFORMATION -------------------------#### Version of primary software used: R version 4.0.2 Libraries and packages used by the replication code: Matrix, MASS, mvtnorm, glasso (not necessarily needed: stochvol and GIGrvg) Additional packages to reproduce test statistics, PITs and CRPS: forecast, scoringRules, MCS, lmtest, sandwich Additional packages to reproduce figures and tables: ggplot2, dplyr, reshape2, tidyr, Hmisc, zoo, RColorBrewer, scales For parallelzation, we used the cluster in combination with a Sun Grid Engine. Details are provided in: https://statmath.wu.ac.at/cluster/cluster_manual_2.0.pdf ####--------------------- III. REPLICATION CODES --------------------------#### In the following, the replication files allow for estimating the model based on both simulated and real data (with the possibility to parallelize estimation over a grid). That is, we use precisely the same codes for simulation-based evidence (application == "simulation") and the forecasting application (application == "US"). The results are obtained by using a cluster. Hence, reproducing them on a standard desktop pc is almost unfeasible. *** 01_hyperpara_optim.R (Step 0): This file allows for optimizing the hyperparameter of the Minnesota prior. We therefore define a grid of values ranging from 0,01 to 5, and seek for the value that maximizes the marginal likelihood for each hold-out period. In the empirical application, we use this optimization procedure for the small- and medium-scale model and the FA-VAR. *** 02_VAR_estimation.R (Step 1): This file allows for estimating a Bayesian VAR with either a Minnesota or a SSVS prior (for both artifical- and real-data). In case of the Minnesota prior we use the conjVAR.func-function, while for the SSVS prior we use the NGSSVS.func-function. Both functions can be found in the auxiliary file xx_VAR.func.R. Depending on the application posterior estimates are saved either in the folder "simulation_I0" or in the folder "US_I0" (in case of the real-data application). Note: Here it is important to check that the results obtained from Step 0 exist. That is, for all models one needs to define the hyperparameter for the Minnesota prior either by offsetting them (e.g., for the large-scale VAR) or by estimating them a priori (e.g., for the small-, medium-scale VAR and the FA-VAR). *** 03_SAVS_expost.R (Step 2): In the following, we load the stored posterior estimates and post-process them (again for both artifical- and real-data). The function post.func can be found in the auxiliary file xx_post.func.R. This file not only allows for post-processing, but also for predictions based on both sparsified and non-sparsifed draws. For these predictions we calculate the root mean squared errors (Table 2) and log predictive likelihoods (Table 3). Additionally, we use "The model confidence set package for R" of Bernardi and Catania (2018), and Diebold Mariano (1995) and Amisano and Giacomini (2007) tests, which are available in the R package "forecast". Note: Here it is important to check that the results obtained from Step 1 exist. ####-----------------------------------------------------------------------#### Contact information of the corresponding author: Niko Hauzenberger (University of Salzburg) Address: Moenchsberg 2a, 5020 Salzburg, Austria Email: niko.hauzenberger [at] sbg.ac.at