This repository implements a migration matrix-based Probability of Default (PD) model aligned with IFRS 9 Expected Credit Loss (ECL) requirements. The model estimates an Empirical Migration Matrix (EMM) from historical loan-level data and applies a Credit Cycle Index (CCI) that derived from the Vasicek (1987) single factor framework to condition the Through-the-Cycle (TTC) matrix into a Point-in-Time (PiT) matrix under multiple macroeconomic scenarios. The resulting PD term structures are suitable for Stage 1, Stage 2, and lifetime ECL calculation.
his project implements an EMM CCI PD Model designed to support IFRS 9 ECL calculation. The model estimates a TTC migration matrix from observed loan grade transitions, extracts a time series of Credit Cycle Index (Z-Score, Z-Index) that summarises the systematic credit environment at each period, and links it to macroeconomic variables to generate the forward-looking PiT migration matrices and cumulative PD Term structures.
The implementation emphasises:
- Transparent, auditable migration matrix construction suitable for model governance
- Closed-form and optimisation-based CCI Estimation
- Vectorised numerical computation for efficiency and scalability
- Flexible scenario conditioning across baseline, adverse, and severe paths
The resulting PD Term structures can be directly used in Stage 1 and Stage 2 ECL Calculation. The project is intended to serve as a practical reference implementation for credit risk practitioners, model developers, and validators. All calculations are made explicit, facilitating validation, backtesting, and model explainability.
pd_emm_cci_model/
├── model/ #Trainned model and parameters (pkl.)
│ ├── rho.pkl
│ ├── fwl_model.pkl
│ └── lifetime_pd_term_structure.pkl
├── notebooks/
│ ├── 01_data_preparation.ipynb
│ ├── 02_credit_cycle_index.ipynb
│ ├── 03_fwl_model.ipynb
│ └── 04_markov_liftetime.ipynb
├── src/
│ ├── data_prep.py
│ ├── migration_matrix_cci.py
│ ├── regression_model.py
│ ├── lifetime_model.py
│ ├── stats_testing.py
│ └── plot_function.py
├── data/
│ ├── processed/
| | ├── train_data.parquet #Not tracked by git
| | ├── migration_count.parquet
| | ├── average_matrix.parquet
| | ├── monthly_cci.parquet
| | ├── mev_transformed.parquet
| | └── mev_sign_transformed.parquet
│ └── raw/
| | ├── usedcar_transaction_score.parquet #Not tracked by git
| └── └── mev_data.csv
├── requirements.txt
└── README.md
Empirical Migration Matrix: A Through-the-Cycle (TTC) Migration matrix is estimated from historical loan level data by tracking grade transitions over a defined observation window. For each period, the number of transitions from grade
CCI Model: The Credit Cycle Index is estimated by fitting a time-varying Z-Score to each period's observed migration matrix. Based on the Vasicek (1987) single-factor model:
The transition probabilities are expressed as threshold crossings of a standard normal distribution (Belkin, Suchower & Forest, 1998). For each period
The forward-looking model processes are finding the relationship between Credit Cycle Index (CCI, Z-Index) with macroeconomics varialbes (MEV). The processes are similar to others ODR Model but changed the dependence variabale from ODR to CCI. In this repository is not covered the forward-looking model but it can refer to this repository for the forward-looking model consideration.
The model back-testing of actual CCI and predicted CCI from the regression model have been displayed in the following section. The visualisation of model back-testing in the following:
Note: It is a ramdom selection model. No expert input in this model.
Conditional PIT Matrix: For each forecast horizon
The cumulative multi-periods of PD Term structures are derived by chaining:
The last column of
MIT · Built for learning purposes







