Module net.finmath.lib
Class MonteCarloMertonModel
- java.lang.Object
-
- net.finmath.montecarlo.assetderivativevaluation.MonteCarloMertonModel
-
- All Implemented Interfaces:
Model
,AssetModelMonteCarloSimulationModel
,MonteCarloSimulationModel
public class MonteCarloMertonModel extends Object implements AssetModelMonteCarloSimulationModel
This class glues together aMertonModel
and a Monte-Carlo implementation of aMonteCarloProcessFromProcessModel
, namelyEulerSchemeFromProcessModel
, and forms a Monte-Carlo implementation of the Merton model by implementingAssetModelMonteCarloSimulationModel
. The model is \[ dS = \mu S dt + \sigma S dW + S dJ, \quad S(0) = S_{0}, \] \[ dN = r N dt, \quad N(0) = N_{0}, \] where \( W \) is Brownian motion and \( J \) is a jump process (compound Poisson process). The process \( J \) is given by \( J(t) = \sum_{i=1}^{N(t)} (Y_{i}-1) \), where \( \log(Y_{i}) \) are i.i.d. normals with mean \( a - \frac{1}{2} b^{2} \) and standard deviation \( b \). Here \( a \) is the jump size mean and \( b \) is the jump size std. dev. For details on the construction of the model seeMertonModel
.- Version:
- 1.0
- Author:
- Christian Fries
- See Also:
MertonModel
,The interface for numerical schemes.
,The interface for models provinding parameters to numerical schemes.
-
-
Constructor Summary
Constructors Constructor Description MonteCarloMertonModel(TimeDiscretization timeDiscretization, int numberOfPaths, int seed, double initialValue, double riskFreeRate, double volatility, double jumpIntensity, double jumpSizeMean, double jumpSizeStDev)
Create a Monte-Carlo simulation using given time discretization and given parameters.
-
Method Summary
All Methods Instance Methods Concrete 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.AssetModelMonteCarloSimulationModel
getCloneWithModifiedData(Map<String,Object> dataModified)
Create a clone of this simulation modifying some of its properties (if any).AssetModelMonteCarloSimulationModel
getCloneWithModifiedSeed(int seed)
Create a clone of the object implementingAssetModelMonteCarloSimulationModel
using a different Monte-Carlo seed.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
getNumberOfPaths()
Returns the numberOfPaths.RandomVariable
getNumeraire(double time)
Returns the numeraire associated with the valuation measure used by this model.RandomVariable
getNumeraire(int timeIndex)
Returns the numeraire associated with the valuation measure used by this model.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.
-
-
-
Constructor Detail
-
MonteCarloMertonModel
public MonteCarloMertonModel(TimeDiscretization timeDiscretization, int numberOfPaths, int seed, double initialValue, double riskFreeRate, double volatility, double jumpIntensity, double jumpSizeMean, double jumpSizeStDev)
Create a Monte-Carlo simulation using given time discretization and given parameters.- Parameters:
timeDiscretization
- The time discretization.numberOfPaths
- The number of Monte-Carlo path to be used.seed
- The seed used for the random number generator.initialValue
- Spot value.riskFreeRate
- The risk free rate.volatility
- The log volatility.jumpIntensity
- The intensity parameter lambda of the compound Poisson process.jumpSizeMean
- The mean jump size of the normal distributes jump sizes of the compound Poisson process.jumpSizeStDev
- The standard deviation of the normal distributes jump sizes of the compound Poisson process.
-
-
Method Detail
-
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 \).
-
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.
-
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.
-
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.
-
getNumeraire
public RandomVariable getNumeraire(double time) 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:
time
- The time for which the numeraire is requested.- Returns:
- The numeraire associated with the valuation measure used by this model.
- Throws:
CalculationException
- Thrown if calculation of numeraire fails.
-
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.
-
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
-
getCloneWithModifiedData
public AssetModelMonteCarloSimulationModel getCloneWithModifiedData(Map<String,Object> dataModified)
Description copied from interface:AssetModelMonteCarloSimulationModel
Create a clone of this simulation modifying some of its properties (if any).- Specified by:
getCloneWithModifiedData
in interfaceAssetModelMonteCarloSimulationModel
- Specified by:
getCloneWithModifiedData
in interfaceMonteCarloSimulationModel
- Parameters:
dataModified
- The data which should be changed in the new model- Returns:
- Returns a clone of this model, with some data modified (then it is no longer a clone :-)
-
getCloneWithModifiedSeed
public AssetModelMonteCarloSimulationModel getCloneWithModifiedSeed(int seed)
Description copied from interface:AssetModelMonteCarloSimulationModel
Create a clone of the object implementingAssetModelMonteCarloSimulationModel
using a different Monte-Carlo seed.- Specified by:
getCloneWithModifiedSeed
in interfaceAssetModelMonteCarloSimulationModel
- Parameters:
seed
- The seed of the underlying random number generator.- Returns:
- Returns a clone of this model except for a modified Monte-Carlo seed.
-
getNumberOfPaths
public int getNumberOfPaths()
Description copied from interface:MonteCarloSimulationModel
Returns the numberOfPaths.- Specified by:
getNumberOfPaths
in interfaceMonteCarloSimulationModel
- Returns:
- Returns the numberOfPaths.
-
getTimeDiscretization
public TimeDiscretization getTimeDiscretization()
Description copied from interface:MonteCarloSimulationModel
Returns the timeDiscretizationFromArray.- Specified by:
getTimeDiscretization
in interfaceMonteCarloSimulationModel
- Returns:
- Returns the timeDiscretizationFromArray.
-
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.
-
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.
-
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.
-
-