Class ExtendedOrnsteinUhlenbeckProcess
- Namespace
- NanoQL.Experimental
- Assembly
- NanoQL.dll
The extended Ornstein-Uhlenbeck process dx = a(b(t) − x)dt + σdW, its level b a function of time.
[Experimental("NQL0001")]
public sealed class ExtendedOrnsteinUhlenbeckProcess : StochasticProcess1D
- Inheritance
-
ExtendedOrnsteinUhlenbeckProcess
- Inherited Members
Remarks
Immutable. The expectation over a step integrates the level by the discretization chosen; the standard deviation and variance are the Ornstein-Uhlenbeck process's at level 0.
Two of QuantLib's defects are fixed (Divergences/ExtendedOrnsteinUhlenbeckExpectationTests.cs): the
trapezoidal rule's (1 − e^(−a·dt))/(a·dt), 0/0 at a speed of 0 and cancelling below, is a series below a·dt of 1e-2
and QuantLib's quotient from it; and the Gauss-Lobatto rule, whose integrand b(x)e^(ax) QuantLib integrates to an
absolute accuracy e^(a(t₀+dt)) puts out of reach (it throws from a(t₀+dt) of 35), integrates the bounded
b(x)e^(−a(t₀+dt−x)) where a(t₀+dt) passes 30, with a relative accuracy of 1e-10 beside the absolute one, and
QuantLib's integrand at and below 30.
Constructors
ExtendedOrnsteinUhlenbeckProcess(double, double, double, Func<double, double>, ExtendedOrnsteinUhlenbeckProcessDiscretization, double)
Initializes a new instance of the ExtendedOrnsteinUhlenbeckProcess class.
public ExtendedOrnsteinUhlenbeckProcess(double speed, double sigma, double x0, Func<double, double> b, ExtendedOrnsteinUhlenbeckProcessDiscretization discretization = ExtendedOrnsteinUhlenbeckProcessDiscretization.MidPoint, double intEps = 0.0001)
Parameters
speeddoubleThe mean-reversion speed a, non-negative.
sigmadoubleThe volatility σ, non-negative.
x0doubleThe process's value today.
bFunc<double, double>The level b as a function of time.
discretizationExtendedOrnsteinUhlenbeckProcessDiscretizationHow a step's expectation integrates the level.
intEpsdoubleThe Gauss-Lobatto rule's absolute accuracy.
Exceptions
- ArgumentNullException
bis null.- ArgumentOutOfRangeException
The volatility is negative ("negative volatility given"), the speed is ("negative a given"), or the discretization isn't a member of its type.
Properties
Speed
Gets the mean-reversion speed a.
public double Speed { get; }
Property Value
Volatility
Gets the volatility σ.
public double Volatility { 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.
- NanoQLException
The Gauss-Lobatto rule doesn't converge.
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.
Exceptions
- NanoQLException
The process has no discretization.