C# 클래스 Pelsser.SquaredGaussianModel

상속: IExtensibleProcessIR, IZeroRateReference, IMarkovSimulator, IParsable, IPostSimulationTransformation, IPopulable, IVectorialMarkovSimulator, IGreeksDerivativesInfo, IOpenCLCode, IExportableContainer
파일 보기 프로젝트 열기: fairmat/InterestRatesModels 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
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