public class HullWhiteModelWithDirectSimulation extends AbstractProcessModel implements LIBORModel
HullWhiteModel.
Please use HullWhiteModel for real applications.
Model Dynamics
The Hull-While model assumes the following dynamic for the short rate: \[ d r(t) = ( \theta(t) - a(t) r(t) ) d t + \sigma(t) d W(t) \text{,} \quad r(t_{0}) = r_{0} \text{,} \] where the function \( \theta \) determines the calibration to the initial forward curve, \( a \) is the mean reversion and \( \sigma \) is the instantaneous volatility. The dynamic above is under the equivalent martingale measure corresponding to the numeraire \[ N(t) = \exp\left( \int_0^t r(\tau) \mathrm{d}\tau \right) \text{.} \] The main task of this class is to provide the risk-neutral drift and the volatility to the numerical scheme (given the volatility model), simulating \( r(t_{i}) \). The class then also provides and the corresponding numeraire and forward rates (LIBORs).Time Discrete Model
Assuming piecewise constant coefficients (mean reversion speed \( a \) and short rate volatility \( \sigma \) the class specifies the drift and factor loadings as piecewise constant functions for an Euler-scheme. The class provides the exact Euler step for the short rate r. More specifically (assuming a constant mean reversion speed \( a \) for a moment), considering \[ \Delta \bar{r}(t_{i}) = \frac{1}{t_{i+1}-t_{i}} \int_{t_{i}}^{t_{i+1}} d r(t) \] we find from \[ \exp(-a t) \ \left( \mathrm{d} \left( \exp(a t) r(t) \right) \right) \ = \ a r(t) + \mathrm{d} r(t) \ = \ \theta(t) \mathrm{d}t + \sigma(t) \mathrm{d}W(t) \] that \[ \exp(a t_{i+1}) r(t_{i+1}) - \exp(a t_{i}) r(t_{i}) \ = \ \int_{t_{i}}^{t_{i+1}} \left[ \exp(a t) \theta(t) \mathrm{d}t + \exp(a t) \sigma(t) \mathrm{d}W(t) \right] \] that is \[ r(t_{i+1}) - r(t_{i}) \ = \ -(1-\exp(-a (t_{i+1}-t_{i})) r(t_{i}) + \int_{t_{i}}^{t_{i+1}} \left[ \exp(-a (t_{i+1}-t)) \theta(t) \mathrm{d}t + \exp(-a (t_{i+1}-t)) \sigma(t) \mathrm{d}W(t) \right] \] Assuming piecewise constant \( \sigma \) and \( \theta \), being constant over \( (t_{i},t_{i}+\Delta t_{i}) \), we thus find \[ r(t_{i+1}) - r(t_{i}) \ = \ \frac{1-\exp(-a \Delta t_{i})}{a \Delta t_{i}} \left( ( \theta(t_{i}) - a \bar{r}(t_{i})) \Delta t_{i} \right) + \sqrt{\frac{1-\exp(-2 a \Delta t_{i})}{2 a \Delta t_{i}}} \sigma(t_{i}) \Delta W(t_{i}) \] . In other words, the Euler scheme is exact if the mean reversion \( a \) is replaced by the effective mean reversion \( \frac{1-\exp(-a \Delta t_{i})}{a \Delta t_{i}} a \) and the volatility is replaced by the effective volatility \( \sqrt{\frac{1-\exp(-2 a \Delta t_{i})}{2 a \Delta t_{i}}} \sigma(t_{i}) \). In the calculations above the mean reversion speed is treated as a constants, but it is straight forward to see that the same holds for piecewise constant mean reversion speeds, replacing the expression \( a \ t \) by \( \int_{0}^t a(s) \mathrm{d}s \).Calibration
The drift of the short rate is calibrated to the given forward curve using \[ \theta(t) = \frac{\partial}{\partial T} f(0,t) + a(t) f(0,t) + \phi(t) \text{,} \] where the function \( f \) denotes the instantanenous forward rate and \( \phi(t) = \frac{1}{2} a \sigma^{2}(t) B(t)^{2} + \sigma^{2}(t) B(t) \frac{\partial}{\partial t} B(t) \) with \( B(t) = \frac{1-\exp(-a t)}{a} \).Volatility Model
The Hull-White model is essentially equivalent to LIBOR Market Model where the forward rate normal volatility \( \sigma(t,T) \) is given by \[ \sigma(t,T_{i}) \ = \ (1 + L_{i}(t) (T_{i+1}-T_{i})) \sigma(t) \exp(-a (T_{i}-t)) \frac{1-\exp(-a (T_{i+1}-T_{i}))}{a (T_{i+1}-T_{i})} \] (where \( \{ T_{i} \} \) is the forward rates tenor time discretization (note that this is the normal volatility, not the log-normal volatility). Hence, we interpret both, short rate mean reversion speed and short rate volatility as part of the volatility model. The mean reversion speed and the short rate volatility have to be provided to this class via an object implementingShortRateVolatilityModel.ShortRateVolatilityModel,
HullWhiteModel| Constructor and Description |
|---|
HullWhiteModelWithDirectSimulation(TimeDiscretization liborPeriodDiscretization,
AnalyticModel analyticModel,
ForwardCurve forwardRateCurve,
DiscountCurve discountCurve,
ShortRateVolatilityModel volatilityModel,
Map<String,?> properties)
Creates a Hull-White model which implements
LIBORMarketModel. |
| Modifier and Type | Method and Description |
|---|---|
RandomVariable |
applyStateSpaceTransform(int componentIndex,
RandomVariable randomVariable)
Applies the state space transform fi to the given state random variable
such that Yi → fi(Yi) =: Xi.
|
RandomVariable |
applyStateSpaceTransformInverse(int componentIndex,
RandomVariable randomVariable) |
AnalyticModel |
getAnalyticModel()
Return the associated analytic model, a collection of market date object like discount curve, forward curve
and volatility surfaces.
|
LIBORMarketModel |
getCloneWithModifiedData(Map<String,Object> dataModified)
Create a new object implementing LIBORModel, using the new data.
|
DiscountCurve |
getDiscountCurve()
Return the discount curve associated the forwards.
|
RandomVariable[] |
getDrift(int timeIndex,
RandomVariable[] realizationAtTimeIndex,
RandomVariable[] realizationPredictor)
This method has to be implemented to return the drift, i.e.
|
RandomVariable[] |
getFactorLoading(int timeIndex,
int componentIndex,
RandomVariable[] realizationAtTimeIndex)
This method has to be implemented to return the factor loadings, i.e.
|
ForwardCurve |
getForwardRateCurve()
Return the initial forward rate curve.
|
RandomVariable[] |
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.
|
double |
getIntegratedBondSquaredVolatility(double time,
double maturity) |
RandomVariable |
getLIBOR(double time,
double periodStart,
double periodEnd)
Returns the time \( t \) forward rate on the models forward curve.
|
RandomVariable |
getLIBOR(int timeIndex,
int liborIndex)
Return the forward rate at a given timeIndex and for a given liborIndex.
|
double |
getLiborPeriod(int timeIndex)
The period start corresponding to a given forward rate discretization index.
|
TimeDiscretization |
getLiborPeriodDiscretization()
The tenor time discretization of the forward rate curve.
|
int |
getLiborPeriodIndex(double time)
Same as java.util.Arrays.binarySearch(liborPeriodDiscretization,time).
|
Map<String,RandomVariable> |
getModelParameters()
Returns a map of independent model parameters of this model.
|
int |
getNumberOfComponents()
Returns the number of components
|
int |
getNumberOfLibors()
Get the number of LIBORs in the LIBOR discretization.
|
RandomVariable |
getNumeraire(double time)
Return the numeraire at a given time index.
|
RandomVariable |
getRandomVariableForConstant(double value)
Return a random variable initialized with a constant using the models random variable factory.
|
double |
getShortRateConditionalVariance(double time,
double maturity)
Calculates the variance \( \mathop{Var}(r(t) \vert r(s) ) \), that is
\(
\int_{s}^{t} \sigma^{2}(\tau) \exp(-2 \cdot \int_{\tau}^{t} a(u) \mathrm{d}u ) \ \mathrm{d}\tau
\) where \( a \) is the meanReversion and \( \sigma \) is the short rate instantaneous volatility.
|
getInitialValue, getMonteCarloWeights, getNumberOfFactors, getProcess, getProcessValue, getReferenceDate, getTime, getTimeDiscretization, getTimeIndex, setProcessclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetForwardDiscountBondgetNumberOfFactors, getProcess, getReferenceDate, getTimeDiscretization, setProcesspublic HullWhiteModelWithDirectSimulation(TimeDiscretization liborPeriodDiscretization, AnalyticModel analyticModel, ForwardCurve forwardRateCurve, DiscountCurve discountCurve, ShortRateVolatilityModel volatilityModel, Map<String,?> properties)
LIBORMarketModel.liborPeriodDiscretization - The forward rate discretization to be used in the getLIBOR method.analyticModel - The analytic model to be used (currently not used, may be null).forwardRateCurve - The forward curve to be used (currently not used, - the model uses disocuntCurve only.discountCurve - The disocuntCurve (currently also used to determine the forward curve).volatilityModel - The volatility model specifying mean reversion and instantaneous volatility of the short rate.properties - A map specifying model properties (currently not used, may be null).public int getNumberOfComponents()
ProcessModelgetNumberOfComponents in interface ProcessModelpublic RandomVariable applyStateSpaceTransform(int componentIndex, RandomVariable randomVariable)
ProcessModelapplyStateSpaceTransform in interface ProcessModelcomponentIndex - The component index i.randomVariable - The state random variable Yi.public RandomVariable applyStateSpaceTransformInverse(int componentIndex, RandomVariable randomVariable)
applyStateSpaceTransformInverse in interface ProcessModelpublic RandomVariable[] getInitialState()
ProcessModelgetInitialState in interface ProcessModelpublic RandomVariable getNumeraire(double time) throws CalculationException
ProcessModelgetNumeraire in interface ProcessModeltime - The time t for which the numeraire N(t) should be returned.RandomVariableFromDoubleArrayCalculationException - Thrown if the valuation fails, specific cause may be available via the cause() method.public RandomVariable[] getDrift(int timeIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor)
ProcessModelgetDrift in interface ProcessModeltimeIndex - The time index (related to the model times discretization).realizationAtTimeIndex - The given realization at timeIndexrealizationPredictor - The given realization at timeIndex+1 or null if no predictor is available.public RandomVariable getRandomVariableForConstant(double value)
ProcessModelgetRandomVariableForConstant in interface ProcessModelvalue - The constant value.public RandomVariable[] getFactorLoading(int timeIndex, int componentIndex, RandomVariable[] realizationAtTimeIndex)
ProcessModelgetFactorLoading in interface ProcessModeltimeIndex - 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).public RandomVariable getLIBOR(double time, double periodStart, double periodEnd) throws CalculationException
TermStructureModelgetLIBOR in interface TermStructureModeltime - The evaluation time.periodStart - The period start of the forward rate.periodEnd - The period end of the forward rate.CalculationException - Thrown if model fails to calculate the random variable.public RandomVariable getLIBOR(int timeIndex, int liborIndex) throws CalculationException
LIBORModelgetLIBOR in interface LIBORModeltimeIndex - The time index (associated with ProcessModel.getTimeDiscretization().liborIndex - The forward rate index (associated with LIBORModel.getLiborPeriodDiscretization().CalculationException - Thrown if calculation failed.public TimeDiscretization getLiborPeriodDiscretization()
LIBORModelgetLiborPeriodDiscretization in interface LIBORModelpublic int getNumberOfLibors()
LIBORModelgetNumberOfLibors in interface LIBORModelpublic double getLiborPeriod(int timeIndex)
LIBORModelgetLiborPeriod in interface LIBORModeltimeIndex - The index corresponding to a given time (interpretation is start of period)public int getLiborPeriodIndex(double time)
LIBORModelgetLiborPeriodIndex in interface LIBORModeltime - The period start.public AnalyticModel getAnalyticModel()
TermStructureModelgetAnalyticModel in interface TermStructureModelpublic DiscountCurve getDiscountCurve()
TermStructureModelgetDiscountCurve in interface TermStructureModelpublic ForwardCurve getForwardRateCurve()
TermStructureModelgetForwardRateCurve in interface TermStructureModelpublic LIBORMarketModel getCloneWithModifiedData(Map<String,Object> dataModified)
LIBORModelgetCloneWithModifiedData in interface LIBORModelgetCloneWithModifiedData in interface TermStructureModelgetCloneWithModifiedData in interface ProcessModeldataModified - A map with values to be used in constructions (keys are identical to parameter names of the constructors).public double getShortRateConditionalVariance(double time,
double maturity)
time - The parameter s in \( \int_{s}^{t} \sigma^{2}(\tau) \exp(-2 \cdot \int_{\tau}^{t} a(u) \mathrm{d}u ) \ \mathrm{d}\tau \)maturity - The parameter t in \( \int_{s}^{t} \sigma^{2}(\tau) \exp(-2 \cdot \int_{\tau}^{t} a(u) \mathrm{d}u ) \ \mathrm{d}\tau \)public double getIntegratedBondSquaredVolatility(double time,
double maturity)
public Map<String,RandomVariable> getModelParameters()
IndependentModelParameterProvidergetModelParameters in interface IndependentModelParameterProviderCopyright © 2019. All rights reserved.