C# Класс Pelsser.SquaredGaussianModel

Наследование: IExtensibleProcessIR, IZeroRateReference, IMarkovSimulator, IParsable, IPostSimulationTransformation, IPopulable, IVectorialMarkovSimulator, IGreeksDerivativesInfo, IOpenCLCode, IExportableContainer
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
a1 IModelParameter
lamda0 IModelParameter
sigma1 IModelParameter

Открытые методы

Метод Описание
A ( int ti, int si, double delta, double btT ) : double

Calculates the function A(t, T) of the model, which is an integral.

AlphaT ( int i ) : double

Gets alphaT at the position i.

B ( int ti, int si, double delta ) : double[]

Calculates the function B(t, T) of the model, which is an integral, for all elements.

BSingle ( int ti, int si, double delta ) : double

Calculates the function B(t, T) of the model, which is an integral, for a single element.

Bond ( IReadOnlyMatrixSlice dynamic, double dates, int i, double t, double s ) : double

Calculates the value of a Bond under the Pelsser model.

C ( double deltaT ) : double

Calculates the C(t, T) function of the model.

CalculateGamma ( ) : void

This will simply calculate the gamma factor used in the Pelsser formulation and set the relative temporary variable.

Gamma = sqrt(a^2 + 2 * sigma^2).

D ( double deltaT ) : double

Calculates the D(t, T) function of the model.

ExportObjects ( bool recursive ) : List

Creates a list of all the sub-objects that can be edited.

F ( double T, double dt ) : double

Calculates F(T, dt) of the model.

F2 ( double T, double dt ) : double

Calculates F(T, dt) of the model, but doesn't apply the square root. This value is, as such equal to F-squared.

GetDeltaFactors ( ) : IModelParameter[]

Returns the factors for Delta/Gamma Greek derivatives. In this case none so null is returned.

GetVegaFactors ( ) : IModelParameter[]

Returns the factors for Vega Greek derivative. In this case just sigma1.

GetZeroRateReference ( ) : string

Gets the zero rate reference.

Int ( double t1, double t2 ) : double

Calculates the integral inside alpha(T).

Mu0 ( double T ) : double

Calculates the mu(t, T, y) used by the Caplets.

Parse ( IProject p_Context ) : bool

Ensure the parameters are correct.

Populate ( string names, double values ) : void

Populate editable fields from name and value vectors specific to Pelsser.

SetZeroRateReference ( string zr ) : void

Associate the process to a zero rate defined in the Fairmat model (e.g. @zr1).

Setup ( double dates ) : void

Called by Simulator after parse. Initializes here time-dependant but not state dependent variables.

SquaredGaussianModel ( ) : System

Default constructor. Builds a new SquaredGaussianModel with these default values: * sigma = 0.06. * lambda = 0.4. * alpha = 0.09. * no zero rate reference.

SquaredGaussianModel ( double sigma, double lambda, double a1, string zeroRateReference ) : System

Constructor which builds a new SquareGaussianModel with provided values.

Transform ( double dates, IMatrixSlice outDynamic ) : void

Handles the conversion, after the simulation, from y to the rate r.

a ( int i, double x, double a ) : void

This function defines the drift in the Pelsser Markov process. The formula to calculate the A component is A = - alpha * previous State.

ab ( int i, double x, double a, double b ) : void

This function defines the drift and the volatility in the Pelsser Markov process. The formula to calculate the A component is A = - alpha * previous State. B = sigma.

b ( int i, double x, double b ) : void

This function defines the volatility in the Pelsser Markov process. The formula to calculate the B component is B = sigma.

f ( double t, double dt ) : double

Calculates the instantaneous forward.

isLog ( bool &isLog ) : void

Sets the passed array with a Boolean stating if the process must be simulated as a log-normal process. In this case it should not.

va ( int i, Matrix x, Matrix a ) : void

This function defines the drift in the Pelsser Markov process. The formula to calculate the A component is A = - alpha * previous State. This is the version which handles a vectorial execution.

vb ( int i, Matrix x, Matrix b ) : void

This function defines the volatility in the Pelsser markov process. The formula to calculate the B component is B = sigma. This is the version which handles a vectorial execution.

Защищенные методы

Метод Описание
SIG ( double deltaT ) : double

Represents the variance of the model.

Приватные методы

Метод Описание
CalculateValueForCache ( double dates ) : void

Precalculates several values and functions of the model in order to cache them for later use.

OnDeserialized ( StreamingContext context ) : void
ZR ( double t ) : double

Helper function to make functions easier to read. Just returns the value of the zero rate at position t.

Описание методов

A() публичный Метод

Calculates the function A(t, T) of the model, which is an integral.
public A ( int ti, int si, double delta, double btT ) : double
ti int The starting Index from where to calculate.
si int The ending Index of the integration.
delta double The delta of time where to execute the calculation.
btT double /// A populated array with the results of the function B(s, T) of the model. ///
Результат double

AlphaT() публичный Метод

Gets alphaT at the position i.
public AlphaT ( int i ) : double
i int The position where to get the alphaT value.
Результат double

B() публичный Метод

Calculates the function B(t, T) of the model, which is an integral, for all elements.
public B ( int ti, int si, double delta ) : double[]
ti int The starting Index from where to calculate.
si int The ending Index of the integration.
delta double The delta of time where to execute the calculation.
Результат double[]

BSingle() публичный Метод

Calculates the function B(t, T) of the model, which is an integral, for a single element.
public BSingle ( int ti, int si, double delta ) : double
ti int The starting Index from where to calculate.
si int The ending Index of the integration.
delta double The delta of time where to execute the calculation.
Результат double

Bond() публичный Метод

Calculates the value of a Bond under the Pelsser model.
public Bond ( IReadOnlyMatrixSlice dynamic, double dates, int i, double t, double s ) : double
dynamic IReadOnlyMatrixSlice /// The simulated process. ///
dates double /// The vector of reference dates. ///
i int /// The index at which the state variables must be sampled. ///
t double /// The date in years/fractions at at which the state variables must be sampled. ///
s double /// The maturity of the bond. ///
Результат double

C() публичный Метод

Calculates the C(t, T) function of the model.
public C ( double deltaT ) : double
deltaT double The delta between T and t.
Результат double

CalculateGamma() публичный Метод

This will simply calculate the gamma factor used in the Pelsser formulation and set the relative temporary variable.
Gamma = sqrt(a^2 + 2 * sigma^2).
public CalculateGamma ( ) : void
Результат void

D() публичный Метод

Calculates the D(t, T) function of the model.
public D ( double deltaT ) : double
deltaT double The delta between T and t.
Результат double

ExportObjects() публичный Метод

Creates a list of all the sub-objects that can be edited.
public ExportObjects ( bool recursive ) : List
recursive bool /// The parameter is not used. ///
Результат List

F() публичный Метод

Calculates F(T, dt) of the model.
public F ( double T, double dt ) : double
T double The time where to calculate the function.
dt double /// The delta of time to consider to calculate the function. ///
Результат double

F2() публичный Метод

Calculates F(T, dt) of the model, but doesn't apply the square root. This value is, as such equal to F-squared.
public F2 ( double T, double dt ) : double
T double The time where to calculate the function.
dt double /// The delta of time to consider to calculate the function. ///
Результат double

GetDeltaFactors() публичный Метод

Returns the factors for Delta/Gamma Greek derivatives. In this case none so null is returned.
public GetDeltaFactors ( ) : IModelParameter[]
Результат IModelParameter[]

GetVegaFactors() публичный Метод

Returns the factors for Vega Greek derivative. In this case just sigma1.
public GetVegaFactors ( ) : IModelParameter[]
Результат IModelParameter[]

GetZeroRateReference() публичный Метод

Gets the zero rate reference.
public GetZeroRateReference ( ) : string
Результат string

Int() публичный Метод

Calculates the integral inside alpha(T).
public Int ( double t1, double t2 ) : double
t1 double The starting point of the integration.
t2 double The ending point of the integration.
Результат double

Mu0() публичный Метод

Calculates the mu(t, T, y) used by the Caplets.
public Mu0 ( double T ) : double
T double The span of time to calculate the function on.
Результат double

Parse() публичный Метод

Ensure the parameters are correct.
public Parse ( IProject p_Context ) : bool
p_Context IProject /// The underlying project. ///
Результат bool

Populate() публичный Метод

Populate editable fields from name and value vectors specific to Pelsser.
public Populate ( string names, double values ) : void
names string /// An array with the names of the variable, /// will search for alpha1 (or a), sigma1 (or sigma) and lamba0. ///
values double The values associated to the parameters in names.
Результат void

SIG() защищенный Метод

Represents the variance of the model.
protected SIG ( double deltaT ) : double
deltaT double The delta between T and t.
Результат double

SetZeroRateReference() публичный Метод

Associate the process to a zero rate defined in the Fairmat model (e.g. @zr1).
public SetZeroRateReference ( string zr ) : void
zr string /// The zero rate reference. ///
Результат void

Setup() публичный Метод

Called by Simulator after parse. Initializes here time-dependant but not state dependent variables.
public Setup ( double dates ) : void
dates double /// The dates at which the process realizations will be requested. ///
Результат void

SquaredGaussianModel() публичный Метод

Default constructor. Builds a new SquaredGaussianModel with these default values: * sigma = 0.06. * lambda = 0.4. * alpha = 0.09. * no zero rate reference.
public SquaredGaussianModel ( ) : System
Результат System

SquaredGaussianModel() публичный Метод

Constructor which builds a new SquareGaussianModel with provided values.
public SquaredGaussianModel ( double sigma, double lambda, double a1, string zeroRateReference ) : System
sigma double The sigma factor of the model.
lambda double The parameter is not used.
a1 double The alpha factor of the model.
zeroRateReference string A reference to a zero rate.
Результат System

Transform() публичный Метод

Handles the conversion, after the simulation, from y to the rate r.
public Transform ( double dates, IMatrixSlice outDynamic ) : void
dates double The parameter is not used.
outDynamic IMatrixSlice The input and output components of the transformation.
Результат void

a() публичный Метод

This function defines the drift in the Pelsser Markov process. The formula to calculate the A component is A = - alpha * previous State.
public a ( int i, double x, double a ) : void
i int The parameter is not used.
x double The state vector at the previous state.
a double The output of the function.
Результат void

ab() публичный Метод

This function defines the drift and the volatility in the Pelsser Markov process. The formula to calculate the A component is A = - alpha * previous State. B = sigma.
public ab ( int i, double x, double a, double b ) : void
i int The parameter is not used.
x double The state vector at the previous state.
a double The output drift.
b double
Результат void

b() публичный Метод

This function defines the volatility in the Pelsser Markov process. The formula to calculate the B component is B = sigma.
public b ( int i, double x, double b ) : void
i int The parameter is not used.
x double The parameter is not used.
b double The output of the function.
Результат void

f() публичный Метод

Calculates the instantaneous forward.
public f ( double t, double dt ) : double
t double The time where to calculate the instantaneous forward.
dt double /// The delta of time to consider to calculate the instantaneous forward. ///
Результат double

isLog() публичный Метод

Sets the passed array with a Boolean stating if the process must be simulated as a log-normal process. In this case it should not.
public isLog ( bool &isLog ) : void
isLog bool /// A reference to the array to be set with the required information. ///
Результат void

va() публичный Метод

This function defines the drift in the Pelsser Markov process. The formula to calculate the A component is A = - alpha * previous State. This is the version which handles a vectorial execution.
public va ( int i, Matrix x, Matrix a ) : void
i int The parameter is not used.
x Matrix The state Matrix at the previous state.
a Matrix The output of the function.
Результат void

vb() публичный Метод

This function defines the volatility in the Pelsser markov process. The formula to calculate the B component is B = sigma. This is the version which handles a vectorial execution.
public vb ( int i, Matrix x, Matrix b ) : void
i int The parameter is not used.
x Matrix The parameter is not used.
b Matrix The output of the function.
Результат void

Описание свойств

a1 публичное свойство

The mean reversion rate.
public IModelParameter a1
Результат IModelParameter

lamda0 публичное свойство

Market price of risk.
public IModelParameter lamda0
Результат IModelParameter

sigma1 публичное свойство

The diffusion parameter.
public IModelParameter sigma1
Результат IModelParameter