java.lang.Object
net.finmath.montecarlo.templatemethoddesign.LogNormalProcess
- Direct Known Subclasses:
MonteCarloBlackScholesModel2
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 called
numberOfComponents
here. The default for numberOfFactors
is 1.- Version:
- 1.5
- Author:
- Christian Fries
- Date:
- 19.04.2008
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionLogNormalProcess
(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
Modifier and TypeMethodDescriptionabstract RandomVariable
getDrift
(int timeIndex, int componentIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor) getDrift
(int timeIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor) Get the the drift.abstract RandomVariable
getFactorLoading
(int timeIndex, int factor, int component, RandomVariable[] realizationAtTimeIndex) This method should be overwritten and return the factor loading, i.e.abstract RandomVariable[]
getMonteCarloWeights
(int timeIndex) This method returns the weights of a weighted Monte Carlo method (the probability density).int
int
int
getProcessValue
(int timeIndex) This method returns the realization of the process at a certain time index.getProcessValue
(int timeIndex, int componentIndex) This method returns the realization of the process at a certain time index.double
getTime
(int timeIndex) Returns the time for a given simulation time index.int
getTimeIndex
(double time) Returns the time index for a given simulation time.protected void
setBrownianMotion
(BrownianMotion brownianMotion) A derived class may change the Brownian motion.void
setScheme
(LogNormalProcess.Scheme scheme)
-
Constructor Details
-
LogNormalProcess
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 Details
-
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+1
or 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
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
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
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
- 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
- Returns:
- Returns the Brownian motion used in the generation of the process
-
getScheme
- Returns:
- Returns the scheme.
-
setBrownianMotion
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
- Parameters:
scheme
- The scheme to set.
-