“A Comparative Study of Machine Learning Models for Forecasting Key Macroeconomic Indicators: How COVID-19 Betrayed Expectations”
Authors:
- Chiara Perugini, University of Bologna
- Davide Delfino, University of Bologna
- Mohammad Kouzehgar Kaleji, University of Bologna
- Sara Tozzi, University of Bologna
This project trains and compares the forecasting performances of alternative forecasting methods for high-dimensional macroeconomic data. The main R scripts involved are:
Bayesian_Shrinkage.RFarmSelect.R
The outputs include:
- Factor model forecasts (Principal Components Regression, PCR).
- Bayesian regression with i.i.d. normal prior (Ridge Regression).
- Bayesian regression with i.i.d. Laplace prior (LASSO Regression).
- Factor-Adjusted model (FarmSelect).
The data used in this project were retrieved from:
Barigozzi, M., & Lissona, C. (2024): EA-MD-QD: Large Euro Area and Euro Member Countries Datasets for Macroeconomic Research (Version 12.2023).
Zenodo DOI: 10.5281/ZENODO.10514668.
Bayesian_Shrinkage.R: Trains and compares forecasting methods for PCR, Ridge, and LASSO.FarmSelect.R: Implements the Factor-Adjusted Regression Model (FarmSelect).Forecasting_methods.R: Produces out-of-sample forecasts for all models.Covid_predictions.R: Produces counterfactual forecasts for the best-performing models during the COVID-19 pandemic (2020).
Bayesian_shrinkage_functions.R: Defines parameters and computes forecasts for PCR, LASSO, and Ridge regression.FarmSelect_functions.R: Defines parameters and computes forecasts for FarmSelect.
Data is stored in the data/EA-MD-QD/ folder.
Use the script Bayesian_Shrinkage.R to load and preprocess the data, ensuring the correct working directory is set.
If the source() function does not load the R functions correctly, manually run each function in the R/functions folder before executing the main scripts.
Descriptive_analysis.R: Provides a descriptive analysis of the dataset.
- Clone this repository to your local machine.
- Set the working directory to the project folder:
path <- "C:/Users/Davide/Desktop/Alma Mater/SECOND YEAR/Machine Learning/Machine-Learning-Project" setwd(path)