Table of Contents

Class G2ForwardProcess

Namespace
NanoQL.Processes
Assembly
NanoQL.dll

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

a double

The first factor's mean reversion.

sigma double

The first factor's volatility, not negative.

b double

The second factor's mean reversion.

eta double

The second factor's volatility, not negative.

rho double

The factors' correlation.

termStructure YieldTermStructure

The curve the shift fits; null, QuantLib's empty handle, for none.

Exceptions

ArgumentOutOfRangeException

sigma or eta is negative or NaN.

Properties

A

Gets the first factor's mean reversion a.

public double A { get; }

Property Value

double

B

Gets the second factor's mean reversion b.

public double B { get; }

Property Value

double

Eta

Gets the second factor's volatility η.

public double Eta { get; }

Property Value

double

Rho

Gets the factors' correlation ρ.

public double Rho { get; }

Property Value

double

Sigma

Gets the first factor's volatility σ.

public double Sigma { get; }

Property Value

double

Size

Gets the number of dimensions of the process.

public override int Size { get; }

Property Value

int

TermStructure

Gets the curve the shift fits, or null for none.

public YieldTermStructure? TermStructure { get; }

Property Value

YieldTermStructure

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

t0 double

The start of the interval.

x0 Vector

The state at its start.

dt double

The 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

t double

The time.

x Vector

The state.

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

t double

The time.

x Vector

The state.

Returns

Vector

A new vector.

Exceptions

NanoQLException

The process has no forward measure time.

ArgumentException

x holds 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

t0 double

The start of the interval.

x0 Vector

The state at its start.

dt double

The interval's length.

Returns

Vector

A new vector.

Exceptions

NanoQLException

The process has no discretization.

NanoQLException

The process has no forward measure time.

ArgumentException

x0 holds 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

t double

The 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

t double

The time, unused.

z1 double

The first component.

z2 double

The second component.

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

t0 double

The start of the interval.

x0 Vector

The state at its start.

dt double

The interval's length.

Returns

Matrix

A new matrix.

Exceptions

NanoQLException

The process has no discretization.

ArgumentException

x0 holds 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

forwardMeasureTime double

The forward measure time T.

Returns

G2ForwardProcess

The copy; the receiver doesn't change.