net.finmath.montecarlo.model
Interface AbstractModelInterface
-
- All Known Subinterfaces:
- LIBORMarketModelInterface
- All Known Implementing Classes:
- AbstractModel, LIBORMarketModel, LIBORMarketModelStandard, MonteCarloBlackScholesModel, MonteCarloMultiAssetBlackScholesModel
public interface AbstractModelInterfaceThe interface for a model of a stochastic process X where X = f(Y) and
\[ dY_{j} = \mu_{j} dt + \lambda_{1,j} dW_{1} + \ldots + \lambda_{m,j} dW_{m} \]- The value of Y(0) is provided by the method
getInitialState(). - The value of μ is provided by the method
getDrift(int, net.finmath.stochastic.RandomVariableInterface[], net.finmath.stochastic.RandomVariableInterface[]). - The value λj is provided by the method
getFactorLoading(int, int, net.finmath.stochastic.RandomVariableInterface[]). - The function f is provided by the method
applyStateSpaceTransform(int, net.finmath.stochastic.RandomVariableInterface).
Examples:- The Black Scholes model can be modeled by S = X = Y (i.e. f is the identity) and μ1 = r S and λ1,1 = σ S.
- Alternatively, the Black Scholes model can be modeled by S = X = exp(Y) (i.e. f is exp) and μ1 = r - 0.5 σ σ and λ1,1 = σ.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description RandomVariableInterfaceapplyStateSpaceTransform(int componentIndex, RandomVariableInterface randomVariable)Applied the state space transform fi to the given state random variable such that Yi → fi(Yi) =: Xi.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.intgetNumberOfComponents()Returns the number of componentsintgetNumberOfFactors()Returns the number of factors m, i.e., the number of independent Brownian drivers.RandomVariableInterfacegetNumeraire(double time)Return the numeraire at a given time index.AbstractProcessInterfacegetProcess()Get the numerical scheme used to generate the stochastic process.TimeDiscretizationInterfacegetTimeDiscretization()Returns the time discretization of the model parameters.voidsetProcess(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)
Applied 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.
-
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 thecause()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.- 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
-
getNumberOfFactors
int getNumberOfFactors()
Returns the number of factors m, i.e., the number of independent Brownian drivers.- Returns:
- The number of factors.
-
getFactorLoading
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:
- The factor loading for given factor and component.
-
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
-
-
DataMelt 3.0 © DataMelt by jWork.ORG