This repository contains a production-grade implementation of the Cox-Ingersoll-Ross (CIR) short-rate model, extended with the CIR++ framework. The core objective of this project is to model, calibrate, and predict the U.S. Treasury zero-coupon yield curve using the 3-Month yield as a proxy for the instantaneous short rate (
Designed with institutional rigor, the model demonstrates the ability to reconstruct unobserved maturities across the yield curve out-of-sample, consistently achieving a predictive
The project models the evolution of the instantaneous short rate under the risk-neutral measure using the CIR Stochastic Differential Equation (SDE):
To ensure exact calibration to any arbitrary initial market curve—an essential requirement for arbitrage-free derivative pricing—we extend the base CIR model to the CIR++ framework. This introduces a deterministic shift function
This project is broken down into a rigorous 5-phase pipeline:
-
Robust Data Engineering:
- Time-indexed interpolation for missing maturities.
- Microstructure outlier removal using rolling median constraints (
$\pm 5\sigma$ ). - Strict enforcement of the positivity floor to maintain the CIR square-root diffusion validity.
-
Base CIR & OLS Calibration:
- Discretization via the Euler-Maruyama scheme.
- Demonstration of unit-root persistence failure in standard time-series OLS calibration.
-
Cross-Sectional Affine Calibration:
- Leverages the affine term-structure representation of the CIR model.
- Two-stage numerical optimization: Differential Evolution (global stochastic search) followed by L-BFGS-B (local gradient refinement) to minimize cross-sectional Mean Squared Error.
-
CIR++ Deterministic Shift:
- Implementation of exact market curve matching, removing the structural limitations of the time-homogeneous base model.
-
Critical Quantitative Analysis:
- A deep-dive into model limitations, the zero-lower-bound (ZLB) restrictions, and the transition toward multi-factor rate models.
├── Stochastic_Yield_Curve_Project.ipynb # Main executable Colab/Jupyter Notebook
├── generate_notebook.py # Python generator script for the notebook
├── train_data.csv # Historical US Treasury yield data (2016 - 2024)
├── test_data.csv # Out-of-sample ground truth yield data (2024 - 2026)
├── test_data_3M.csv # Out-of-sample 3-Month proxy data
└── README.md # Project documentation
-
Clone the repository:
git clone https://github.com/yourusername/Stochastic-Yield-Curve-Prediction.git cd Stochastic-Yield-Curve-Prediction -
Install dependencies: The project requires standard scientific Python libraries:
pip install pandas numpy scipy matplotlib scikit-learn statsmodels
-
Execution:
- The entire pipeline is bundled in a single, perfectly formatted Jupyter Notebook.
- You can run the project locally via Jupyter:
jupyter notebook Stochastic_Yield_Curve_Project.ipynb
- Alternatively, you can upload
Stochastic_Yield_Curve_Project.ipynbdirectly to Google Colab and execute the cells sequentially.
The model successfully calibrates to the underlying stochastic dynamics of the historical yield curve. Upon cross-sectional optimization, the affine CIR predictor generalizes remarkably well. Tested on out-of-sample data (2024–2026), using only the 3-Month yield as input, the model reconstructs the rest of the yield curve with a pooled
This project is licensed under the MIT License. See the LICENSE file for more details.