# Class InhomogeneousDisplacedLognomalModel

java.lang.Object
net.finmath.montecarlo.model.AbstractProcessModel
net.finmath.montecarlo.assetderivativevaluation.models.InhomogeneousDisplacedLognomalModel
All Implemented Interfaces:
ProcessModel

public class InhomogeneousDisplacedLognomalModel extends AbstractProcessModel
This class implements an inhomogeneous displaced log-normal model, that is, it provides the drift and volatility specification and performs the calculation of the numeraire (consistent with the dynamics, i.e. the drift). The model is $\mathrm{d}S = r S dt + \sigma (S + d) \mathrm{d}W, \quad S(0) = S_{0},$ $\mathrm{d}N = r N \mathrm{d}t, \quad N(0) = N_{0},$ Note that $\mathrm{d}(S/N) = \sigma (S/N + d/N) \mathrm{d}W$ i.e. $\mathrm{d}(S/N + d/N) = -r d/N dt + \sigma (S/N + d/N) \mathrm{d}W$ The class provides the model of S to an MonteCarloProcess via the specification of (via X = S/N+d/N) $$S = f(X) = N X - d$$, $$\mu = d \frac{exp(- r t_2) - exp(- r t_1)}{t_2-t_1}$$, $$\lambda_{1,1} = \sigma X$$, of the SDE $dX = \mu dt + \lambda_{1,1} dW, \quad X(0) = S_{0} + e,$ with $$N(0) = 1$$. See MonteCarloProcess for the notation.
Version:
1.0
Author:
Christian Fries
The interface for numerical schemes., The interface for models provinding parameters to numerical schemes.
• ## Constructor Summary

Constructors
Constructor
Description
InhomogeneousDisplacedLognomalModel​(double initialValue, double riskFreeRate, double displacement, double volatility)
Create a blended normal/lognormal model.
InhomogeneousDisplacedLognomalModel​(double initialValue, double riskFreeRate, double displacement, double volatility, boolean isUseMilsteinCorrection)
Create a blended normal/lognormal model.
InhomogeneousDisplacedLognomalModel​(RandomVariableFactory randomVariableFactory, double initialValue, double riskFreeRate, double displacement, double volatility, boolean isUseMilsteinCorrection)
Create a blended normal/lognormal model.
InhomogeneousDisplacedLognomalModel​(RandomVariableFactory randomVariableFactory, RandomVariable initialValue, RandomVariable riskFreeRate, RandomVariable displacement, RandomVariable volatility, boolean isUseMilsteinCorrection)
Create a blended normal/lognormal model.
• ## Method Summary

Modifier and Type
Method
Description
RandomVariable
applyStateSpaceTransform​(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable randomVariable)
Applies the state space transform fi to the given state random variable such that Yi → fi(Yi) =: Xi.
RandomVariable
applyStateSpaceTransformInverse​(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable randomVariable)
Applies the inverse state space transform f-1i to the given random variable such that Xi → f-1i(Xi) =: Yi.
InhomogeneousDisplacedLognomalModel
getCloneWithModifiedData​(Map<String,​Object> dataModified)
Returns a clone of this model where the specified properties have been modified.
RandomVariable
getDisplacement()

RandomVariable[]
getDrift​(MonteCarloProcess process, int timeIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor)
This method has to be implemented to return the drift, i.e.
RandomVariable[]
getFactorLoading​(MonteCarloProcess process, int timeIndex, int component, RandomVariable[] realizationAtTimeIndex)
This method has to be implemented to return the factor loadings, i.e.
RandomVariable[]
getInitialState​(MonteCarloProcess process)
Returns the initial value of the state variable of the process Y, not to be confused with the initial value of the model X (which is the state space transform applied to this state value.
RandomVariable
getInitialValue()

int
getNumberOfComponents()
Returns the number of components
int
getNumberOfFactors()
Returns the number of factors m, i.e., the number of independent Brownian drivers.
RandomVariable
getNumeraire​(MonteCarloProcess process, double time)
Return the numeraire at a given time index.
RandomVariableFactory
getRandomVariableFactory()

RandomVariable
getRandomVariableForConstant​(double value)
Return a random variable initialized with a constant using the models random variable factory.
RandomVariable
getRiskFreeRate()
Returns the risk free rate parameter of this model.
RandomVariable
getVolatility()
Returns the volatility parameter of this model.
String
toString()

### Methods inherited from class net.finmath.montecarlo.model.AbstractProcessModel

getInitialValue, getReferenceDate

### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
• ## Constructor Details

• ### InhomogeneousDisplacedLognomalModel

public InhomogeneousDisplacedLognomalModel(RandomVariableFactory randomVariableFactory, RandomVariable initialValue, RandomVariable riskFreeRate, RandomVariable displacement, RandomVariable volatility, boolean isUseMilsteinCorrection)
Create a blended normal/lognormal model.
Parameters:
randomVariableFactory - The RandomVariableFactory used to generate random variables from constants.
initialValue - Spot value.
riskFreeRate - The risk free rate.
displacement - The displacement parameter d.
volatility - The volatility.
isUseMilsteinCorrection - If true, a Milstein scheme correction is applied in the drift.
• ### InhomogeneousDisplacedLognomalModel

public InhomogeneousDisplacedLognomalModel(RandomVariableFactory randomVariableFactory, double initialValue, double riskFreeRate, double displacement, double volatility, boolean isUseMilsteinCorrection)
Create a blended normal/lognormal model.
Parameters:
randomVariableFactory - The RandomVariableFactory used to generate random variables from constants.
initialValue - Spot value.
riskFreeRate - The risk free rate.
displacement - The displacement parameter d.
volatility - The volatility.
isUseMilsteinCorrection - If true, the drift will include the Milstein correction (making an Euler scheme a Milstein scheme).
• ### InhomogeneousDisplacedLognomalModel

public InhomogeneousDisplacedLognomalModel(double initialValue, double riskFreeRate, double displacement, double volatility, boolean isUseMilsteinCorrection)
Create a blended normal/lognormal model.
Parameters:
initialValue - Spot value.
riskFreeRate - The risk free rate.
displacement - The displacement parameter d.
volatility - The volatility.
isUseMilsteinCorrection - If true, the drift will include the Milstein correction (making an Euler scheme a Milstein scheme).
• ### InhomogeneousDisplacedLognomalModel

public InhomogeneousDisplacedLognomalModel(double initialValue, double riskFreeRate, double displacement, double volatility)
Create a blended normal/lognormal model.
Parameters:
initialValue - Spot value.
riskFreeRate - The risk free rate.
displacement - The displacement parameter d.
volatility - The volatility.
• ## Method Details

• ### getInitialState

public  getInitialState(MonteCarloProcess process)
Description copied from interface: ProcessModel
Returns the initial value of the state variable of the process Y, not to be confused with the initial value of the model X (which is the state space transform applied to this state value.
Parameters:
process - The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.
Returns:
The initial value of the state variable of the process Y(t=0).
• ### getDrift

public  getDrift(MonteCarloProcess process, int timeIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor)
Description copied from interface: ProcessModel
This method has to be implemented to return the drift, i.e. the coefficient vector
μ = (μ1, ..., μn) such that X = f(Y) and
dYj = μj dt + λ1,j dW1 + ... + λm,j dWm
in an m-factor model. Here j denotes index of the component of the resulting process. Since the model is provided only on a time discretization, the method may also (should try to) return the drift as $$\frac{1}{t_{i+1}-t_{i}} \int_{t_{i}}^{t_{i+1}} \mu(\tau) \mathrm{d}\tau$$.
Parameters:
process - The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.
timeIndex - The time index (related to the model times discretization).
realizationAtTimeIndex - The given realization at timeIndex
realizationPredictor - The given realization at timeIndex+1 or null if no predictor is available.
Returns:
The drift or average drift from timeIndex to timeIndex+1, i.e. $$\frac{1}{t_{i+1}-t_{i}} \int_{t_{i}}^{t_{i+1}} \mu(\tau) \mathrm{d}\tau$$ (or a suitable approximation).

Description copied from interface: ProcessModel
This method has to be implemented to return the factor loadings, i.e. the coefficient vector
λj = (λ1,j, ..., λm,j) such that X = f(Y) and
dYj = μj dt + λ1,j dW1 + ... + λm,j dWm
in an m-factor model. Here j denotes index of the component of the resulting process.
Parameters:
process - The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.
timeIndex - The time index (related to the model times discretization).
component - The index j of the driven component.
realizationAtTimeIndex - The realization of X at the time corresponding to timeIndex (in order to implement local and stochastic volatlity models).
Returns:
• ### applyStateSpaceTransform

public RandomVariable applyStateSpaceTransform(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable randomVariable)
Description copied from interface: ProcessModel
Applies the state space transform fi to the given state random variable such that Yi → fi(Yi) =: Xi.
Parameters:
process - The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.
timeIndex - The time index (related to the model times discretization).
componentIndex - The component index i.
randomVariable - The state random variable Yi.
Returns:
New random variable holding the result of the state space transformation.
• ### applyStateSpaceTransformInverse

public RandomVariable applyStateSpaceTransformInverse(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable randomVariable)
Description copied from interface: ProcessModel
Applies the inverse state space transform f-1i to the given random variable such that Xi → f-1i(Xi) =: Yi.
Parameters:
process - The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.
timeIndex - The time index (related to the model times discretization).
componentIndex - The component index i.
randomVariable - The state random variable Xi.
Returns:
New random variable holding the result of the state space transformation.
• ### getNumeraire

public RandomVariable getNumeraire(MonteCarloProcess process, double time)
Description copied from interface: ProcessModel
Return the numeraire at a given time index. Note: The random variable returned is a defensive copy and may be modified.
Parameters:
process - The discretization process generating this model. The process provides call backs for TimeDiscretization and allows calls to getProcessValue for timeIndices less or equal the given one.
time - The time t for which the numeraire N(t) should be returned.
Returns:
The numeraire at the specified time as RandomVariable
• ### getNumberOfComponents

public int getNumberOfComponents()
Description copied from interface: ProcessModel
Returns the number of components
Returns:
The number of components
• ### getNumberOfFactors

public int getNumberOfFactors()
Description copied from interface: ProcessModel
Returns the number of factors m, i.e., the number of independent Brownian drivers.
Returns:
The number of factors.
• ### getRandomVariableForConstant

public RandomVariable getRandomVariableForConstant(double value)
Description copied from interface: ProcessModel
Return a random variable initialized with a constant using the models random variable factory.
Parameters:
value - The constant value.
Returns:
A new random variable initialized with a constant value.
• ### getCloneWithModifiedData

public InhomogeneousDisplacedLognomalModel getCloneWithModifiedData(Map<String,​Object> dataModified)
Description copied from interface: ProcessModel
Returns a clone of this model where the specified properties have been modified. Note that there is no guarantee that a model reacts on a specification of a properties in the parameter map dataModified. If data is provided which is ignored by the model no exception may be thrown.
Parameters:
dataModified - Key-value-map of parameters to modify.
Returns:
A clone of this model (or this model if no parameter was modified).
• ### toString

public String toString()
Overrides:
toString in class Object
• ### getRandomVariableFactory

public RandomVariableFactory getRandomVariableFactory()
• ### getInitialValue

public RandomVariable getInitialValue()
• ### getRiskFreeRate

public RandomVariable getRiskFreeRate()
Returns the risk free rate parameter of this model.
Returns:
Returns the riskFreeRate.
• ### getDisplacement

public RandomVariable getDisplacement()
• ### getVolatility

public RandomVariable getVolatility()
Returns the volatility parameter of this model.
Returns:
Returns the volatility.