Implementation:Avhz RustQuant FractionalCIR
| Knowledge Sources | |
|---|---|
| Domains | Stochastic_Processes, Quantitative_Finance |
| Last Updated | 2026-02-07 19:00 GMT |
Overview
Concrete implementation of the Fractional Cox-Ingersoll-Ross (fCIR) stochastic process provided by the RustQuant library.
Description
The Fractional Cox-Ingersoll-Ross model extends the classical CIR model by replacing standard Brownian Motion with Fractional Brownian Motion, introducing long-range dependence into the dynamics. The SDE is:
dX(t) = theta * (mu - X(t)) dt + sigma * sqrt(X(t)) dB^H(t)
where B^H is a fractional Brownian Motion with Hurst parameter H. The process retains the mean-reverting, square-root diffusion structure of CIR while incorporating memory effects through fractional noise.
Key parameters:
- mu (ModelParameter) -- The long-run mean level
- sigma (ModelParameter) -- The volatility
- theta (ModelParameter) -- Mean reversion speed
- hurst (f64) -- Hurst parameter in [0, 1]
- method (FractionalProcessGeneratorMethod) -- Method to generate fractional Gaussian noise
Usage
Use this process when modeling interest rates or intensities that exhibit long-range dependence or memory effects not captured by the standard CIR model. The fractional extension allows for more realistic modeling of term structure dynamics where autocorrelations decay slowly.
Code Reference
Source Location
- Repository: RustQuant
- File: crates/RustQuant_stochastics/src/fractional_cox_ingersoll_ross.rs
- Lines: 1-110
Signature
pub struct FractionalCoxIngersollRoss {
pub mu: ModelParameter,
pub sigma: ModelParameter,
pub theta: ModelParameter,
pub hurst: f64,
pub method: FractionalProcessGeneratorMethod,
}
impl FractionalCoxIngersollRoss {
pub fn new(
mu: impl Into<ModelParameter>,
sigma: impl Into<ModelParameter>,
theta: impl Into<ModelParameter>,
hurst: f64,
method: FractionalProcessGeneratorMethod,
) -> Self
}
impl StochasticProcess for FractionalCoxIngersollRoss {
fn drift(&self, x: f64, t: f64) -> f64
fn diffusion(&self, x: f64, t: f64) -> f64
fn jump(&self, _x: f64, _t: f64) -> Option<f64>
fn parameters(&self) -> Vec<f64>
fn generate(&self, config: &StochasticProcessConfig) -> Trajectories
}
Import
use RustQuant::stochastics::FractionalCoxIngersollRoss;
use RustQuant::stochastics::FractionalProcessGeneratorMethod;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| mu | impl Into<ModelParameter> | Yes | The long-run mean level |
| sigma | impl Into<ModelParameter> | Yes | The volatility |
| theta | impl Into<ModelParameter> | Yes | Mean reversion speed |
| hurst | f64 | Yes | Hurst parameter in [0, 1] |
| method | FractionalProcessGeneratorMethod | Yes | Method for generating fGN (CHOLESKY or FFT) |
Outputs
| Name | Type | Description |
|---|---|---|
| drift() | f64 | Returns theta(t) * (mu(t) - x) -- mean-reverting drift |
| diffusion() | f64 | Returns sigma(t) * sqrt(x) -- square-root diffusion |
| jump() | Option<f64> | Returns Some(0.0) |
| parameters() | Vec<f64> | Returns [mu(0), sigma(0), theta(0), hurst] |
| generate() | Trajectories | Simulated paths using fractional Gaussian noise |
Usage Examples
use RustQuant::stochastics::FractionalCoxIngersollRoss;
use RustQuant::stochastics::FractionalProcessGeneratorMethod;
use RustQuant::stochastics::{StochasticProcessConfig, StochasticScheme};
// Create a fractional CIR process with mu=0.15, sigma=0.45, theta=0.01, H=0.7
let fcir = FractionalCoxIngersollRoss::new(
0.15, 0.45, 0.01, 0.7, FractionalProcessGeneratorMethod::FFT,
);
// Configure simulation: x0=10.0, t_start=0.0, t_end=0.5, n_steps=100, 100 paths
let config = StochasticProcessConfig::new(
10.0, 0.0, 0.5, 100, StochasticScheme::EulerMaruyama, 100, false, None
);
let output = fcir.generate(&config);
// Access simulated paths
let paths = &output.paths;