- java.lang.Object
-
- net.finmath.montecarlo.templatemethoddesign.LogNormalProcess
-
- Direct Known Subclasses:
MonteCarloBlackScholesModel2
public abstract class LogNormalProcess extends Object
This class is an abstract base class to implement an Euler scheme of a multi-dimensional multi-factor log-normal Ito process. The dimension is callednumberOfComponentshere. The default fornumberOfFactorsis 1.- Version:
- 1.5
- Author:
- Christian Fries
- Date:
- 19.04.2008
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLogNormalProcess.Scheme
-
Constructor Summary
Constructors Constructor Description LogNormalProcess(int numberOfComponents, BrownianMotion brownianMotion)Create a log normal process.LogNormalProcess(TimeDiscretization timeDiscretization, int numberOfComponents, int numberOfPaths)Create a simulation of log normal process.LogNormalProcess(TimeDiscretization timeDiscretization, int numberOfComponents, int numberOfFactors, int numberOfPaths, int seed)Create a simulation of log normal process.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BrownianMotiongetBrownianMotion()abstract RandomVariablegetDrift(int timeIndex, int componentIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor)RandomVariable[]getDrift(int timeIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor)Get the the drift.abstract RandomVariablegetFactorLoading(int timeIndex, int factor, int component, RandomVariable[] realizationAtTimeIndex)This method should be overwritten and return the factor loading, i.e.abstract RandomVariable[]getInitialValue()RandomVariablegetMonteCarloWeights(int timeIndex)This method returns the weights of a weighted Monte Carlo method (the probability density).intgetNumberOfComponents()intgetNumberOfFactors()intgetNumberOfPaths()RandomVariable[]getProcessValue(int timeIndex)This method returns the realization of the process at a certain time index.RandomVariablegetProcessValue(int timeIndex, int componentIndex)This method returns the realization of the process at a certain time index.LogNormalProcess.SchemegetScheme()doublegetTime(int timeIndex)Returns the time for a given simulation time index.TimeDiscretizationgetTimeDiscretization()intgetTimeIndex(double time)Returns the time index for a given simulation time.protected voidsetBrownianMotion(BrownianMotion brownianMotion)A derived class may change the Brownian motion.voidsetScheme(LogNormalProcess.Scheme scheme)
-
-
-
Constructor Detail
-
LogNormalProcess
public LogNormalProcess(int numberOfComponents, BrownianMotion brownianMotion)Create a log normal process.- Parameters:
numberOfComponents- The number of components (scalar processes).brownianMotion- A Brownian motion
-
LogNormalProcess
public LogNormalProcess(TimeDiscretization timeDiscretization, int numberOfComponents, int numberOfPaths)
Create a simulation of log normal process.- Parameters:
timeDiscretization- The time discretization of the process.numberOfComponents- The number of components (the dimension of the process).numberOfPaths- The number of path of the simulation.
-
LogNormalProcess
public LogNormalProcess(TimeDiscretization timeDiscretization, int numberOfComponents, int numberOfFactors, int numberOfPaths, int seed)
Create a simulation of log normal process.- Parameters:
timeDiscretization- The time discretization of the process.numberOfComponents- The number of components (the dimension of the process).numberOfFactors- The number of factors of the process.numberOfPaths- The number of path of the simulation.seed- The seed of the underlying random number generator.
-
-
Method Detail
-
getInitialValue
public abstract RandomVariable[] getInitialValue()
-
getDrift
public abstract RandomVariable getDrift(int timeIndex, int componentIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor)
-
getDrift
public RandomVariable[] getDrift(int timeIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor)
Get the the drift.- Parameters:
timeIndex- The time index (related to the model times discretization).realizationAtTimeIndex- The given realization at timeIndexrealizationPredictor- The given realization attimeIndex+1or null of no predictor is available.- Returns:
- The (average) drift from timeIndex to timeIndex+1
-
getFactorLoading
public abstract RandomVariable getFactorLoading(int timeIndex, int factor, int component, RandomVariable[] realizationAtTimeIndex)
This method should be overwritten and return the factor loading, i.e. the coeffient λ(i,j) such that
dS(j) = (...) dt + S(j) * (λ(1,j) dW(1) + ... + λ(m,j) dW(m))
in an m-factor model. Here j denotes index of the component of the resulting log-normal process and i denotes the index of the factor.Overwrite this method if you would like to implement a multi factor model.
- Parameters:
timeIndex- The time index of the simulation time discretization.factor- The factor index.component- The component index.realizationAtTimeIndex- The realization at the current time index.- Returns:
- factor loading for given factor and component
-
getProcessValue
public RandomVariable[] getProcessValue(int timeIndex)
This method returns the realization of the process at a certain time index.- Parameters:
timeIndex- Time index at which the process should be observed- Returns:
- A vector of process realizations (on path)
-
getProcessValue
public RandomVariable getProcessValue(int timeIndex, int componentIndex)
This method returns the realization of the process at a certain time index.- Parameters:
timeIndex- Time index at which the process should be observedcomponentIndex- Component of the process vector- Returns:
- A vector of process realizations (on path)
-
getMonteCarloWeights
public RandomVariable getMonteCarloWeights(int timeIndex)
This method returns the weights of a weighted Monte Carlo method (the probability density).- Parameters:
timeIndex- Time index at which the process should be observed- Returns:
- A vector of positive weights which sums up to one
-
getNumberOfComponents
public int getNumberOfComponents()
- Returns:
- Returns the numberOfComponents.
-
getNumberOfPaths
public int getNumberOfPaths()
- Returns:
- Returns the numberOfPaths.
-
getNumberOfFactors
public int getNumberOfFactors()
- Returns:
- Returns the numberOfFactors.
-
getTimeDiscretization
public TimeDiscretization getTimeDiscretization()
- Returns:
- Returns the timeDiscretizationFromArray.
-
getTime
public double getTime(int timeIndex)
Returns the time for a given simulation time index.- Parameters:
timeIndex- Time index- Returns:
- Returns the time for a given time index.
-
getTimeIndex
public int getTimeIndex(double time)
Returns the time index for a given simulation time.- Parameters:
time- A simulation time- Returns:
- Returns the time index for a given time.
-
getBrownianMotion
public BrownianMotion getBrownianMotion()
- Returns:
- Returns the Brownian motion used in the generation of the process
-
getScheme
public LogNormalProcess.Scheme getScheme()
- Returns:
- Returns the scheme.
-
setBrownianMotion
protected void setBrownianMotion(BrownianMotion brownianMotion)
A derived class may change the Brownian motion. This is only allowed prior to lazy initialization. The method should be used only while constructing new object. Do not use in flight.- Parameters:
brownianMotion- The brownianMotion to set.
-
setScheme
public void setScheme(LogNormalProcess.Scheme scheme)
- Parameters:
scheme- The scheme to set.
-
-