Predicting Private Credit Growth (with Lag Structure) Using Machine Learning Models: Random Forest vs. XGBoost
Objective:
This project aims to predict next-year private credit growth (% of GDP) across countries using current-year macroeconomic variables.
By applying a lag structure, the model simulates a forward-looking framework for understanding credit dynamics—a perspective relevant for financial stability analysis and macroprudential oversight.
Data
Data Sources:
World Bank World Development Indicators
Time Period and Coverage:
Years: 1991–2023
Countries: Over 30 countries (adjust depending on the actual number)
Target Variable:
Private sector credit growth in year t+1
This prediction task incorporated a 1-year lag, meaning macro variables from year t were used to predict credit growth in t+1.
This approach aligns with practical applications in macroprudential surveillance, allowing the model to anticipate financial risks with a policy-relevant lead time.
Explanatory Variables (year t):
Real GDP growth
Inflation rate
Unemployment rate
Government expenditure-to-GDP ratio
Trade openness ((exports + imports)/GDP)
Models and Methodology
Random Forest (ntree = 100)
XGBoost (nrounds = 50, objective = "reg:squarederror")
Evaluation Metric: Mean Squared Error (MSE)
Results
Model Fit Comparison: Random Forest vs. XGBoost
Actual vs Predicted Credit Growth Plots:
Random Forest:
Strong alignment with the 45-degree ideal line
Stable performance in both low and high-growth ranges (0–150%)
Robust to outliers, with minimal overfitting