This paper proposes a new approach to calculating the credit gap-the deviation of the credit-to-GDP ratio from its long-run trend-that weighs credit gap measures from different decomposition methods based on their out-of-sample forecasting performance. The results show that this weighted approach to estimating the credit gap outperforms other popular trend-cycle decomposition methods in predicting changes in the credit-to-GDP ratio. Furthermore, we demonstrate that an ensemble machine learning approach, such as a random forest model, can be used to create a credit gap suitable for assessing financial crisis risk in the U.S. and the U.K.
JEL Codes: C52, E44, G01.