Module net.finmath.lib
Class HybridAssetLIBORModelMonteCarloSimulationFromModels
- java.lang.Object
-
- net.finmath.montecarlo.hybridassetinterestrate.HybridAssetLIBORModelMonteCarloSimulationFromModels
-
- All Implemented Interfaces:
Model
,AssetModelMonteCarloSimulationModel
,IndependentModelParameterProvider
,HybridAssetLIBORModelMonteCarloSimulation
,LIBORModelMonteCarloSimulationModel
,TermStructureMonteCarloSimulationModel
,MonteCarloSimulationModel
public class HybridAssetLIBORModelMonteCarloSimulationFromModels extends Object implements HybridAssetLIBORModelMonteCarloSimulation
An Equity Hybrid LIBOR Market Model composed of an object implementingLIBORModelMonteCarloSimulationModel
providing the interest rate simulation and the numeraire and an object implementingAssetModelMonteCarloSimulationModel
providing the asset simulation. The interest rate model needs to be in spot measure.- Version:
- 1.0
- Author:
- Christian Fries
-
-
Constructor Summary
Constructors Constructor Description HybridAssetLIBORModelMonteCarloSimulationFromModels(LIBORModelMonteCarloSimulationModel liborSimulation, AssetModelMonteCarloSimulationModel assetSimulation)
HybridAssetLIBORModelMonteCarloSimulationFromModels(LIBORModelMonteCarloSimulationModel liborSimulation, AssetModelMonteCarloSimulationModel assetSimulation, DiscountCurve discountCurve)
Create an Equity Hybrid LIBOR Market Model composed of an object implementingLIBORModelMonteCarloSimulationModel
providing the interest rate simulation and the numeraire and an object implementingAssetModelMonteCarloSimulationModel
providing the asset simulation.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RandomVariable
getAssetValue(double time, int assetIndex)
Returns the random variable representing the asset's value at a given time for a given asset.RandomVariable
getAssetValue(int timeIndex, int assetIndex)
Returns the random variable representing the asset's value at a given time for a given asset.BrownianMotion
getBrownianMotion()
Returns the Brownian motion used to simulate the curve.HybridAssetLIBORModelMonteCarloSimulationFromModels
getCloneWithModifiedData(Map<String,Object> dataModified)
Create a clone of this simulation modifying some of its properties (if any).HybridAssetLIBORModelMonteCarloSimulationFromModels
getCloneWithModifiedSeed(int seed)
Deprecated.RandomVariable
getLIBOR(double time, double periodStart, double periodEnd)
Return the forward rate for a given simulation time and a given period start and period end.RandomVariable
getLIBOR(int timeIndex, int liborIndex)
Return the forward rate for a given simulation time index and a given forward rate index.double
getLiborPeriod(int timeIndex)
Returns the period start of the specified forward rate period.TimeDiscretization
getLiborPeriodDiscretization()
Returns the libor period discretization as time discretization representing start and end dates of periods.int
getLiborPeriodIndex(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.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
getNumberOfAssets()
Returns the number of asset price processes.int
getNumberOfFactors()
int
getNumberOfLibors()
int
getNumberOfPaths()
Returns the numberOfPaths.RandomVariable
getNumeraire(double time)
Return the numeraire at a given time.RandomVariable
getNumeraire(int timeIndex)
Returns the numeraire associated with the valuation measure used by this model.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
getLIBOR, getNumeraire
-
-
-
-
Constructor Detail
-
HybridAssetLIBORModelMonteCarloSimulationFromModels
public HybridAssetLIBORModelMonteCarloSimulationFromModels(LIBORModelMonteCarloSimulationModel liborSimulation, AssetModelMonteCarloSimulationModel assetSimulation, DiscountCurve discountCurve)
Create an Equity Hybrid LIBOR Market Model composed of an object implementingLIBORModelMonteCarloSimulationModel
providing the interest rate simulation and the numeraire and an object implementingAssetModelMonteCarloSimulationModel
providing the asset simulation. The interest rate model needs to be in spot measure.- Parameters:
liborSimulation
- An object implementingLIBORModelMonteCarloSimulationModel
providing the interest rate simulation and the numeraire.assetSimulation
- An object implementingAssetModelMonteCarloSimulationModel
providing the asset simulation.discountCurve
- An optional object implementingDiscountCurveInterface
to adjust the numeraire for a deterministic discounting spread.
-
HybridAssetLIBORModelMonteCarloSimulationFromModels
public HybridAssetLIBORModelMonteCarloSimulationFromModels(LIBORModelMonteCarloSimulationModel liborSimulation, AssetModelMonteCarloSimulationModel assetSimulation)
-
-
Method Detail
-
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 \).
-
getTimeDiscretization
public TimeDiscretization getTimeDiscretization()
Description copied from interface:MonteCarloSimulationModel
Returns the timeDiscretizationFromArray.- Specified by:
getTimeDiscretization
in interfaceMonteCarloSimulationModel
- Returns:
- Returns the timeDiscretizationFromArray.
-
getNumberOfFactors
public int getNumberOfFactors()
- Specified by:
getNumberOfFactors
in interfaceLIBORModelMonteCarloSimulationModel
- Returns:
- Returns the numberOfFactors.
-
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.
-
getLiborPeriodDiscretization
public TimeDiscretization getLiborPeriodDiscretization()
Description copied from interface:LIBORModelMonteCarloSimulationModel
Returns the libor period discretization as time discretization representing start and end dates of periods.- Specified by:
getLiborPeriodDiscretization
in interfaceLIBORModelMonteCarloSimulationModel
- Returns:
- Returns the libor period discretization
-
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.
-
getNumberOfLibors
public int getNumberOfLibors()
- Specified by:
getNumberOfLibors
in interfaceLIBORModelMonteCarloSimulationModel
- Returns:
- The number of LIBORs in the LIBOR discretization
-
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.
-
getLiborPeriod
public double getLiborPeriod(int timeIndex)
Description copied from interface:LIBORModelMonteCarloSimulationModel
Returns the period start of the specified forward rate period.- Specified by:
getLiborPeriod
in 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.
-
getLiborPeriodIndex
public int getLiborPeriodIndex(double time)
Description copied from interface:LIBORModelMonteCarloSimulationModel
Same 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:
getLiborPeriodIndex
in 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)
-
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.
-
getLIBOR
public RandomVariable getLIBOR(int timeIndex, int liborIndex) throws CalculationException
Description copied from interface:LIBORModelMonteCarloSimulationModel
Return the forward rate for a given simulation time index and a given forward rate index.- Specified by:
getLIBOR
in 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.
-
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.
-
getLIBOR
public RandomVariable getLIBOR(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:
getLIBOR
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.
-
getCloneWithModifiedData
public HybridAssetLIBORModelMonteCarloSimulationFromModels getCloneWithModifiedData(Map<String,Object> dataModified)
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 interfaceAssetModelMonteCarloSimulationModel
- 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 :-)
-
getLIBORs
public RandomVariable[] getLIBORs(int timeIndex) throws CalculationException
Description copied from interface:LIBORModelMonteCarloSimulationModel
Return the forward rate curve for a given simulation time index.- Specified by:
getLIBORs
in interfaceLIBORModelMonteCarloSimulationModel
- Parameters:
timeIndex
- Simulation time index.- Returns:
- The forward rate curve for a given simulation time index.
- Throws:
CalculationException
- Thrown if the valuation fails, specific cause may be available via thecause()
method.
-
getNumeraire
public RandomVariable getNumeraire(double time) throws CalculationException
Description copied from interface:TermStructureMonteCarloSimulationModel
Return the numeraire at a given time.- Specified by:
getNumeraire
in interfaceAssetModelMonteCarloSimulationModel
- 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.
-
getNumeraire
public RandomVariable getNumeraire(int timeIndex) throws CalculationException
Description copied from interface:AssetModelMonteCarloSimulationModel
Returns the numeraire associated with the valuation measure used by this model.- Specified by:
getNumeraire
in interfaceAssetModelMonteCarloSimulationModel
- Parameters:
timeIndex
- The time index (associated with this models time discretization).- Returns:
- The numeraire associated with the valuation measure used by this model.
- Throws:
CalculationException
- Thrown if calculation of numeraire fails.
-
getBrownianMotion
public BrownianMotion getBrownianMotion()
Description copied from interface:LIBORModelMonteCarloSimulationModel
Returns the Brownian motion used to simulate the curve.- Specified by:
getBrownianMotion
in interfaceLIBORModelMonteCarloSimulationModel
- Returns:
- The Brownian motion used to simulate the curve.
-
getModel
public TermStructureModel getModel()
Description copied from interface:LIBORModelMonteCarloSimulationModel
Returns the underlying model. The model specifies the measure, the initial value, the drift, the factor loadings (covariance model), etc.- Specified by:
getModel
in interfaceLIBORModelMonteCarloSimulationModel
- 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
@Deprecated public HybridAssetLIBORModelMonteCarloSimulationFromModels getCloneWithModifiedSeed(int seed)
Deprecated.Description copied from interface:LIBORModelMonteCarloSimulationModel
Return a clone of this model with a modified Brownian motion using a different seed.- Specified by:
getCloneWithModifiedSeed
in interfaceAssetModelMonteCarloSimulationModel
- Specified by:
getCloneWithModifiedSeed
in interfaceLIBORModelMonteCarloSimulationModel
- Parameters:
seed
- The seed- Returns:
- Clone of this object, but having a different seed.
- See Also:
LIBORModelMonteCarloSimulationModel.getCloneWithModifiedSeed(int)
-
getNumberOfAssets
public int getNumberOfAssets()
Description copied from interface:AssetModelMonteCarloSimulationModel
Returns the number of asset price processes.- Specified by:
getNumberOfAssets
in interfaceAssetModelMonteCarloSimulationModel
- Returns:
- The number of asset price processes
-
getAssetValue
public RandomVariable getAssetValue(int timeIndex, int assetIndex) throws CalculationException
Description copied from interface:AssetModelMonteCarloSimulationModel
Returns the random variable representing the asset's value at a given time for a given asset.- Specified by:
getAssetValue
in interfaceAssetModelMonteCarloSimulationModel
- Parameters:
timeIndex
- Index of simulation timeassetIndex
- Index of the asset (0 for a single asset model)- Returns:
- The asset process as seen on simulation time
- Throws:
CalculationException
- Thrown if the valuation fails, specific cause may be available via thecause()
method.
-
getAssetValue
public RandomVariable getAssetValue(double time, int assetIndex) throws CalculationException
Description copied from interface:AssetModelMonteCarloSimulationModel
Returns the random variable representing the asset's value at a given time for a given asset.- Specified by:
getAssetValue
in interfaceAssetModelMonteCarloSimulationModel
- Parameters:
time
- Simulation timeassetIndex
- Index of the asset (0 for a single asset model)- Returns:
- The asset process as seen on simulation time
- 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.
-
-