Module net.finmath.lib
Class TermStructureMonteCarloSimulationFromTermStructureModel
- java.lang.Object
-
- net.finmath.montecarlo.interestrate.TermStructureMonteCarloSimulationFromTermStructureModel
-
- All Implemented Interfaces:
Model
,IndependentModelParameterProvider
,TermStructureMonteCarloSimulationModel
,MonteCarloSimulationModel
public class TermStructureMonteCarloSimulationFromTermStructureModel extends Object implements TermStructureMonteCarloSimulationModel
Implements convenient methods for a LIBOR market model, based on a givenLIBORMarketModelFromCovarianceModel
model andAbstractLogNormalProcess
process.- Version:
- 0.9
- Author:
- Christian Fries
-
-
Constructor Summary
Constructors Constructor Description TermStructureMonteCarloSimulationFromTermStructureModel(TermStructureModel model, MonteCarloProcess process)
Create a LIBOR Monte-Carlo Simulation from a given LIBORMarketModelFromCovarianceModel and an MonteCarloProcessFromProcessModel.TermStructureMonteCarloSimulationFromTermStructureModel(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 TermStructureMonteCarloSimulationModel
getCloneWithModifiedData(String entityKey, Object dataModified)
Create a clone of this simulation modifying one of its properties (if any).TermStructureMonteCarloSimulationModel
getCloneWithModifiedData(Map<String,Object> dataModified)
Create a clone of this simulation modifying some of its properties (if any).Object
getCloneWithModifiedSeed(int seed)
Return a clone of this model with a modified Brownian motion using a different seed.RandomVariable
getForwardRate(double time, double periodStart, double periodEnd)
Return the forward rate for a given simulation time and a given period start and period end.TermStructureModel
getModel()
Returns the underlying model.Map<String,RandomVariable>
getModelParameters()
Returns a map of independent model parameters of this model.RandomVariable
getMonteCarloWeights(double time)
This method returns the weights of a weighted Monte Carlo method (the probability density).RandomVariable
getMonteCarloWeights(int timeIndex)
This method returns the weights of a weighted Monte Carlo method (the probability density).int
getNumberOfComponents()
int
getNumberOfFactors()
int
getNumberOfPaths()
Returns the numberOfPaths.RandomVariable
getNumeraire(double time)
Return the numeraire at a given time.MonteCarloProcess
getProcess()
RandomVariable
getRandomVariableForConstant(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
.LocalDateTime
getReferenceDate()
Returns the model's date corresponding to the time discretization's \( t = 0 \).double
getTime(int timeIndex)
Returns the time for a given time index.TimeDiscretization
getTimeDiscretization()
Returns the timeDiscretizationFromArray.int
getTimeIndex(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
getBrownianMotion, getForwardRate, getLIBOR, getLIBOR, getNumeraire
-
-
-
-
Constructor Detail
-
TermStructureMonteCarloSimulationFromTermStructureModel
public TermStructureMonteCarloSimulationFromTermStructureModel(TermStructureModel model, MonteCarloProcess process)
Create a LIBOR Monte-Carlo Simulation from a given LIBORMarketModelFromCovarianceModel and an MonteCarloProcessFromProcessModel.- Parameters:
model
- The LIBORMarketModelFromCovarianceModel.process
- The process.
-
TermStructureMonteCarloSimulationFromTermStructureModel
public TermStructureMonteCarloSimulationFromTermStructureModel(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:MonteCarloSimulationModel
This method returns the weights of a weighted Monte Carlo method (the probability density).- Specified by:
getMonteCarloWeights
in 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:MonteCarloSimulationModel
This method returns the weights of a weighted Monte Carlo method (the probability density).- Specified by:
getMonteCarloWeights
in 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:
getNumberOfFactors
in interfaceTermStructureMonteCarloSimulationModel
- Returns:
- Returns the numberOfFactors.
-
getNumberOfPaths
public int getNumberOfPaths()
Description copied from interface:MonteCarloSimulationModel
Returns the numberOfPaths.- Specified by:
getNumberOfPaths
in interfaceMonteCarloSimulationModel
- Returns:
- Returns the numberOfPaths.
-
getReferenceDate
public LocalDateTime getReferenceDate()
Description copied from interface:MonteCarloSimulationModel
Returns the model's date corresponding to the time discretization's \( t = 0 \).- Specified by:
getReferenceDate
in interfaceMonteCarloSimulationModel
- Returns:
- The model's date corresponding to the time discretization's \( t = 0 \).
-
getTime
public double getTime(int timeIndex)
Description copied from interface:MonteCarloSimulationModel
Returns the time for a given time index.- Specified by:
getTime
in interfaceMonteCarloSimulationModel
- Parameters:
timeIndex
- Time index- Returns:
- Returns the time for a given time index.
-
getTimeDiscretization
public TimeDiscretization getTimeDiscretization()
Description copied from interface:MonteCarloSimulationModel
Returns the timeDiscretizationFromArray.- Specified by:
getTimeDiscretization
in interfaceMonteCarloSimulationModel
- Returns:
- Returns the timeDiscretizationFromArray.
-
getTimeIndex
public int getTimeIndex(double time)
Description copied from interface:MonteCarloSimulationModel
Returns the time index for a given time.- Specified by:
getTimeIndex
in interfaceMonteCarloSimulationModel
- Parameters:
time
- The time.- Returns:
- Returns the time index for a given time.
-
getRandomVariableForConstant
public RandomVariable getRandomVariableForConstant(double value)
Description copied from interface:MonteCarloSimulationModel
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
.- Specified by:
getRandomVariableForConstant
in interfaceMonteCarloSimulationModel
- Parameters:
value
- The constant value to be used for initialized the random variable.- Returns:
- A new random variable.
-
getForwardRate
public RandomVariable getForwardRate(double time, double periodStart, double periodEnd) throws CalculationException
Description copied from interface:TermStructureMonteCarloSimulationModel
Return the forward rate for a given simulation time and a given period start and period end.- Specified by:
getForwardRate
in 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.
-
getNumberOfComponents
public int getNumberOfComponents()
-
getNumeraire
public RandomVariable getNumeraire(double time) throws CalculationException
Description copied from interface:TermStructureMonteCarloSimulationModel
Return the numeraire at a given time.- Specified by:
getNumeraire
in 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:TermStructureMonteCarloSimulationModel
Returns the underlying model. The model specifies the measure, the initial value, the drift, the factor loadings (covariance model), etc.- Specified by:
getModel
in interfaceTermStructureMonteCarloSimulationModel
- Returns:
- The underlying model
-
getProcess
public MonteCarloProcess getProcess()
- Specified by:
getProcess
in interfaceTermStructureMonteCarloSimulationModel
- Returns:
- The implementation of the process
-
getCloneWithModifiedSeed
public Object getCloneWithModifiedSeed(int seed)
Description copied from interface:TermStructureMonteCarloSimulationModel
Return a clone of this model with a modified Brownian motion using a different seed.- Specified by:
getCloneWithModifiedSeed
in interfaceTermStructureMonteCarloSimulationModel
- Parameters:
seed
- The seed- Returns:
- Clone of this object, but having a different seed.
-
getCloneWithModifiedData
public TermStructureMonteCarloSimulationModel getCloneWithModifiedData(Map<String,Object> dataModified) throws CalculationException
Description copied from interface:MonteCarloSimulationModel
Create 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:
getCloneWithModifiedData
in 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:IndependentModelParameterProvider
Returns a map of independent model parameters of this model.- Specified by:
getModelParameters
in interfaceIndependentModelParameterProvider
- Returns:
- Map of independent model parameters of this model.
-
-