## Hungary’s Corporate Sector Risk: A Machine Learning Approach

## Source details

**Canonical URL:** [Hungary’s Corporate Sector Risk: A Machine Learning Approach](https://www.imf.org/-/media/files/publications/selected-issues-papers/2024/english/sipea2024038.pdf)

## Other formats

- [Markdown version](/-/media/files/publications/selected-issues-papers/2024/english/sipea2024038.pdf.md)
- [Structured JSON version](/-/media/files/publications/selected-issues-papers/2024/english/sipea2024038.pdf.json)

---

### Introduction
- Context and shocks
  - Hungary’s non-financial corporations faced multiple shocks: the pandemic, Russia’s war in Ukraine, energy price pressures, and a historic tightening of domestic monetary policy with market interest rates peaking at around 18 percent.
  - These shocks led to a marked rise in estimated probability of default (PD) for median listed firms at the onset of the pandemic, with PDs easing in 2021 and picking up again in 2022 amid forint depreciation, rising interest rates, and higher sovereign risk premia.
- Objectives
  - i) Explore general determinants of firms’ PDs over the past two decades using firm-specific and macroeconomic factors.
  - ii) Examine the influence of these determinants on firms’ PDs during and after the pandemic.
- Scope
  - Focus on non-financial corporations (NFCs) listed in Hungary’s stock market; robustness checks extend to seven other CESEE countries.

### Data and Methodology
- Data sources and sample
  - PD estimates from the Credit Research Initiative, National University of Singapore (NUS-CRI); PDs transformed via a logistic (logit) function.
  - Firm financial ratios from Orbis (cleaned per Kalemli-Ozcan et al. (2015)).
  - Macroeconomic variables: Hungary’s GDP growth, 10-year government bond yields, CDS spreads, EUR/HUF exchange rate from Haver.
  - Sample period: 2000-2022.
  - Baseline matched sample: 527 firm-year observations covering 55 unique firms, with 24 firms present on average each year.
  - Expanded sample (robustness): 1,182 firms and 10,086 firm-year observations, including Bulgaria, Croatia, Czech Republic, Poland, Romania, Slovakia, Slovenia.
- Machine learning approach
  - Candidate algorithms: elastic net, decision tree, K-nearest neighbors, random forest.
  - Model selection via cross-validation (folds allocated randomly, by firm size, and by time) to evaluate out-of-sample predictive performance.
  - Random forest produced the highest average coefficient of determination (akin to 푅ଶ) across cross-validation schemes and was selected as the final model.
- Transformations and technical notes
  - Logit transformation ensures predicted PDs lie in [0,1].
  - Shapley values used to summarize contributions of predictors to predicted PDs and to capture non-linearities and interactions.

### Determinants of Corporate Sector Risk (Key Findings)
- Top predictors (from random forest Shapley-value importance)
  - Return on assets (ROA) — top contributor; low ROA associated with higher PD.
  - Firm size — second most important; smaller firms associated with higher PD.
  - Cash equivalents to current liabilities (CE/CL) — third most important; lower liquidity buffers associated with higher PD.
  - Sovereign risk premia (CDS spreads) — fourth most important; higher CDS associated with higher PD.
  - Long-term interest rates and exchange rate (EUR/HUF) — relatively minor roles but contribute to PD variation.
  - GDP growth — limited predictive role when firm financial ratios are included.
- Non-linearity and interaction effects (from Shapley plots)
  - ROA and firm size: contributions to predicted PD fall sharply when ROA becomes positive or firms are sufficiently large.
  - Sovereign risk premia and long-term yields: contributions to predicted PD increase substantially when CDS spreads rise above around 170 and when bond yields exceed 7 percent.
  - Interaction examples:
    - The risk-reducing effects of higher profitability and larger size are stronger for firms with higher CE/CL.
    - Larger firms benefit more in risk reduction from declines in long-term interest rates than smaller firms.

### Risk Evolution Through the Pandemic and High Interest Rates (Findings)
- Pandemic onset (2019→2020)
  - Aggregate deterioration in risk indicators across the board at the onset of the pandemic.
  - Deteriorating profitability contributed the most to the observed rise in predicted PDs between 2019 and 2020.
  - Other contributors to the 2019–2020 PD rise included deterioration in liquidity buffers (CE/CL), firm size effects, GDP growth declines, and increases in sovereign risk premia (CDS), though these played a more limited role than profitability.
- Recovery year (2020→2021)
  - Significant improvement in predicted PDs in 2021 relative to 2020.
  - Improvements driven primarily by recoveries in firms’ profitability (ROA), followed by declines in CDS spreads and improvements in revenue growth and GDP growth.
- 2021→2022 evolution
  - Firm-level financial ratios continued to improve in 2022.
  - These beneficial firm-specific developments were more than offset by higher long-term interest rates and rising sovereign risk premia in 2022, leading to a pickup in aggregate predicted PDs.
  - Policy and market context: monetary policy tightening was successful in taming inflationary pressures but contributed to higher corporate sector risk via higher borrowing costs and increased sovereign premia.
- Maturity and repricing risk
  - A significant portion of corporate loans are set to mature within the next few years and could be repriced at higher interest rates, implying continued monitoring of interest rate and maturity risks.

### Robustness Check
- Rationale for expansion
  - Baseline sample’s limited number of firms and limited variation in macroeconomic variables could reduce precision.
- Results with expanded CESEE sample
  - Baseline findings on the general determinants of credit risk and on Hungary’s corporate risk evolution during and after the pandemic are robust to inclusion of the expanded sample (1,182 firms; 10,086 firm-year observations).
  - Shapley-value rankings and the dominant role of ROA, firm size, CE/CL, and sovereign risk premia remain consistent in the expanded sample.

### Policy Implications and Recommendations
- Monitor interest rate and maturity risks
  - Given that a significant portion of corporate loans will mature in the coming years and could be repriced at higher rates, policymakers and supervisors should continue close monitoring of corporate balance sheets and refinancing risks.
- Focus on liquidity and profitability resilience
  - Strengthening firms’ liquidity buffers (CE/CL) and profitability (ROA) reduces PDs non-linearly and interacts with firm size; policies that support these dimensions can materially lower corporate sector risk.
- Watch sovereign risk premia and long-term yields
  - CDS spreads above around 170 and bond yields above 7 percent are associated with material increases in predicted PDs; maintaining sovereign risk stability and limiting abrupt rises in long-term rates can mitigate corporate credit risk spillovers.
- Use of granular, firm-level monitoring tools
  - Machine learning approaches (random forest coupled with Shapley-value interpretation) provide actionable insights into non-linearities and interactions and can complement traditional monitoring frameworks.

*Source: IMF staff, “Hungary’s Corporate Sector Risk: A Machine Learning Approach” (SIP/2024/038), completed July 18, 2024.*

---


_Source: https://www.imf.org/-/media/files/publications/selected-issues-papers/2024/english/sipea2024038.pdf_
