Class G2ForwardProcess
The forward G2 stochastic process: G2Process's in the forward measure of a time T, its state again shifted so that z₁ + z₂ = r(t), with the T-forward corrections to the drift and the conditional expectation.
public sealed class G2ForwardProcess : ForwardMeasureProcess
- Inheritance
-
G2ForwardProcess
- Inherited Members
Remarks
The drift's corrections, QuantLib's −(σ²/a)(1 − e^(−a(T−t))) − (ρση/b)(1 − e^(−b(T−t))) and its mirror, are written as −σ²τf(aτ) − ρσητf(bτ), τ = T − t, f(x) = (1 − e^(−x))/x; the expectation's, QuantLib's Mx_T and My_T, as σ²τ₁f(aτ₁)[τ₂f(aτ₂) + ½e^(−aτ₂)τ₁f(aτ₁)] + ρσητ₁[τ₁D(aτ₁, bτ₁) + τ₂f(bτ₂)f((a+b)τ₁)], τ₁ = t − s, τ₂ = T − t, D(u, v) = (f(u) − f(u+v))/v, and their mirrors, every term positive; the correlation and φ as G2Process's: a divergence, QuantLib's terms cancelling at small reversion.
QuantLib's constructor leaves the forward measure time unset; WithForwardMeasureTime(double) gives a copy at one, and the drift and the expectation refuse to read an unset one.
Constructors
G2ForwardProcess(double, double, double, double, double, YieldTermStructure?)
Initializes a new instance of the G2ForwardProcess class, with no forward measure time.
public G2ForwardProcess(double a, double sigma, double b, double eta, double rho, YieldTermStructure? termStructure = null)
Parameters
adoubleThe first factor's mean reversion.
sigmadoubleThe first factor's volatility, not negative.
bdoubleThe second factor's mean reversion.
etadoubleThe second factor's volatility, not negative.
rhodoubleThe factors' correlation.
termStructureYieldTermStructureThe curve the shift fits; null, QuantLib's empty handle, for none.
Exceptions
- ArgumentOutOfRangeException
sigmaoretais negative or NaN.
Properties
A
Gets the first factor's mean reversion a.
public double A { get; }
Property Value
B
Gets the second factor's mean reversion b.
public double B { get; }
Property Value
Eta
Gets the second factor's volatility η.
public double Eta { get; }
Property Value
Rho
Gets the factors' correlation ρ.
public double Rho { get; }
Property Value
Sigma
Gets the first factor's volatility σ.
public double Sigma { get; }
Property Value
Size
Gets the number of dimensions of the process.
public override int Size { get; }
Property Value
TermStructure
Gets the curve the shift fits, or null for none.
public YieldTermStructure? TermStructure { get; }
Property Value
Methods
Covariance(double, Vector, double)
The covariance V(x_{t0 + Δt} | x_{t0} = x0) of the process after a time interval Δt; by default, the discretization's covariance.
public override Matrix Covariance(double t0, Vector x0, double dt)
Parameters
t0doubleThe start of the interval.
x0VectorThe state at its start.
dtdoubleThe interval's length.
Returns
- Matrix
A new matrix.
Exceptions
- NanoQLException
The process has no discretization.
Diffusion(double, Vector)
The diffusion part of the equation, σ(t, x_t).
public override Matrix Diffusion(double t, Vector x)
Parameters
Returns
- Matrix
A new matrix.
Drift(double, Vector)
The drift part of the equation, μ(t, x_t).
public override Vector Drift(double t, Vector x)
Parameters
Returns
- Vector
A new vector.
Exceptions
- NanoQLException
The process has no forward measure time.
- ArgumentException
xholds fewer values than the state, where QuantLib reads past its end.
Expectation(double, Vector, 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(Vector, Vector).
public override Vector Expectation(double t0, Vector x0, double dt)
Parameters
t0doubleThe start of the interval.
x0VectorThe state at its start.
dtdoubleThe interval's length.
Returns
- Vector
A new vector.
Exceptions
- NanoQLException
The process has no discretization.
- NanoQLException
The process has no forward measure time.
- ArgumentException
x0holds fewer values than the state, where QuantLib reads past its end.
InitialValues()
The initial values of the state variables.
public override Vector InitialValues()
Returns
- Vector
A new vector.
Phi(double)
The shift φ(t), as Phi(double)'s.
public double Phi(double t)
Parameters
tdoubleThe time.
Returns
- double
φ(t).
Exceptions
- NanoQLException
The process has no curve.
ShortRate(double, double, double)
The short rate at the state: z₁ + z₂.
public double ShortRate(double t, double z1, double z2)
Parameters
Returns
- double
The short rate.
StdDeviation(double, Vector, 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 Matrix StdDeviation(double t0, Vector x0, double dt)
Parameters
t0doubleThe start of the interval.
x0VectorThe state at its start.
dtdoubleThe interval's length.
Returns
- Matrix
A new matrix.
Exceptions
- NanoQLException
The process has no discretization.
- ArgumentException
x0holds fewer values than the state, where QuantLib reads past its end.
WithForwardMeasureTime(double)
A copy of the process at another forward measure time.
public override G2ForwardProcess WithForwardMeasureTime(double forwardMeasureTime)
Parameters
forwardMeasureTimedoubleThe forward measure time T.
Returns
- G2ForwardProcess
The copy; the receiver doesn't change.