Implementation:Avhz RustQuant FractionalOrnsteinUhlenbeck
| Knowledge Sources | |
|---|---|
| Domains | Stochastic_Processes, Quantitative_Finance |
| Last Updated | 2026-02-07 19:00 GMT |
Overview
Concrete implementation of the Fractional Ornstein-Uhlenbeck (fOU) stochastic process provided by the RustQuant library.
Description
The Fractional Ornstein-Uhlenbeck process extends the classical OU process by replacing standard Brownian Motion with Fractional Brownian Motion. The SDE is:
dX(t) = theta * (mu - X(t)) dt + sigma dB^H(t)
where B^H is a fractional Brownian Motion with Hurst parameter H. This process combines mean-reverting behavior with long-range dependence, allowing the model to capture memory effects in the dynamics.
Key parameters:
- mu (ModelParameter) -- The long-run mean level
- sigma (ModelParameter) -- The volatility (must be non-negative)
- 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 mean-reverting quantities that exhibit long-range dependence, such as volatility processes with persistence or interest rates with slowly decaying autocorrelations. The fractional extension is useful when standard OU fails to capture the observed memory structure in time series data.
Code Reference
Source Location
- Repository: RustQuant
- File: crates/RustQuant_stochastics/src/fractional_ornstein_uhlenbeck.rs
- Lines: 1-109
Signature
pub struct FractionalOrnsteinUhlenbeck {
pub mu: ModelParameter,
pub sigma: ModelParameter,
pub theta: ModelParameter,
pub hurst: f64,
pub method: FractionalProcessGeneratorMethod,
}
impl FractionalOrnsteinUhlenbeck {
pub fn new(
mu: impl Into<ModelParameter>,
sigma: impl Into<ModelParameter>,
theta: impl Into<ModelParameter>,
hurst: f64,
method: FractionalProcessGeneratorMethod,
) -> Self
}
impl StochasticProcess for FractionalOrnsteinUhlenbeck {
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::FractionalOrnsteinUhlenbeck;
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 (must be non-negative) |
| 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) -- constant diffusion coefficient |
| jump() | Option<f64> | Always returns None |
| parameters() | Vec<f64> | Returns [mu(0), sigma(0), theta(0), hurst] |
| generate() | Trajectories | Simulated paths using fractional Gaussian noise |
Usage Examples
use RustQuant::stochastics::FractionalOrnsteinUhlenbeck;
use RustQuant::stochastics::FractionalProcessGeneratorMethod;
use RustQuant::stochastics::{StochasticProcessConfig, StochasticScheme};
// Create an fOU process with mu=0.15, sigma=0.45, theta=0.01, H=0.7
let fou = FractionalOrnsteinUhlenbeck::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 = fou.generate(&config);
// Access simulated paths
let paths = &output.paths;