Module net.finmath.lib
Class AbstractLIBORCovarianceModel
- java.lang.Object
-
- net.finmath.montecarlo.interestrate.models.covariance.AbstractLIBORCovarianceModel
-
- All Implemented Interfaces:
Serializable
,LIBORCovarianceModel
- Direct Known Subclasses:
AbstractLIBORCovarianceModelParametric
public abstract class AbstractLIBORCovarianceModel extends Object implements Serializable, LIBORCovarianceModel
A base class and interface description for the instantaneous covariance of an forward rate interest rate model.- Version:
- 1.0
- Author:
- Christian Fries
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractLIBORCovarianceModel(TimeDiscretization timeDiscretization, TimeDiscretization liborPeriodDiscretization, int numberOfFactors)
Constructor consuming time discretizations, which are handled by the super class.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract AbstractLIBORCovarianceModelParametric
getCloneWithModifiedData(Map<String,Object> dataModified)
Returns a clone of this model where the specified properties have been modified.RandomVariable
getCovariance(double time, int component1, int component2, RandomVariable[] realizationAtTimeIndex)
Returns the instantaneous covariance calculated from factor loadings.RandomVariable
getCovariance(int timeIndex, int component1, int component2, RandomVariable[] realizationAtTimeIndex)
Returns the instantaneous covariance calculated from factor loadings.RandomVariable[]
getFactorLoading(double time, double component, RandomVariable[] realizationAtTimeIndex)
Return the factor loading for a given time and a given component.RandomVariable[]
getFactorLoading(double time, int component, RandomVariable[] realizationAtTimeIndex)
Return the factor loading for a given time and component index.abstract RandomVariable[]
getFactorLoading(int timeIndex, int component, RandomVariable[] realizationAtTimeIndex)
Return the factor loading for a given time index and component index.abstract RandomVariable
getFactorLoadingPseudoInverse(int timeIndex, int component, int factor, RandomVariable[] realizationAtTimeIndex)
Returns the pseudo inverse of the factor matrix.TimeDiscretization
getLiborPeriodDiscretization()
The forward rate time discretization associated with this model (defines the components).int
getNumberOfFactors()
TimeDiscretization
getTimeDiscretization()
The simulation time discretization associated with this model.
-
-
-
Constructor Detail
-
AbstractLIBORCovarianceModel
public AbstractLIBORCovarianceModel(TimeDiscretization timeDiscretization, TimeDiscretization liborPeriodDiscretization, int numberOfFactors)
Constructor consuming time discretizations, which are handled by the super class.- Parameters:
timeDiscretization
- The vector of simulation time discretization points.liborPeriodDiscretization
- The vector of tenor discretization points.numberOfFactors
- The number of factors to use (a factor reduction is performed)
-
-
Method Detail
-
getFactorLoading
public RandomVariable[] getFactorLoading(double time, double component, RandomVariable[] realizationAtTimeIndex)
Description copied from interface:LIBORCovarianceModel
Return the factor loading for a given time and a given component. The factor loading is the vector fi such that the scalar product
fjfk = fj,1fk,1 + ... + fj,mfk,m
is the instantaneous covariance of the component j and k. With respect to simulation time t, this method uses a piece wise constant interpolation, i.e., it calculates t_i such that t_i is the largest point ingetTimeDiscretization
such that t_i ≤ t . The component here, it given via a double T which may be associated with the LIBOR fixing date. With respect to component time T, this method uses a piece wise constant interpolation, i.e., it calculates T_j such that T_j is the largest point ingetTimeDiscretization
such that T_j ≤ T .- Specified by:
getFactorLoading
in interfaceLIBORCovarianceModel
- Parameters:
time
- The time t at which factor loading is requested.component
- The component time (as a double associated with the fixing of the forward rate) Ti.realizationAtTimeIndex
- The realization of the stochastic process (may be used to implement local volatility/covariance/correlation models).- Returns:
- The factor loading fi(t).
-
getFactorLoading
public RandomVariable[] getFactorLoading(double time, int component, RandomVariable[] realizationAtTimeIndex)
Description copied from interface:LIBORCovarianceModel
Return the factor loading for a given time and component index. The factor loading is the vector fi such that the scalar product
fjfk = fj,1fk,1 + ... + fj,mfk,m
is the instantaneous covariance of the component j and k. With respect to simulation time t, this method uses a piece wise constant interpolation, i.e., it calculates t_i such that t_i is the largest point ingetTimeDiscretization
such that t_i ≤ t .- Specified by:
getFactorLoading
in interfaceLIBORCovarianceModel
- Parameters:
time
- The time t at which factor loading is requested.component
- The index of the component i. Note that this class may have its own LIBOR time discretization and that this index refers to this discretization.realizationAtTimeIndex
- The realization of the stochastic process (may be used to implement local volatility/covariance/correlation models).- Returns:
- The factor loading fi(t).
-
getFactorLoading
public abstract RandomVariable[] getFactorLoading(int timeIndex, int component, RandomVariable[] realizationAtTimeIndex)
Description copied from interface:LIBORCovarianceModel
Return the factor loading for a given time index and component index. The factor loading is the vector fi such that the scalar product
fjfk = fj,1fk,1 + ... + fj,mfk,m
is the instantaneous covariance of the component j and k.- Specified by:
getFactorLoading
in interfaceLIBORCovarianceModel
- Parameters:
timeIndex
- The time index at which factor loading is requested.component
- The index of the component i.realizationAtTimeIndex
- The realization of the stochastic process (may be used to implement local volatility/covariance/correlation models).- Returns:
- The factor loading fi(t).
-
getFactorLoadingPseudoInverse
public abstract RandomVariable getFactorLoadingPseudoInverse(int timeIndex, int component, int factor, RandomVariable[] realizationAtTimeIndex)
Description copied from interface:LIBORCovarianceModel
Returns the pseudo inverse of the factor matrix.- Specified by:
getFactorLoadingPseudoInverse
in interfaceLIBORCovarianceModel
- Parameters:
timeIndex
- The time index at which factor loading inverse is requested.component
- The index of the component i.factor
- The index of the factor j.realizationAtTimeIndex
- The realization of the stochastic process (may be used to implement local volatility/covariance/correlation models).- Returns:
- The entry of the pseudo-inverse of the factor loading matrix.
-
getCovariance
public RandomVariable getCovariance(double time, int component1, int component2, RandomVariable[] realizationAtTimeIndex)
Description copied from interface:LIBORCovarianceModel
Returns the instantaneous covariance calculated from factor loadings.- Specified by:
getCovariance
in interfaceLIBORCovarianceModel
- Parameters:
time
- The time t at which covariance is requested.component1
- Index of component i.component2
- Index of component j.realizationAtTimeIndex
- The realization of the stochastic process.- Returns:
- The instantaneous covariance between component i and j.
-
getCovariance
public RandomVariable getCovariance(int timeIndex, int component1, int component2, RandomVariable[] realizationAtTimeIndex)
Description copied from interface:LIBORCovarianceModel
Returns the instantaneous covariance calculated from factor loadings.- Specified by:
getCovariance
in interfaceLIBORCovarianceModel
- Parameters:
timeIndex
- The time index at which covariance is requested.component1
- Index of component i.component2
- Index of component j.realizationAtTimeIndex
- The realization of the stochastic process.- Returns:
- The instantaneous covariance between component i and j.
-
getTimeDiscretization
public TimeDiscretization getTimeDiscretization()
Description copied from interface:LIBORCovarianceModel
The simulation time discretization associated with this model.- Specified by:
getTimeDiscretization
in interfaceLIBORCovarianceModel
- Returns:
- the timeDiscretizationFromArray
-
getLiborPeriodDiscretization
public TimeDiscretization getLiborPeriodDiscretization()
Description copied from interface:LIBORCovarianceModel
The forward rate time discretization associated with this model (defines the components).- Specified by:
getLiborPeriodDiscretization
in interfaceLIBORCovarianceModel
- Returns:
- the forward rate time discretization associated with this model.
-
getNumberOfFactors
public int getNumberOfFactors()
- Specified by:
getNumberOfFactors
in interfaceLIBORCovarianceModel
- Returns:
- the numberOfFactors
-
getCloneWithModifiedData
public abstract AbstractLIBORCovarianceModelParametric getCloneWithModifiedData(Map<String,Object> dataModified) throws CalculationException
Description copied from interface:LIBORCovarianceModel
Returns a clone of this model where the specified properties have been modified. Note that there is no guarantee that a model reacts on a specification of a properties in the parameter mapdataModified
. If data is provided which is ignored by the model no exception may be thrown. Furthermore the structure of the covariance model has to match changed data. A change of the time discretizations may requires a change in the parameters but this function will just insert the new time discretization without changing the parameters. An exception may not be thrown.- Specified by:
getCloneWithModifiedData
in interfaceLIBORCovarianceModel
- Parameters:
dataModified
- Key-value-map of parameters to modify.- Returns:
- A clone of this model (or a new instance of this model if no parameter was modified).
- Throws:
CalculationException
- Thrown when the model could not be created.
-
-