Module net.finmath.lib
Class LIBORMonteCarloSimulationFromTermStructureModel
- java.lang.Object
-
- net.finmath.montecarlo.interestrate.LIBORMonteCarloSimulationFromTermStructureModel
-
- All Implemented Interfaces:
Model,IndependentModelParameterProvider,LIBORModelMonteCarloSimulationModel,TermStructureMonteCarloSimulationModel,MonteCarloSimulationModel
public class LIBORMonteCarloSimulationFromTermStructureModel extends Object implements LIBORModelMonteCarloSimulationModel
Implements convenient methods for a LIBOR market model, based on a givenLIBORMarketModelFromCovarianceModelmodel andAbstractLogNormalProcessprocess.- Version:
- 0.9
- Author:
- Christian Fries
-
-
Constructor Summary
Constructors Constructor Description LIBORMonteCarloSimulationFromTermStructureModel(TermStructureModel model, MonteCarloProcess process)Create a LIBOR Monte-Carlo Simulation from a given LIBORMarketModelFromCovarianceModel and an MonteCarloProcessFromProcessModel.LIBORMonteCarloSimulationFromTermStructureModel(MonteCarloProcess process)Create a LIBOR Monte-Carlo Simulation from a given LIBORMarketModelFromCovarianceModel and an MonteCarloProcessFromProcessModel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BrownianMotiongetBrownianMotion()Returns the Brownian motion used to simulate the curve.TermStructureMonteCarloSimulationModelgetCloneWithModifiedData(String entityKey, Object dataModified)Create a clone of this simulation modifying one of its properties (if any).LIBORModelMonteCarloSimulationModelgetCloneWithModifiedData(Map<String,Object> dataModified)Create a clone of this simulation modifying some of its properties (if any).ObjectgetCloneWithModifiedSeed(int seed)Return a clone of this model with a modified Brownian motion using a different seed.RandomVariablegetLIBOR(double time, double periodStart, double periodEnd)Return the forward rate for a given simulation time and a given period start and period end.RandomVariablegetLIBOR(int timeIndex, int liborIndex)Return the forward rate for a given simulation time index and a given forward rate index.doublegetLiborPeriod(int timeIndex)Returns the period start of the specified forward rate period.TimeDiscretizationgetLiborPeriodDiscretization()Returns the libor period discretization as time discretization representing start and end dates of periods.intgetLiborPeriodIndex(double time)Same as java.util.Arrays.binarySearch(liborPeriodDiscretization,time).RandomVariable[]getLIBORs(int timeIndex)Return the forward rate curve for a given simulation time index.TermStructureModelgetModel()Returns the underlying model.Map<String,RandomVariable>getModelParameters()Returns a map of independent model parameters of this model.RandomVariablegetMonteCarloWeights(double time)This method returns the weights of a weighted Monte Carlo method (the probability density).RandomVariablegetMonteCarloWeights(int timeIndex)This method returns the weights of a weighted Monte Carlo method (the probability density).intgetNumberOfComponents()intgetNumberOfFactors()intgetNumberOfLibors()intgetNumberOfPaths()Returns the numberOfPaths.RandomVariablegetNumeraire(double time)Return the numeraire at a given time.MonteCarloProcessgetProcess()RandomVariablegetRandomVariableForConstant(double value)Returns a random variable which is initialized to a constant, but has exactly the same number of paths or discretization points as the ones used by thisMonteCarloSimulationModel.LocalDateTimegetReferenceDate()Returns the model's date corresponding to the time discretization's \( t = 0 \).doublegetTime(int timeIndex)Returns the time for a given time index.TimeDiscretizationgetTimeDiscretization()Returns the timeDiscretizationFromArray.intgetTimeIndex(double time)Returns the time index for a given time.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.finmath.montecarlo.interestrate.TermStructureMonteCarloSimulationModel
getLIBOR, getNumeraire
-
-
-
-
Constructor Detail
-
LIBORMonteCarloSimulationFromTermStructureModel
public LIBORMonteCarloSimulationFromTermStructureModel(TermStructureModel model, MonteCarloProcess process)
Create a LIBOR Monte-Carlo Simulation from a given LIBORMarketModelFromCovarianceModel and an MonteCarloProcessFromProcessModel.- Parameters:
model- The LIBORMarketModelFromCovarianceModel.process- The process.
-
LIBORMonteCarloSimulationFromTermStructureModel
public LIBORMonteCarloSimulationFromTermStructureModel(MonteCarloProcess process)
Create a LIBOR Monte-Carlo Simulation from a given LIBORMarketModelFromCovarianceModel and an MonteCarloProcessFromProcessModel.- Parameters:
process- The process creating the model.
-
-
Method Detail
-
getMonteCarloWeights
public RandomVariable getMonteCarloWeights(int timeIndex) throws CalculationException
Description copied from interface:MonteCarloSimulationModelThis method returns the weights of a weighted Monte Carlo method (the probability density).- Specified by:
getMonteCarloWeightsin interfaceMonteCarloSimulationModel- Parameters:
timeIndex- Time index at which the process should be observed- Returns:
- A vector of positive weights which sums up to one
- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getMonteCarloWeights
public RandomVariable getMonteCarloWeights(double time) throws CalculationException
Description copied from interface:MonteCarloSimulationModelThis method returns the weights of a weighted Monte Carlo method (the probability density).- Specified by:
getMonteCarloWeightsin interfaceMonteCarloSimulationModel- Parameters:
time- Time at which the process should be observed- Returns:
- A vector of positive weights which sums up to one
- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getNumberOfFactors
public int getNumberOfFactors()
- Specified by:
getNumberOfFactorsin interfaceLIBORModelMonteCarloSimulationModel- Returns:
- Returns the numberOfFactors.
-
getNumberOfPaths
public int getNumberOfPaths()
Description copied from interface:MonteCarloSimulationModelReturns the numberOfPaths.- Specified by:
getNumberOfPathsin interfaceMonteCarloSimulationModel- Returns:
- Returns the numberOfPaths.
-
getReferenceDate
public LocalDateTime getReferenceDate()
Description copied from interface:MonteCarloSimulationModelReturns the model's date corresponding to the time discretization's \( t = 0 \).- Specified by:
getReferenceDatein interfaceMonteCarloSimulationModel- Returns:
- The model's date corresponding to the time discretization's \( t = 0 \).
-
getTime
public double getTime(int timeIndex)
Description copied from interface:MonteCarloSimulationModelReturns the time for a given time index.- Specified by:
getTimein interfaceMonteCarloSimulationModel- Parameters:
timeIndex- Time index- Returns:
- Returns the time for a given time index.
-
getTimeDiscretization
public TimeDiscretization getTimeDiscretization()
Description copied from interface:MonteCarloSimulationModelReturns the timeDiscretizationFromArray.- Specified by:
getTimeDiscretizationin interfaceMonteCarloSimulationModel- Returns:
- Returns the timeDiscretizationFromArray.
-
getTimeIndex
public int getTimeIndex(double time)
Description copied from interface:MonteCarloSimulationModelReturns the time index for a given time.- Specified by:
getTimeIndexin interfaceMonteCarloSimulationModel- Parameters:
time- The time.- Returns:
- Returns the time index for a given time.
-
getRandomVariableForConstant
public RandomVariable getRandomVariableForConstant(double value)
Description copied from interface:MonteCarloSimulationModelReturns a random variable which is initialized to a constant, but has exactly the same number of paths or discretization points as the ones used by thisMonteCarloSimulationModel.- Specified by:
getRandomVariableForConstantin interfaceMonteCarloSimulationModel- Parameters:
value- The constant value to be used for initialized the random variable.- Returns:
- A new random variable.
-
getBrownianMotion
public BrownianMotion getBrownianMotion()
Description copied from interface:LIBORModelMonteCarloSimulationModelReturns the Brownian motion used to simulate the curve.- Specified by:
getBrownianMotionin interfaceLIBORModelMonteCarloSimulationModel- Returns:
- The Brownian motion used to simulate the curve.
-
getLIBOR
public RandomVariable getLIBOR(int timeIndex, int liborIndex) throws CalculationException
Description copied from interface:LIBORModelMonteCarloSimulationModelReturn the forward rate for a given simulation time index and a given forward rate index.- Specified by:
getLIBORin interfaceLIBORModelMonteCarloSimulationModel- Parameters:
timeIndex- Simulation time index.liborIndex- TenorFromArray time index (index corresponding to the fixing of the forward rate).- Returns:
- The forward rate as a random variable.
- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getLIBORs
public RandomVariable[] getLIBORs(int timeIndex)
Description copied from interface:LIBORModelMonteCarloSimulationModelReturn the forward rate curve for a given simulation time index.- Specified by:
getLIBORsin interfaceLIBORModelMonteCarloSimulationModel- Parameters:
timeIndex- Simulation time index.- Returns:
- The forward rate curve for a given simulation time index.
-
getLIBOR
public RandomVariable getLIBOR(double time, double periodStart, double periodEnd) throws CalculationException
Description copied from interface:TermStructureMonteCarloSimulationModelReturn the forward rate for a given simulation time and a given period start and period end.- Specified by:
getLIBORin interfaceTermStructureMonteCarloSimulationModel- Parameters:
time- Simulation timeperiodStart- Start time of periodperiodEnd- End time of period- Returns:
- The forward rate as a random variable as seen on simulation time for the specified period.
- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getLiborPeriod
public double getLiborPeriod(int timeIndex)
Description copied from interface:LIBORModelMonteCarloSimulationModelReturns the period start of the specified forward rate period.- Specified by:
getLiborPeriodin interfaceLIBORModelMonteCarloSimulationModel- Parameters:
timeIndex- The index corresponding to a given time (interpretation is start of period)- Returns:
- The period start of the specified forward rate period.
-
getLiborPeriodDiscretization
public TimeDiscretization getLiborPeriodDiscretization()
Description copied from interface:LIBORModelMonteCarloSimulationModelReturns the libor period discretization as time discretization representing start and end dates of periods.- Specified by:
getLiborPeriodDiscretizationin interfaceLIBORModelMonteCarloSimulationModel- Returns:
- Returns the libor period discretization
-
getLiborPeriodIndex
public int getLiborPeriodIndex(double time)
Description copied from interface:LIBORModelMonteCarloSimulationModelSame 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 interfaceLIBORModelMonteCarloSimulationModel- Parameters:
time- The tenor time (fixing of the forward rate) for which the index is requested.- Returns:
- The index corresponding to a given time (interpretation is start of period)
-
getNumberOfComponents
public int getNumberOfComponents()
-
getNumberOfLibors
public int getNumberOfLibors()
- Specified by:
getNumberOfLiborsin interfaceLIBORModelMonteCarloSimulationModel- Returns:
- The number of LIBORs in the LIBOR discretization
-
getNumeraire
public RandomVariable getNumeraire(double time) throws CalculationException
Description copied from interface:TermStructureMonteCarloSimulationModelReturn the numeraire at a given time.- Specified by:
getNumerairein interfaceTermStructureMonteCarloSimulationModel- Parameters:
time- Time at which the process should be observed- Returns:
- The numeraire at the specified time as
RandomVariableFromDoubleArray - Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getModel
public TermStructureModel getModel()
Description copied from interface:LIBORModelMonteCarloSimulationModelReturns the underlying model. The model specifies the measure, the initial value, the drift, the factor loadings (covariance model), etc.- Specified by:
getModelin interfaceLIBORModelMonteCarloSimulationModel- Specified by:
getModelin interfaceTermStructureMonteCarloSimulationModel- Returns:
- The underlying model
-
getProcess
public MonteCarloProcess getProcess()
- Specified by:
getProcessin interfaceTermStructureMonteCarloSimulationModel- Returns:
- The implementation of the process
-
getCloneWithModifiedSeed
public Object getCloneWithModifiedSeed(int seed)
Description copied from interface:LIBORModelMonteCarloSimulationModelReturn a clone of this model with a modified Brownian motion using a different seed.- Specified by:
getCloneWithModifiedSeedin interfaceLIBORModelMonteCarloSimulationModel- Parameters:
seed- The seed- Returns:
- Clone of this object, but having a different seed.
-
getCloneWithModifiedData
public LIBORModelMonteCarloSimulationModel getCloneWithModifiedData(Map<String,Object> dataModified) throws CalculationException
Description copied from interface:MonteCarloSimulationModelCreate a clone of this simulation modifying some of its properties (if any). The properties that should be modified correspond to arguments of constructors. A constructor is then called with where all arguments that are not found in the key value map are being set to this objects values.- Specified by:
getCloneWithModifiedDatain interfaceMonteCarloSimulationModel- Parameters:
dataModified- The data which should be changed in the new model. This is a key value may, where the key corresponds to the name of a property in one of the objects constructors.- Returns:
- Returns a clone of this object, with some data modified (then it is no longer a clone :-)
- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getCloneWithModifiedData
public TermStructureMonteCarloSimulationModel getCloneWithModifiedData(String entityKey, Object dataModified) throws CalculationException
Create a clone of this simulation modifying one of its properties (if any).- Parameters:
entityKey- The entity to modify.dataModified- The data which should be changed in the new model- Returns:
- Returns a clone of this model, where the specified part of the data is modified data (then it is no longer a clone :-)
- 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.
-
-