finMath lib documentation
net.finmath.montecarlo.model

## Interface AbstractModelInterface

• ### Method Summary

All Methods
Modifier and Type Method and Description
RandomVariableInterface applyStateSpaceTransform(int componentIndex, RandomVariableInterface randomVariable)
Applies the state space transform fi to the given state random variable such that Yi → fi(Yi) =: Xi.
default RandomVariableInterface applyStateSpaceTransformInverse(int componentIndex, RandomVariableInterface randomVariable)
AbstractModelInterface getCloneWithModifiedData(Map<String,Object> dataModified)
Returns a clone of this model where the specified properties have been modified.
RandomVariableInterface[] getDrift(int timeIndex, RandomVariableInterface[] realizationAtTimeIndex, RandomVariableInterface[] realizationPredictor)
This method has to be implemented to return the drift, i.e.
RandomVariableInterface[] getFactorLoading(int timeIndex, int componentIndex, RandomVariableInterface[] realizationAtTimeIndex)
This method has to be implemented to return the factor loadings, i.e.
RandomVariableInterface[] getInitialState()
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.
int getNumberOfComponents()
Returns the number of components
int getNumberOfFactors()
Returns the number of factors m, i.e., the number of independent Brownian drivers.
RandomVariableInterface getNumeraire(double time)
Return the numeraire at a given time index.
AbstractProcessInterface getProcess()
Get the numerical scheme used to generate the stochastic process.
default RandomVariableInterface getRandomVariableForConstant(double value)
Return a random variable initialized with a constant using the models random variable factory.
TimeDiscretizationInterface getTimeDiscretization()
Returns the time discretization of the model parameters.
void setProcess(AbstractProcessInterface process)
Set the numerical scheme used to generate the stochastic process.
• ### Method Detail

• #### getTimeDiscretization

TimeDiscretizationInterface getTimeDiscretization()
Returns the time discretization of the model parameters. It is not necessary that this time discretization agrees with the discretization of the stochactic process used in Abstract Process implementation.
Returns:
The time discretization
• #### getNumberOfComponents

int getNumberOfComponents()
Returns the number of components
Returns:
The number of components
• #### applyStateSpaceTransform

RandomVariableInterface applyStateSpaceTransform(int componentIndex,
RandomVariableInterface randomVariable)
Applies the state space transform fi to the given state random variable such that Yi → fi(Yi) =: Xi.
Parameters:
componentIndex - The component index i.
randomVariable - The state random variable Yi.
Returns:
New random variable holding the result of the state space transformation.
• #### applyStateSpaceTransformInverse

default RandomVariableInterface applyStateSpaceTransformInverse(int componentIndex,
RandomVariableInterface randomVariable)
• #### getInitialState

RandomVariableInterface[] getInitialState()
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.
Returns:
The initial value of the state variable of the process Y(t=0).
• #### getNumeraire

RandomVariableInterface getNumeraire(double time)
throws CalculationException
Return the numeraire at a given time index. Note: The random variable returned is a defensive copy and may be modified.
Parameters:
time - The time t for which the numeraire N(t) should be returned.
Returns:
The numeraire at the specified time as RandomVariable
Throws:
CalculationException - Thrown if the valuation fails, specific cause may be available via the cause() method.
• #### getDrift

RandomVariableInterface[] getDrift(int timeIndex,
RandomVariableInterface[] realizationAtTimeIndex,
RandomVariableInterface[] realizationPredictor)
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:
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).
• #### getNumberOfFactors

int getNumberOfFactors()
Returns the number of factors m, i.e., the number of independent Brownian drivers.
Returns:
The number of factors.

RandomVariableInterface[] getFactorLoading(int timeIndex,
int componentIndex,
RandomVariableInterface[] realizationAtTimeIndex)
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:
timeIndex - The time index (related to the model times discretization).
componentIndex - 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:
• #### getRandomVariableForConstant

default RandomVariableInterface getRandomVariableForConstant(double value)
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.
• #### setProcess

void setProcess(AbstractProcessInterface process)
Set the numerical scheme used to generate the stochastic process. The model needs the numerical scheme to calculate, e.g., the numeraire.
Parameters:
process - The process.
• #### getProcess

AbstractProcessInterface getProcess()
Get the numerical scheme used to generate the stochastic process. The model needs the numerical scheme to calculate, e.g., the numeraire.
Returns:
the process
• #### getCloneWithModifiedData

AbstractModelInterface getCloneWithModifiedData(Map<String,Object> dataModified)
throws CalculationException
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).
Throws:
CalculationException - Thrown when the model could not be created.