Module net.finmath.lib
Class LIBORMarketModelStandard
- java.lang.Object
-
- net.finmath.montecarlo.model.AbstractProcessModel
-
- net.finmath.montecarlo.interestrate.models.LIBORMarketModelStandard
-
- All Implemented Interfaces:
IndependentModelParameterProvider,LIBORMarketModel,LIBORModel,TermStructureModel,ProcessModel
public class LIBORMarketModelStandard extends AbstractProcessModel implements LIBORMarketModel
Implements a basic LIBOR market model with some drift approximation methods.
The class implements different measure(drift) / numeraire pairs (terminal and spot).
The class specifies a LIBOR market model in its log-normal formulation, that is Lj = exp(Yj) where
dYj = μj dt + λ1,j dW1 + ... + λm,j dWm
seeProcessModelfor details on the implemented interface.
The model uses anAbstractLIBORCovarianceModelfor the specification of (λ1,j,...,λm,j) as a covariance model, which may have the ability to calibrate to swaptions.- Version:
- 1.1
- Author:
- Christian Fries
- See Also:
AbstractLIBORCovarianceModel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLIBORMarketModelStandard.Driftapproximationstatic classLIBORMarketModelStandard.Measure
-
Constructor Summary
Constructors Constructor Description LIBORMarketModelStandard(TimeDiscretization liborPeriodDiscretization, ForwardCurve forwardRateCurve, DiscountCurve discountCurve, LIBORCovarianceModel covarianceModel)Creates a LIBOR Market Model for given covariance.LIBORMarketModelStandard(TimeDiscretization liborPeriodDiscretization, ForwardCurve forwardRateCurve, DiscountCurve discountCurve, LIBORCovarianceModel covarianceModel, SwaptionMarketData swaptionMarketData)Creates a LIBOR Market Model for given covariance.LIBORMarketModelStandard(TimeDiscretization liborPeriodDiscretization, ForwardCurve forwardRateCurve, DiscountCurve discountCurve, LIBORCovarianceModel covarianceModel, CalibrationProduct[] calibrationProducts)Creates a LIBOR Market Model for given covariance.LIBORMarketModelStandard(TimeDiscretization liborPeriodDiscretization, ForwardCurve forwardRateCurve, LIBORCovarianceModel covarianceModel)Creates a LIBOR Market Model for given covariance.LIBORMarketModelStandard(TimeDiscretization liborPeriodDiscretization, ForwardCurve forwardRateCurve, LIBORCovarianceModel covarianceModel, SwaptionMarketData swaptionMarketData)Creates a LIBOR Market Model using a given covariance model and calibrating this model to given swaption volatility data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RandomVariableapplyStateSpaceTransform(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable randomVariable)Applies the state space transform fi to the given state random variable such that Yi → fi(Yi) =: Xi.RandomVariableapplyStateSpaceTransformInverse(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable randomVariable)Applies the inverse state space transform f-1i to the given random variable such that Xi → f-1i(Xi) =: Yi.Objectclone()AnalyticModelgetAnalyticModel()Return the associated analytic model, a collection of market date object like discount curve, forward curve and volatility surfaces.LIBORMarketModelStandardgetCloneWithModifiedCovarianceModel(LIBORCovarianceModel covarianceModel)Create a new object implementing LIBORMarketModel, using the new covariance model.LIBORMarketModelStandardgetCloneWithModifiedData(Map<String,Object> dataModified)Create a new object implementing LIBORModel, using the new data.LIBORCovarianceModelgetCovarianceModel()Return the forward rate (LIBOR) covariance model.DiscountCurvegetDiscountCurve()Return the discount curve associated the forwards.RandomVariable[]getDrift(MonteCarloProcess process, int timeIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor)Return the complete vector of the drift for the time index timeIndex, given that current state is realizationAtTimeIndex.LIBORMarketModelStandard.DriftapproximationgetDriftApproximationMethod()protected RandomVariablegetDriftEuler(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable[] liborVectorStart)RandomVariable[]getFactorLoading(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable[] realizationAtTimeIndex)This method has to be implemented to return the factor loadings, i.e.ForwardCurvegetForwardRateCurve()Return the initial forward rate curve.RandomVariable[]getInitialState(MonteCarloProcess process)Returns the initial value of the state variable of the process Y, not to be confused with the initial value of the model X (which is the state space transform applied to this state value.double[][][]getIntegratedLIBORCovariance(TimeDiscretization simulationTimeDiscretization)Returns the integrated instantaneous log-forward rate covariance, i.e., \( \int_{0}^{t_i} \mathrm{d} \log(L_{j}) \mathrm{d} \log(L_{k}) \mathrm{d}t \).RandomVariablegetLIBOR(MonteCarloProcess process, double time, double periodStart, double periodEnd)Returns the time \( t \) forward rate on the models forward curve.RandomVariablegetLIBOR(MonteCarloProcess process, int timeIndex, int liborIndex)Return the forward rate at a given timeIndex and for a given liborIndex.doublegetLiborPeriod(int timeIndex)The period start corresponding to a given forward rate discretization index.TimeDiscretizationgetLiborPeriodDiscretization()The tenor time discretization of the forward rate curve.intgetLiborPeriodIndex(double time)Same as java.util.Arrays.binarySearch(liborPeriodDiscretization,time).LIBORMarketModelStandard.MeasuregetMeasure()Map<String,RandomVariable>getModelParameters()Returns a map of independent model parameters of this model.intgetNumberOfComponents()This method is just a synonym to getNumberOfLiborsintgetNumberOfFactors()Returns the number of factors m, i.e., the number of independent Brownian drivers.intgetNumberOfLibors()Get the number of LIBORs in the LIBOR discretization.RandomVariablegetNumeraire(MonteCarloProcess process, double time)Return the numeraire at a given time.RandomVariablegetRandomVariableForConstant(double value)Return a random variable initialized with a constant using the models random variable factory.SwaptionMarketDatagetSwaptionMarketData()Return the swaption market data used for calibration (if any, may be null).voidsetDriftApproximationMethod(LIBORMarketModelStandard.Driftapproximation driftApproximationMethod)voidsetMeasure(LIBORMarketModelStandard.Measure measure)-
Methods inherited from class net.finmath.montecarlo.model.AbstractProcessModel
getInitialValue, getReferenceDate
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.finmath.montecarlo.model.ProcessModel
getReferenceDate
-
Methods inherited from interface net.finmath.montecarlo.interestrate.TermStructureModel
getForwardDiscountBond
-
-
-
-
Constructor Detail
-
LIBORMarketModelStandard
public LIBORMarketModelStandard(TimeDiscretization liborPeriodDiscretization, ForwardCurve forwardRateCurve, LIBORCovarianceModel covarianceModel)
Creates a LIBOR Market Model for given covariance.- Parameters:
liborPeriodDiscretization- The discretization of the interest rate curve into forward rates (tenor structure).forwardRateCurve- The initial values for the forward rates.covarianceModel- The covariance model to use.
-
LIBORMarketModelStandard
public LIBORMarketModelStandard(TimeDiscretization liborPeriodDiscretization, ForwardCurve forwardRateCurve, DiscountCurve discountCurve, LIBORCovarianceModel covarianceModel)
Creates a LIBOR Market Model for given covariance.- Parameters:
liborPeriodDiscretization- The discretization of the interest rate curve into forward rates (tenor structure).forwardRateCurve- The initial values for the forward rates.discountCurve- The discount curve to use. This will create an LMM model with a deterministic zero-spread discounting adjustment.covarianceModel- The covariance model to use.
-
LIBORMarketModelStandard
public LIBORMarketModelStandard(TimeDiscretization liborPeriodDiscretization, ForwardCurve forwardRateCurve, LIBORCovarianceModel covarianceModel, SwaptionMarketData swaptionMarketData) throws CalculationException
Creates a LIBOR Market Model using a given covariance model and calibrating this model to given swaption volatility data.- Parameters:
liborPeriodDiscretization- The discretization of the interest rate curve into forward rates (tenor structure).forwardRateCurve- The initial values for the forward rates.covarianceModel- The covariance model to use.swaptionMarketData- The set of swaption values to calibrate to.- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
LIBORMarketModelStandard
public LIBORMarketModelStandard(TimeDiscretization liborPeriodDiscretization, ForwardCurve forwardRateCurve, DiscountCurve discountCurve, LIBORCovarianceModel covarianceModel, SwaptionMarketData swaptionMarketData) throws CalculationException
Creates a LIBOR Market Model for given covariance.- Parameters:
liborPeriodDiscretization- The discretization of the interest rate curve into forward rates (tenor structure).forwardRateCurve- The initial values for the forward rates.discountCurve- The discount curve to use. This will create an LMM model with a deterministic zero-spread discounting adjustment.covarianceModel- The covariance model to use.swaptionMarketData- The set of swaption values to calibrate to.- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
LIBORMarketModelStandard
public LIBORMarketModelStandard(TimeDiscretization liborPeriodDiscretization, ForwardCurve forwardRateCurve, DiscountCurve discountCurve, LIBORCovarianceModel covarianceModel, CalibrationProduct[] calibrationProducts) throws CalculationException
Creates a LIBOR Market Model for given covariance.- Parameters:
liborPeriodDiscretization- The discretization of the interest rate curve into forward rates (tenor structure).forwardRateCurve- The initial values for the forward rates.discountCurve- The discount curve to use. This will create an LMM model with a deterministic zero-spread discounting adjustment.covarianceModel- The covariance model to use.calibrationProducts- The vector of calibration items (a union of a product, target value and weight) for the objective function sum weight(i) * (modelValue(i)-targetValue(i).- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
-
Method Detail
-
getNumeraire
public RandomVariable getNumeraire(MonteCarloProcess process, double time) throws CalculationException
Return the numeraire at a given time. The numeraire is provided for interpolated points. If requested on points which are not part of the tenor discretization, the numeraire uses a linear interpolation of the reciprocal value. See ISBN 0470047224 for details.- Specified by:
getNumerairein interfaceProcessModel- Parameters:
time- Time time t for which the numeraire should be returned N(t).process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.- Returns:
- The numeraire at the specified time as
RandomVariableFromDoubleArray - Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getInitialState
public RandomVariable[] getInitialState(MonteCarloProcess process)
Description copied from interface:ProcessModelReturns the initial value of the state variable of the process Y, not to be confused with the initial value of the model X (which is the state space transform applied to this state value.- Specified by:
getInitialStatein interfaceProcessModel- Parameters:
process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.- Returns:
- The initial value of the state variable of the process Y(t=0).
-
getDrift
public RandomVariable[] getDrift(MonteCarloProcess process, int timeIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor)
Return the complete vector of the drift for the time index timeIndex, given that current state is realizationAtTimeIndex. Note: The random variable returned is a defensive copy and may be modified. The drift will be zero for rates being already fixed.- Specified by:
getDriftin interfaceProcessModel- Parameters:
process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.timeIndex- Time index i for which the drift should be returned μ(ti).realizationAtTimeIndex- Time current forward rate vector at time index i which should be used in the calculation.realizationPredictor- The given realization attimeIndex+1or null if no predictor is available.- Returns:
- The drift vector μ(ti) as
RandomVariableFromDoubleArray[] - See Also:
The calculation of the drift is consistent with the calculation of the numeraire in getNumeraire.
-
getFactorLoading
public RandomVariable[] getFactorLoading(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable[] realizationAtTimeIndex)
Description copied from interface:ProcessModelThis method has to be implemented to return the factor loadings, i.e. the coefficient vector
λj = (λ1,j, ..., λm,j) such that X = f(Y) and
dYj = μj dt + λ1,j dW1 + ... + λm,j dWm
in an m-factor model. Here j denotes index of the component of the resulting process.- Specified by:
getFactorLoadingin interfaceProcessModel- Parameters:
process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.timeIndex- The time index (related to the model times discretization).componentIndex- The index j of the driven component.realizationAtTimeIndex- The realization of X at the time corresponding to timeIndex (in order to implement local and stochastic volatlity models).- Returns:
- The factor loading for given factor and component.
-
applyStateSpaceTransform
public RandomVariable applyStateSpaceTransform(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable randomVariable)
Description copied from interface:ProcessModelApplies the state space transform fi to the given state random variable such that Yi → fi(Yi) =: Xi.- Specified by:
applyStateSpaceTransformin interfaceProcessModel- Parameters:
process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.timeIndex- The time index (related to the model times discretization).componentIndex- The component index i.randomVariable- The state random variable Yi.- Returns:
- New random variable holding the result of the state space transformation.
-
applyStateSpaceTransformInverse
public RandomVariable applyStateSpaceTransformInverse(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable randomVariable)
Description copied from interface:ProcessModelApplies the inverse state space transform f-1i to the given random variable such that Xi → f-1i(Xi) =: Yi.- Specified by:
applyStateSpaceTransformInversein interfaceProcessModel- Parameters:
process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.timeIndex- The time index (related to the model times discretization).componentIndex- The component index i.randomVariable- The state random variable Xi.- Returns:
- New random variable holding the result of the state space transformation.
-
getRandomVariableForConstant
public RandomVariable getRandomVariableForConstant(double value)
Description copied from interface:ProcessModelReturn a random variable initialized with a constant using the models random variable factory.- Specified by:
getRandomVariableForConstantin interfaceProcessModel- Parameters:
value- The constant value.- Returns:
- A new random variable initialized with a constant value.
-
getDriftApproximationMethod
public LIBORMarketModelStandard.Driftapproximation getDriftApproximationMethod()
- Returns:
- Returns the driftApproximationMethod.
-
getLIBOR
public RandomVariable getLIBOR(MonteCarloProcess process, double time, double periodStart, double periodEnd) throws CalculationException
Description copied from interface:TermStructureModelReturns the time \( t \) forward rate on the models forward curve. Note: It is guaranteed that the random variable returned by this method is \( \mathcal{F}_{t} ) \)-measurable.- Specified by:
getLIBORin interfaceTermStructureModel- Parameters:
process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.time- The evaluation time.periodStart- The period start of the forward rate.periodEnd- The period end of the forward rate.- Returns:
- The forward rate.
- Throws:
CalculationException- Thrown if model fails to calculate the random variable.
-
getLIBOR
public RandomVariable getLIBOR(MonteCarloProcess process, int timeIndex, int liborIndex) throws CalculationException
Description copied from interface:LIBORModelReturn the forward rate at a given timeIndex and for a given liborIndex.- Specified by:
getLIBORin interfaceLIBORModel- Parameters:
process- The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.timeIndex- The time index (associated withProcess.getTimeDiscretization().liborIndex- The forward rate index (associated withLIBORModel.getLiborPeriodDiscretization().- Returns:
- The forward rate.
- Throws:
CalculationException- Thrown if calculation failed.
-
getNumberOfComponents
public int getNumberOfComponents()
This method is just a synonym to getNumberOfLibors- Specified by:
getNumberOfComponentsin interfaceProcessModel- Returns:
- The number of components
-
getNumberOfFactors
public int getNumberOfFactors()
Description copied from interface:ProcessModelReturns the number of factors m, i.e., the number of independent Brownian drivers.- Specified by:
getNumberOfFactorsin interfaceProcessModel- Returns:
- The number of factors.
-
getNumberOfLibors
public int getNumberOfLibors()
Description copied from interface:LIBORModelGet the number of LIBORs in the LIBOR discretization.- Specified by:
getNumberOfLiborsin interfaceLIBORModel- Returns:
- The number of LIBORs in the LIBOR discretization
-
getLiborPeriod
public double getLiborPeriod(int timeIndex)
Description copied from interface:LIBORModelThe period start corresponding to a given forward rate discretization index.- Specified by:
getLiborPeriodin interfaceLIBORModel- Parameters:
timeIndex- The index corresponding to a given time (interpretation is start of period)- Returns:
- The period start corresponding to a given forward rate discretization index.
-
getLiborPeriodIndex
public int getLiborPeriodIndex(double time)
Description copied from interface:LIBORModelSame as java.util.Arrays.binarySearch(liborPeriodDiscretization,time). Will return a negative value if the time is not found, but then -index-1 corresponds to the index of the smallest time greater than the given one.- Specified by:
getLiborPeriodIndexin interfaceLIBORModel- Parameters:
time- The period start.- Returns:
- The index corresponding to a given time (interpretation is start of period)
-
getLiborPeriodDiscretization
public TimeDiscretization getLiborPeriodDiscretization()
Description copied from interface:LIBORModelThe tenor time discretization of the forward rate curve.- Specified by:
getLiborPeriodDiscretizationin interfaceLIBORModel- Returns:
- The tenor time discretization of the forward rate curve.
-
getDriftEuler
protected RandomVariable getDriftEuler(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable[] liborVectorStart)
-
getMeasure
public LIBORMarketModelStandard.Measure getMeasure()
- Returns:
- Returns the measure.
-
getIntegratedLIBORCovariance
public double[][][] getIntegratedLIBORCovariance(TimeDiscretization simulationTimeDiscretization)
Description copied from interface:LIBORMarketModelReturns the integrated instantaneous log-forward rate covariance, i.e., \( \int_{0}^{t_i} \mathrm{d} \log(L_{j}) \mathrm{d} \log(L_{k}) \mathrm{d}t \). The array returned has the parametrization [i][j][k], i.e.,integratedLIBORCovariance[timeIndex][componentIndex1][componentIndex2].- Specified by:
getIntegratedLIBORCovariancein interfaceLIBORMarketModel- Parameters:
simulationTimeDiscretization- The timeDiscretization used for the integration.- Returns:
- The integrated instantaneous log-LIBOR covariance.
-
setDriftApproximationMethod
public void setDriftApproximationMethod(LIBORMarketModelStandard.Driftapproximation driftApproximationMethod)
- Parameters:
driftApproximationMethod- The driftApproximationMethod to set.
-
setMeasure
public void setMeasure(LIBORMarketModelStandard.Measure measure)
- Parameters:
measure- The measure to set.
-
getAnalyticModel
public AnalyticModel getAnalyticModel()
Description copied from interface:TermStructureModelReturn the associated analytic model, a collection of market date object like discount curve, forward curve and volatility surfaces.- Specified by:
getAnalyticModelin interfaceTermStructureModel- Returns:
- The associated analytic model.
-
getDiscountCurve
public DiscountCurve getDiscountCurve()
Description copied from interface:TermStructureModelReturn the discount curve associated the forwards.- Specified by:
getDiscountCurvein interfaceTermStructureModel- Returns:
- the discount curve associated the forwards.
-
getForwardRateCurve
public ForwardCurve getForwardRateCurve()
Description copied from interface:TermStructureModelReturn the initial forward rate curve.- Specified by:
getForwardRateCurvein interfaceTermStructureModel- Returns:
- the forward rate curve
-
getSwaptionMarketData
public SwaptionMarketData getSwaptionMarketData()
Return the swaption market data used for calibration (if any, may be null).- Returns:
- The swaption market data used for calibration (if any, may be null).
-
getCovarianceModel
public LIBORCovarianceModel getCovarianceModel()
Description copied from interface:LIBORMarketModelReturn the forward rate (LIBOR) covariance model.- Specified by:
getCovarianceModelin interfaceLIBORMarketModel- Returns:
- The covariance model.
-
getCloneWithModifiedCovarianceModel
public LIBORMarketModelStandard getCloneWithModifiedCovarianceModel(LIBORCovarianceModel covarianceModel)
Description copied from interface:LIBORMarketModelCreate a new object implementing LIBORMarketModel, using the new covariance model.- Specified by:
getCloneWithModifiedCovarianceModelin interfaceLIBORMarketModel- Parameters:
covarianceModel- A covariance model- Returns:
- A new
LIBORMarketModelStandardusing the specified covariance model.
-
getCloneWithModifiedData
public LIBORMarketModelStandard getCloneWithModifiedData(Map<String,Object> dataModified) throws CalculationException
Description copied from interface:LIBORModelCreate a new object implementing LIBORModel, using the new data.- Specified by:
getCloneWithModifiedDatain interfaceLIBORModel- Specified by:
getCloneWithModifiedDatain interfaceProcessModel- Specified by:
getCloneWithModifiedDatain interfaceTermStructureModel- Parameters:
dataModified- A map with values to be used in constructions (keys are identical to parameter names of the constructors).- Returns:
- A new object implementing LIBORModel, using the new data.
- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getModelParameters
public Map<String,RandomVariable> getModelParameters()
Description copied from interface:IndependentModelParameterProviderReturns a map of independent model parameters of this model.- Specified by:
getModelParametersin interfaceIndependentModelParameterProvider- Returns:
- Map of independent model parameters of this model.
-
-