This folder contains all the materials needed to replicate the figures in "Binary Conditional Forecasts"

--------------------------------------------------------------------------------------------------------
NOTES

To run several of the scripts you will need the "FredFetch-master" toolbox (https://github.com/MattCocci/FredFetch). We use the user-written toolbox FredFetch to access ALFRED vintages through an API. All this requires is downloading the toolbox and supplying an API key in file named api.txt within the top-level folder of the toolbox. An API key can be requested from https://research.stlouisfed.org/docs/api/api_key.html.

In some of the main scripts we use parallel computing which requires the "Parallel Computing Toolbox" in MATLAB. However, these scripts can be ran without parallel computing, they will just be much slower.

--------------------------------------------------------------------------------------------------------
PROGRAMS

Main Scripts: contains the MATLAB scripts that execute all the exercises done in the paper.

- "exercises.m" - Performs the pseudo-out-of-sample forecasting exercises for predicting recessions using the QualVAR with monthly data. Outputs "base.xlsx" and "financials.xlsx" to the Output directory.

- "exercices_q.m" - Performs the pseudo-out-of-sample forecasting exercises for predicting recessions using the QualVAR with quarterly data. Outputs "base_q.xlsx" and "financials_q.xlsx" to the Output directory.

- "realtime_forecasting_figures.m" - Creates the recession probability and AUROC plots (e.g., Figures 1 and 2) using the results created in "exercises.m"

- "realtime_forecasting_figures_q.m" - Creates the AUROC plot (e.g., Figure 3) using the results created in "exercises_q.m"

- "scenarios_ffr.m" - Evaluates different fed funds rate scenarios using the QualVAR. When scenarios=5, this script produces Figure 4.

- "scenarios_hamilton_kanzig.m" - Uses the QualVAR to perform the scenarios from Hamilton (2009) with Kanzig's approach for structural scenarios.  When use_realoil=1, this script produces Figure 5.

- "update_piger_data.m" - Creates the datasets used in the pseudo-out-of-sample forecasting exercises. Data is written to the "RealTimeUpdate" folder in the Data directory.

- "create_monthly_gdp_v2.m" - Reads in data from Haver to create the monthly GDP data used in several of the exercises. Data is written to the "MonthlyGDP" folder in the Data directory.

Functions: contains all the user-created functions needed to run the main scripts.

Toolboxes: contains the toolboxes needed to run the main scripts (except for FredFetch-master, for which instructions are given above)


--------------------------------------------------------------------------------------------------------
DATA


FREDMD: Contains FRED-MD data used to construct monthly GDP.

GP_IJOF: Contains Piger's real-time NBER business cycle dataset.

MonthlyGDP: Contains rGDP and PMI data from Haver, as well as the monthly GDP dataset created by the "create_monthly_gdp_v2.m" script.

MTS_update: Contains the Haver Real Manufacturing & Trade Sales vintages data. Also contains the script "updateMTS.m" which updates this dataset if the user has access to Haver (you may need to change Haver directory for the script to work properly).

NBERdates: Contains NBER recession and expansion dates.

Raw Real Time Data: Contains real-time Piger data.

RealTimeUpdate: Contains .mat data files with monthly and quarterly real time piger vintages. Running "update_piger_data.m" in the Programs directory updates these files.

Scenarios: Contains data for the Monetary Policy and Oil scenarios.


--------------------------------------------------------------------------------------------------------
OUTPUT

-"base.xlsx", "financials.xlsx", "base_q.xlsx", "financials_q.xlsx" contain the results from "exercises.m" and "exercises.q". These excels include Turning-Point Calls, AUROC (AUC), Youden thresholds, and recession probabilities from each model.

Forecasts: This folder contains GIFs of the real-time forecasts for the base and financials versions of the QualVAR and probit models. These are only created for the monthly exercise (e.g., in "exercies.m")

FiguresForPaper: This folder contains Figures 1, 2, 3, 4, and 5 from the paper.




