Class GeneralizedOrnsteinUhlenbeckProcess
- Namespace
- NanoQL.Experimental
- Assembly
- NanoQL.dll
The Ornstein-Uhlenbeck process dx = a(t)(level − x)dt + σ(t)dW with time-dependent speed and volatility: QuantLib's
GeneralizedOrnsteinUhlenbeckProcess.
[Experimental("NQL0001")]
public sealed class GeneralizedOrnsteinUhlenbeckProcess : StochasticProcess1D
- Inheritance
-
GeneralizedOrnsteinUhlenbeckProcess
- Inherited Members
Remarks
The expectation and the variance over a step take the speed and the volatility at the step's start. The variance,
σ²(1 − e^(−2aΔt))/(2a), cancels at small speed: QuantLib cuts to σ²Δt below a √ε, which jumps there and cancels just
above, and takes that cut for a negative speed too (the variance at −0.05 4.9% low). Here, below |a| 1e-2, it is
σ²·(−expm1(−2aΔt))/(2a), σ²Δt at a = 0, and QuantLib's formula at and above, a negative speed past −1e-2 on it
(Divergences/GeneralizedHullWhiteSmallReversionTests.cs).
Constructors
GeneralizedOrnsteinUhlenbeckProcess(Func<double, double>, Func<double, double>, double, double)
Initializes a new instance of the GeneralizedOrnsteinUhlenbeckProcess class.
public GeneralizedOrnsteinUhlenbeckProcess(Func<double, double> speed, Func<double, double> vol, double x0 = 0, double level = 0)
Parameters
speedFunc<double, double>The speed a(t).
volFunc<double, double>The volatility σ(t).
x0doubleThe initial value.
leveldoubleThe level the process reverts to.
Exceptions
- ArgumentNullException
speedorvolis null.- NanoQLException
The initial value or the level is negative, with QuantLib's texts.
Properties
Level
Gets the level the process reverts to.
public double Level { get; }
Property Value
X0
Gets the initial value of the state variable.
public override double X0 { get; }
Property Value
Methods
Diffusion(double, double)
The diffusion part of the equation, σ(t, x_t).
public override double Diffusion(double t, double x)
Parameters
Returns
- double
The diffusion.
Drift(double, double)
The drift part of the equation, μ(t, x_t).
public override double Drift(double t, double x)
Parameters
Returns
- double
The drift.
Expectation(double, double, double)
The expectation E(x_{t0 + Δt} | x_{t0} = x0) of the process after a time interval Δt; by default, the discretization's drift applied to x0 by Apply(double, double).
public override double Expectation(double t0, double x0, double dt)
Parameters
t0doubleThe start of the interval.
x0doubleThe state at its start.
dtdoubleThe interval's length.
Returns
- double
The expectation.
Exceptions
- NanoQLException
The process has no discretization.
Speed(double)
The speed at a time.
public double Speed(double t)
Parameters
tdoubleThe time.
Returns
- double
The speed.
StdDeviation(double, double, double)
The standard deviation S(x_{t0 + Δt} | x_{t0} = x0) of the process after a time interval Δt; by default, the discretization's diffusion.
public override double StdDeviation(double t0, double x0, double dt)
Parameters
t0doubleThe start of the interval.
x0doubleThe state at its start.
dtdoubleThe interval's length.
Returns
- double
The standard deviation.
Exceptions
- NanoQLException
The process has no discretization.
Variance(double, double, double)
The variance V(x_{t0 + Δt} | x_{t0} = x0) of the process after a time interval Δt; by default, the discretization's variance.
public override double Variance(double t0, double x0, double dt)
Parameters
t0doubleThe start of the interval.
x0doubleThe state at its start.
dtdoubleThe interval's length.
Returns
- double
The variance.
Remarks
Through expm1 below |a| 1e-2.
Exceptions
- NanoQLException
The process has no discretization.
Volatility(double)
The volatility at a time.
public double Volatility(double t)
Parameters
tdoubleThe time.
Returns
- double
The volatility.