net.finmath.montecarlo.interestrate.models.covariance.LIBORCovarianceModel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of finmath-lib Show documentation
Show all versions of finmath-lib Show documentation
finmath lib is a Mathematical Finance Library in Java.
It provides algorithms and methodologies related to mathematical finance.
/*
* (c) Copyright Christian P. Fries, Germany. Contact: [email protected].
*
* Created on 20.05.2006
*/
package net.finmath.montecarlo.interestrate.models.covariance;
import java.util.Map;
import net.finmath.exception.CalculationException;
import net.finmath.montecarlo.interestrate.models.LIBORMarketModelFromCovarianceModel;
import net.finmath.stochastic.RandomVariable;
import net.finmath.time.TimeDiscretization;
/**
* Interface for covariance models providing a vector of (possibly stochastic) factor loadings.
*
* Classes implementing this interface can be used as "plug ins" for {@link LIBORMarketModelFromCovarianceModel}.
*
* @author Christian Fries
* @version 1.0
*/
public 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 in getTimeDiscretization
* 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 in getTimeDiscretization
* such that T_j ≤ T .
*
* @param time The time t at which factor loading is requested.
* @param component The component time (as a double associated with the fixing of the forward rate) Ti.
* @param realizationAtTimeIndex The realization of the stochastic process (may be used to implement local volatility/covariance/correlation models).
* @return The factor loading fi(t).
*/
RandomVariable[] getFactorLoading(double time, double component, RandomVariable[] realizationAtTimeIndex);
/**
* 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 in getTimeDiscretization
* such that t_i ≤ t .
*
* @param time The time t at which factor loading is requested.
* @param 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.
* @param realizationAtTimeIndex The realization of the stochastic process (may be used to implement local volatility/covariance/correlation models).
* @return The factor loading fi(t).
*/
RandomVariable[] getFactorLoading(double time, int component, RandomVariable[] realizationAtTimeIndex);
/**
* 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.
*
* @param timeIndex The time index at which factor loading is requested.
* @param component The index of the component i.
* @param realizationAtTimeIndex The realization of the stochastic process (may be used to implement local volatility/covariance/correlation models).
* @return The factor loading fi(t).
*/
RandomVariable[] getFactorLoading(int timeIndex, int component, RandomVariable[] realizationAtTimeIndex);
/**
* Returns the pseudo inverse of the factor matrix.
*
* @param timeIndex The time index at which factor loading inverse is requested.
* @param factor The index of the factor j.
* @param component The index of the component i.
* @param realizationAtTimeIndex The realization of the stochastic process (may be used to implement local volatility/covariance/correlation models).
* @return The entry of the pseudo-inverse of the factor loading matrix.
*/
RandomVariable getFactorLoadingPseudoInverse(int timeIndex, int component, int factor,
RandomVariable[] realizationAtTimeIndex);
/**
* Returns the instantaneous covariance calculated from factor loadings.
*
* @param time The time t at which covariance is requested.
* @param component1 Index of component i.
* @param component2 Index of component j.
* @param realizationAtTimeIndex The realization of the stochastic process.
* @return The instantaneous covariance between component i and j.
*/
RandomVariable getCovariance(double time, int component1, int component2, RandomVariable[] realizationAtTimeIndex);
/**
* Returns the instantaneous covariance calculated from factor loadings.
*
* @param timeIndex The time index at which covariance is requested.
* @param component1 Index of component i.
* @param component2 Index of component j.
* @param realizationAtTimeIndex The realization of the stochastic process.
* @return The instantaneous covariance between component i and j.
*/
RandomVariable getCovariance(int timeIndex, int component1, int component2,
RandomVariable[] realizationAtTimeIndex);
/**
* The simulation time discretization associated with this model.
*
* @return the timeDiscretizationFromArray
*/
TimeDiscretization getTimeDiscretization();
/**
* The forward rate time discretization associated with this model (defines the components).
*
* @return the forward rate time discretization associated with this model.
*/
TimeDiscretization getLiborPeriodDiscretization();
/**
* @return the numberOfFactors
*/
int getNumberOfFactors();
/**
* 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 map dataModified
. 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.
*
* @param dataModified Key-value-map of parameters to modify.
* @return 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.
*/
AbstractLIBORCovarianceModelParametric getCloneWithModifiedData(Map dataModified) throws CalculationException;
}