Andrea Carriero, Todd E. Clark, and Massimiliano Marcellino, "Nowcasting Tail Risk to Economic Activity at a Weekly Frequency," Journal of Applied Econometrics, Vol. 37, No. 5, 2022, pp. 843-866. This file details the data and computer programs used to produce the results in the published paper. All files are stored in ccm-files-2022.zip. They are a mix of binary and ASCII files, the latter in DOS format. Regarding replication and data, please note the following: In this public distribution, we have had to omit one of the weekly economic indicators used. Specifically, we are unable to distribute the Bloomberg Consumer Comfort Index data under the terms of our license (but researchers with access to a Bloomberg terminal can find the series using the mnemonic "COMFCOMF Index", recently renamed as the "Langer US weekly Consumer Comfort series"). To allow researchers to run the programs without the omitted series, for this distribution we revised the programs (relative to what we used for the paper's results) to not call the associated consumer sentiment series. This affects code and results using the "small weekly" and "large weekly" sets of indicators, but not those using just the base macro and base finance variable sets. ******************** DIRECTORY STRUCTURE: ******************** prog folder: computer programs in RATS that read in and transform data, call procedures, and produce the results provided in the paper. Some of these programs estimate models and produce forecasts. Others read in forecasts to compute and compile results of interest. data folder: files of time series data used in RATS programs detailed below procedures folder: computer programs in RATS for model estimation and forecast computation, called by other programs Note: The "prog" folder contains folders "fcdraws", "out.fcprocessingfromdraws", and "out.forecastruns" needed for the programs to run successfully. These folders are used to store output files of forecast results and forecast draws that are called by the programs that read in forecasts to compute and compile results of interest. As provided, these folders are empty but included because they are needed to run programs (the compilation programs won't run successfully until these folders are populated with files produced by the model estimation and forecasting programs). Computation: Some of the estimation and forecasting computations require significant CPU time or RAM. In particular, because the BQR and PQR models are estimated for each of 19 quantiles, running these models over all forecast origins (15 per quarter, starting in 1985/2000/2007 depending on the variable set), these estimates require significant time. The estimation programs are set up to allow these models to be estimated over a subset of years of the sample, rather than all. Note also that, because draws are combined for 19 quantiles, the processing of draws to obtain the empirical densities uses a large amount of RAM. The code switches are set to use a thinning interval of 5, so that the computations use 1000 draws for each quantile and 19,000 total. But this was only feasible on a computer with 64 GB of RAM. Getting these programs to run on a machine with 32 GB of RAM will likely require increasing the thinning interval to 10 (the setting in the program processdraws_BQRPQR.prg). ****************** DATA FOLDER FILES: ****************** The following contains the time series of data used in the article (at quarterly, monthly, or weekly frequency), with rows corresponding to dates and columns to variables. The first row lists the variables. The first column in each file provides the dates of the observation. (In the case of quarterly GDP, in the file realtimeGDP.allmonths.xlsx, quarters 1, 2, 3, and 4 are labeled as months 1, 4, 7, and 10, respectively). We provide the data in Excel or RATS-format files (the latter in one case, because it yields a noticeable improvement in program run time). realtimeGDP.allmonths.xlsx: Monthly vintages of quarterly real GDP, obtained from the Phil. Fed's RTDSMGDPactuals.secondrelease.xls: Quarterly time series of the measure of real GDP growth used in forecast evaluation (2nd available estimate of GDP growth in quarterly vintages from the RTDSM)weeklydata.notrealtime.xlsx: Weekly indicators for which we do not use real-time data vintages. These data were pulled from various sources, indicated in the paper's appendix. This file has the data organized in different tabs. rtwklydata.RATS: Folder of RATS-format data files with predictors based on monthly data. For each forecast origin (weeks 1-15 for which a forecast is formed for a given quarter), there is a separate file containing the data as available at that origin. These data have already been transformed as needed (to growth of employment, growth of IP, etc.). The files were produced by another program that read in raw data, transformed it as appropriate, and then created each file. ************************ PROCEDURES FOLDER FILES: ************************ Note: All files use the software programming language RATS, and models are estimated with Bayesian methods (Gibbs samplers). BayesQR.src: Estimates BQR model PQR.src: Uses approach of Giglio, Kelly, and Pruitt (2016) to estimate and output the common factor used in PQR models. univariate.SV.src: Estimates BMF-SV model univariate.SVO.src: Estimates outlier-robust version of BMF-SV model (used in 2020 results, not earlier) fcmoments.src: Used to process forecast draws from BMF-SV model to obtain forecast measures used fcmoments_kernelsmoothed.src: Used to process forecast draws from BQR and PQR models to obtain forecast measures used. In this case, draws combined from multiple quantiles are kernel smoothed, and the forecast measures are computed using the resulting empirical densities. ttestQS.src: Used in computation of Diebold-Mariano-West tests of equal accuracy. Function for computing t-stats (using pre-whitened quadratic spectral kernel) for 0 mean of loss differential, obtained by regressing loss differential on a constant, with HAC st. errors Christoffersentest.src: Procedure for computing the Christoffersen (1998, IER) test of conditional coverage given a time series of an empirical hit ****************** PROG FOLDER FILES: ****************** NOTES: (1) The programs listed below read in and transform as needed the data and call the procedure files to produce estimates and forecasts. (2) Some of these programs take a long time to complete (if producing 5000 retained draws; for development or experimentation, reducing the number of draws speeds calculation considerably). AR_SV.prg: Loops over all forecast origins to read in data, estimate AR model with SV, form time series of forecasts and forecast statistics, and write results for processing to Excel file basemacro_SV.prg: Uses base M variable set. Loops over all forecast origins to read in data, estimate BMF-SV model, form time series of forecasts and forecast statistics, and write results for processing to Excel file. basemacro_basefinance_SV.prg: Uses base M-F variable set. Loops over all forecast origins to read in data, estimate BMF-SV model, form time series of forecasts and forecast statistics, and write results for processing to Excel file. basemacro_smallwkly_SV.prg: Uses base M + small weekly variable set. Loops over all forecast origins to read in data, estimate BMF-SV model, form time series of forecasts and forecast statistics, and write results for processing to Excel file. basemacro_basefinance_smallwkly_SV.prg: Uses base M-F + small weekly variable set. Loops over all forecast origins to read in data, estimate BMF-SV model, form time series of forecasts and forecast statistics, and write results for processing to Excel file. basemacro_largewkly_SV.prg: Uses base M + large weekly variable set. Loops over all forecast origins to read in data, estimate BMF-SV model, form time series of forecasts and forecast statistics, and write results for processing to Excel file. basemacro_basefinance_largewkly_SV.prg: Uses base M-F + large weekly variable set. Loops over all forecast origins to read in data, estimate BMF-SV model, form time series of forecasts and forecast statistics, and write results for processing to Excel file. Same 7 files with SVO replacing SV in the filename: Same computations as indicated above, just for BMF-SV model robust to outliers. These forecasts are produced for just forecast origins starting in 2019. The paper uses these forecasts in the results for 2020. basemacro_BQR.prg: Uses base M variable set. Loops over subset of years of forecast origins (specified near the top of the program) to read in data, estimate BQR model for multiple quantiles, and write draws of quantile forecasts to files for processing by program processdraws_BQRPQR.prg. Draws are written to a specific folder within the folder "fcdraws". basemacro_basefinance_BQR.prg: Uses base M-F variable set. Loops over subset of years of forecast origins (specified near the top of the program) to read in data, estimate BQR model for multiple quantiles, and write draws of quantile forecasts to files for processing by program processdraws_BQRPQR.prg. Draws are written to a specific folder within the folder "fcdraws". basemacro_smallwkly_PQR.prg: Uses base M + small weekly variable set. Loops over subset of years of forecast origins (specified near the top of the program) to read in data, estimate BQR model for multiple quantiles, and write draws of quantile forecasts to files for processing by program processdraws_BQRPQR.prg. Draws are written to a specific folder within the folder "fcdraws". basemacro_basefinance_smallwkly_BQR.prg: Uses base M-F + small weekly variable set. Loops over subset of years of forecast origins (specified near the top of the program) to read in data, estimate BQR model for multiple quantiles, and write draws of quantile forecasts to files for processing by program processdraws_BQRPQR.prg. Draws are written to a specific folder within the folder "fcdraws". basemacro_largewkly_BQR.prg: Uses base M + large weekly variable set. Loops over subset of years of forecast origins (specified near the top of the program) to read in data, estimate BQR model for multiple quantiles, and write draws of quantile forecasts to files for processing by program processdraws_BQRPQR.prg. Draws are written to a specific folder within the folder "fcdraws". basemacro_basefinance_largewkly_BQR.prg: Uses base M-F + large weekly variable set. Loops over subset of years of forecast origins (specified near the top of the program) to read in data, estimate BQR model for multiple quantiles, and write draws of quantile forecasts to files for processing by program processdraws_BQRPQR.prg. Draws are written to a specific folder within the folder "fcdraws". Same 6 files with PQR replacing BQR in the filename: Same computations as indicated above, just for PQR and not BQR specifications. Note that, with the PQR models, the programs first use the procedure PQR.src to form the common factor needed and then use BayesQR.src to estimate with a Bayesian quantile regression specification relating GDP growth to the common factor and lagged GDP growth. processdraws_BQRPQR.prg: Loops over all forecast origins to read in and process forecast draws from BQR or PQR specification (a switch at the top determines which model/variable et combo is used). The program reads in draws for all 19 forecast quantiles, fits an empirical density (calling a procedure to do so), takes draws from this density, and then computes the forecast metrics of interest (quantile forecasts, QS, VaR-ES score, etc.) Results are written to Excel file for compilation of results by other programs. averageforecast.prg: Loops over subset of years of forecast origins (specified near the top of the program) to form the CRPS measures for the average forecast included in the paper. This is an equally weighted average forecast based on the BMF-SV, BQR, and PQR specifications with the base M-F variable set. In the evaluation of that forecast, for the CRPS measures that require a complete predictive density, we obtain the statistics by linear pooling of the underlying densities. (For the other metrics in the paper, we directly average the forecasts and compute statistics using these forecast averages. This includes the quantile forecasts and ES. We take averages of these and then compute the QS and VaR-ES using the quantile and ES averages.) This program reads in the underlying forecast draws, computes their densities, forms the pdf for the average forecast using linear pooling, and then takes draws from that pdf to compute the CRPS and qwcrps for this average forecast. The result is written to an Excel file. The results in the files can be manually combined to obtain the file of average forecast results used in subsequent processing programs. averageforecast_SVO_1920.prg: Loops over subset of years of forecast origins (specified near the top of the program) to form the CRPS measures for the average forecast included in the paper for the period 2019-2020. This average replaces the BMF-SV forecasts with their outlier-robust counterparts, for the paper's results reported for the year of 2020. comboweights.xlsx: Spreadsheet with a dummy indicating which forecasts are included in the average (1 for inclusion, 0 for exclusion). Called by the compilation programs compileresults.prg and compileresults_2020only_notests.prg. compileresults.prg: Reads in time series of forecast/forecast metrics to compute accuracy measures reported in the paper's Tables 3-6 and corresponding appendix tables, along with Figure 1. compileresults_2020only_notests.prg: Reads in time series of forecast/forecast metrics to compute accuracy measures reported in the paper's Table 7 and corresponding appendix tables. For the sample of 2020, this program omits tests. It also replaces BMF-SV forecasts with BMF-SVO forecasts that add an outlier treatment to the SV specification. chartsofforecasts.prg: Reads in forecasts to construct charts for the paper's Figure 2 and corresponding PQR charts in the appendix. chartsofforecasts_SVO.prg: Reads in forecasts to construct charts for the paper's Figure 3. This chart for 2020 uses results from the BMF-SVO specification in lieu of the BMF-SV model, in order to mitigate the influence of COVID's extreme volatility. Contact information: todd.clark [AT] researchfed.org, (216) 579-2015.