C# Class Pelsser.SquaredGaussianModel

Inheritance: IExtensibleProcessIR, IZeroRateReference, IMarkovSimulator, IParsable, IPostSimulationTransformation, IPopulable, IVectorialMarkovSimulator, IGreeksDerivativesInfo, IOpenCLCode, IExportableContainer
Afficher le fichier Open project: fairmat/InterestRatesModels Class Usage Examples

Méthodes publiques

Свойство Type Description
a1 IModelParameter
lamda0 IModelParameter
sigma1 IModelParameter

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
SIG ( double deltaT ) : double

Represents the variance of the model.

Private Methods

Méthode Description
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.

Method Details

A() public méthode

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. ///
Résultat double

AlphaT() public méthode

Gets alphaT at the position i.
public AlphaT ( int i ) : double
i int The position where to get the alphaT value.
Résultat double

B() public méthode

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.
Résultat double[]

BSingle() public méthode

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.
Résultat double

Bond() public méthode

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. ///
Résultat double

C() public méthode

Calculates the C(t, T) function of the model.
public C ( double deltaT ) : double
deltaT double The delta between T and t.
Résultat double

CalculateGamma() public méthode

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
Résultat void

D() public méthode

Calculates the D(t, T) function of the model.
public D ( double deltaT ) : double
deltaT double The delta between T and t.
Résultat double

ExportObjects() public méthode

Creates a list of all the sub-objects that can be edited.
public ExportObjects ( bool recursive ) : List
recursive bool /// The parameter is not used. ///
Résultat List

F() public méthode

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. ///
Résultat double

F2() public méthode

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. ///
Résultat double

GetDeltaFactors() public méthode

Returns the factors for Delta/Gamma Greek derivatives. In this case none so null is returned.
public GetDeltaFactors ( ) : IModelParameter[]
Résultat IModelParameter[]

GetVegaFactors() public méthode

Returns the factors for Vega Greek derivative. In this case just sigma1.
public GetVegaFactors ( ) : IModelParameter[]
Résultat IModelParameter[]

GetZeroRateReference() public méthode

Gets the zero rate reference.
public GetZeroRateReference ( ) : string
Résultat string

Int() public méthode

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.
Résultat double

Mu0() public méthode

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.
Résultat double

Parse() public méthode

Ensure the parameters are correct.
public Parse ( IProject p_Context ) : bool
p_Context IProject /// The underlying project. ///
Résultat bool

Populate() public méthode

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.
Résultat void

SIG() protected méthode

Represents the variance of the model.
protected SIG ( double deltaT ) : double
deltaT double The delta between T and t.
Résultat double

SetZeroRateReference() public méthode

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. ///
Résultat void

Setup() public méthode

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. ///
Résultat void

SquaredGaussianModel() public méthode

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
Résultat System

SquaredGaussianModel() public méthode

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.
Résultat System

Transform() public méthode

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.
Résultat void

a() public méthode

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.
Résultat void

ab() public méthode

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
Résultat void

b() public méthode

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.
Résultat void

f() public méthode

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. ///
Résultat double

isLog() public méthode

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. ///
Résultat void

va() public méthode

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.
Résultat void

vb() public méthode

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.
Résultat void

Property Details

a1 public_oe property

The mean reversion rate.
public IModelParameter a1
Résultat IModelParameter

lamda0 public_oe property

Market price of risk.
public IModelParameter lamda0
Résultat IModelParameter

sigma1 public_oe property

The diffusion parameter.
public IModelParameter sigma1
Résultat IModelParameter