Class HullWhiteModel

java.lang.Object
net.finmath.montecarlo.model.AbstractProcessModel
net.finmath.montecarlo.interestrate.models.HullWhiteModel
All Implemented Interfaces:
Serializable, IndependentModelParameterProvider, LIBORModel, ShortRateModel, TermStructureModel, ProcessModel

public class HullWhiteModel extends AbstractProcessModel implements ShortRateModel, LIBORModel, Serializable
Implements a Hull-White model with time dependent mean reversion speed and time dependent short rate volatility.

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 joint distribution of \( (r,N) \), where \( r \) denotes the short rate and \( N \) denotes the numeraire, following the scheme in ssrn.com/abstract=2737091. 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) (see ssrn.com/abstract=2737091 for details on the derivation). 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 implementing ShortRateVolatilityModel. This implementation supports different method for the interpolation of the curves. The property "isInterpolateDiscountFactorsOnLiborPeriodDiscretization" is a boolean. If true, the given curves are used only at the discretization points given by liborPeriodDiscretization. This implies that the model reports only a limited set of risk factors in the methods getModelParameters().
Version:
1.4
Author:
Christian Fries
See Also:
  • Constructor Details

    • HullWhiteModel

      public HullWhiteModel(RandomVariableFactory randomVariableFactory, TimeDiscretization liborPeriodDiscretization, AnalyticModel analyticModel, ForwardCurve forwardRateCurve, DiscountCurve discountCurve, ShortRateVolatilityModel volatilityModel, Map<String,Object> properties)
      Creates a Hull-White model which implements LIBORMarketModel.
      Parameters:
      randomVariableFactory - The factory to be used to construct random variables.
      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.
    • HullWhiteModel

      public HullWhiteModel(TimeDiscretization liborPeriodDiscretization, AnalyticModel analyticModel, ForwardCurve forwardRateCurve, DiscountCurve discountCurve, ShortRateVolatilityModel volatilityModel, Map<String,Object> properties)
      Creates a Hull-White model which implements LIBORMarketModel.
      Parameters:
      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).
  • Method Details

    • of

      public static HullWhiteModel of(RandomVariableFactory randomVariableFactory, TimeDiscretization liborPeriodDiscretization, AnalyticModel analyticModel, ForwardCurve forwardRateCurve, DiscountCurve discountCurve, ShortRateVolatilityModel volatilityModel, CalibrationProduct[] calibrationProducts, Map<String,Object> properties) throws CalculationException
      Creates a Hull-White model which implements LIBORMarketModel.
      Parameters:
      randomVariableFactory - The randomVariableFactory
      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.
      calibrationProducts - The products to be used for calibration
      properties - The calibration properties
      Returns:
      A (possibly calibrated) Hull White model.
      Throws:
      CalculationException - Thrown if calibration fails.
    • getReferenceDate

      public LocalDateTime getReferenceDate()
      Description copied from interface: ProcessModel
      Returns the model's date corresponding to the time discretization's \( t = 0 \). Note: Currently not all models provide a reference date. This will change in future versions.
      Specified by:
      getReferenceDate in interface ProcessModel
      Overrides:
      getReferenceDate in class AbstractProcessModel
      Returns:
      The model's date corresponding to the time discretization's \( t = 0 \).
    • getNumberOfComponents

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

      public int getNumberOfFactors()
      Description copied from interface: ShortRateModel
      Return the number of factors.
      Specified by:
      getNumberOfFactors in interface ProcessModel
      Specified by:
      getNumberOfFactors in interface ShortRateModel
      Returns:
      The number of factors.
    • 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.
      Specified by:
      applyStateSpaceTransform in interface ProcessModel
      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.
      Specified by:
      applyStateSpaceTransformInverse in interface ProcessModel
      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.
    • getInitialState

      public RandomVariable[] 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.
      Specified by:
      getInitialState in interface ProcessModel
      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).
    • getNumeraire

      public RandomVariable getNumeraire(MonteCarloProcess process, double time) throws CalculationException
      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.
      Specified by:
      getNumeraire in interface ProcessModel
      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
      Throws:
      CalculationException - Thrown if the valuation fails, specific cause may be available via the cause() method.
    • getForwardDiscountBond

      public RandomVariable getForwardDiscountBond(MonteCarloProcess process, double time, double maturity) throws CalculationException
      Description copied from interface: TermStructureModel
      Returns the time \( t \) forward bond derived from the numeraire, i.e., \( P(T;t) = E( \frac{N(t)}{N(T)} \vert \mathcal{F}_{t} ) \). Note: It is guaranteed that the random variabble returned by this method is \( \mathcal{F}_{t} ) \)-measurable.
      Specified by:
      getForwardDiscountBond in interface TermStructureModel
      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 evaluation time.
      maturity - The maturity.
      Returns:
      The forward bond P(T;t).
      Throws:
      CalculationException - Thrown if model fails to calculate the random variable.
    • getDrift

      public RandomVariable[] 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 \).
      Specified by:
      getDrift in interface ProcessModel
      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).
    • getFactorLoading

      public RandomVariable[] getFactorLoading(MonteCarloProcess process, int timeIndex, int componentIndex, RandomVariable[] realizationAtTimeIndex)
      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.
      Specified by:
      getFactorLoading in interface ProcessModel
      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 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.
    • 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.
      Specified by:
      getRandomVariableForConstant in interface ProcessModel
      Parameters:
      value - The constant value.
      Returns:
      A new random variable initialized with a constant value.
    • getForwardRate

      public RandomVariable getForwardRate(MonteCarloProcess process, double time, double periodStart, double periodEnd) throws CalculationException
      Description copied from interface: TermStructureModel
      Returns the time \( t \) forward rate on the models forward curve. Note: It is guaranteed that the random variable returned by this method is \( \mathcal{F}_{t} ) \)-measurable.
      Specified by:
      getForwardRate in interface TermStructureModel
      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 evaluation time.
      periodStart - The period start of the forward rate.
      periodEnd - The period end of the forward rate.
      Returns:
      The forward rate.
      Throws:
      CalculationException - Thrown if model fails to calculate the random variable.
    • getLIBOR

      public RandomVariable getLIBOR(MonteCarloProcess process, int timeIndex, int liborIndex) throws CalculationException
      Description copied from interface: LIBORModel
      Return the forward rate at a given timeIndex and for a given liborIndex.
      Specified by:
      getLIBOR in interface LIBORModel
      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 (associated with Process.getTimeDiscretization().
      liborIndex - The forward rate index (associated with LIBORModel.getLiborPeriodDiscretization().
      Returns:
      The forward rate.
      Throws:
      CalculationException - Thrown if calculation failed.
    • getLiborPeriodDiscretization

      public TimeDiscretization getLiborPeriodDiscretization()
      Description copied from interface: LIBORModel
      The tenor time discretization of the forward rate curve.
      Specified by:
      getLiborPeriodDiscretization in interface LIBORModel
      Returns:
      The tenor time discretization of the forward rate curve.
    • getNumberOfLibors

      public int getNumberOfLibors()
      Description copied from interface: LIBORModel
      Get the number of LIBORs in the LIBOR discretization.
      Specified by:
      getNumberOfLibors in interface LIBORModel
      Returns:
      The number of LIBORs in the LIBOR discretization
    • getLiborPeriod

      public double getLiborPeriod(int timeIndex)
      Description copied from interface: LIBORModel
      The period start corresponding to a given forward rate discretization index.
      Specified by:
      getLiborPeriod in interface LIBORModel
      Parameters:
      timeIndex - The index corresponding to a given time (interpretation is start of period)
      Returns:
      The period start corresponding to a given forward rate discretization index.
    • getLiborPeriodIndex

      public int getLiborPeriodIndex(double time)
      Description copied from interface: LIBORModel
      Same as java.util.Arrays.binarySearch(liborPeriodDiscretization,time). Will return a negative value if the time is not found, but then -index-1 corresponds to the index of the smallest time greater than the given one.
      Specified by:
      getLiborPeriodIndex in interface LIBORModel
      Parameters:
      time - The period start.
      Returns:
      The index corresponding to a given time (interpretation is start of period)
    • getAnalyticModel

      public AnalyticModel getAnalyticModel()
      Description copied from interface: TermStructureModel
      Return the associated analytic model, a collection of market date object like discount curve, forward curve and volatility surfaces.
      Specified by:
      getAnalyticModel in interface TermStructureModel
      Returns:
      The associated analytic model.
    • getDiscountCurve

      public DiscountCurve getDiscountCurve()
      Description copied from interface: TermStructureModel
      Return the discount curve associated the forwards.
      Specified by:
      getDiscountCurve in interface TermStructureModel
      Returns:
      the discount curve associated the forwards.
    • getForwardRateCurve

      public ForwardCurve getForwardRateCurve()
      Description copied from interface: TermStructureModel
      Return the initial forward rate curve.
      Specified by:
      getForwardRateCurve in interface TermStructureModel
      Returns:
      the forward rate curve
    • getCloneWithModifiedData

      public LIBORModel getCloneWithModifiedData(Map<String,Object> dataModified)
      Description copied from interface: LIBORModel
      Create a new object implementing LIBORModel, using the new data.
      Specified by:
      getCloneWithModifiedData in interface LIBORModel
      Specified by:
      getCloneWithModifiedData in interface ProcessModel
      Specified by:
      getCloneWithModifiedData in interface TermStructureModel
      Parameters:
      dataModified - A map with values to be used in constructions (keys are identical to parameter names of the constructors).
      Returns:
      A new object implementing LIBORModel, using the new data.
    • getShortRateConditionalVariance

      public RandomVariable 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.
      Parameters:
      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 \)
      Returns:
      The conditional variance of the short rate, \( \mathop{Var}(r(t) \vert r(s) ) \).
    • getIntegratedBondSquaredVolatility

      public RandomVariable getIntegratedBondSquaredVolatility(double time, double maturity)
    • getCloneWithModifiedVolatilityModel

      public HullWhiteModel getCloneWithModifiedVolatilityModel(ShortRateVolatilityModel volatilityModel)
      Description copied from interface: ShortRateModel
      Create a new object implementing ShortRateModel, using the new volatility model.
      Specified by:
      getCloneWithModifiedVolatilityModel in interface ShortRateModel
      Parameters:
      volatilityModel - The new volatility model.
      Returns:
      A new object implementing ShortRateModel, using the new volatility model.
    • getVolatilityModel

      public ShortRateVolatilityModel getVolatilityModel()
      Description copied from interface: ShortRateModel
      Return the volatility model.
      Specified by:
      getVolatilityModel in interface ShortRateModel
      Returns:
      The volatility model.
    • getModelParameters

      public Map<String,RandomVariable> getModelParameters()
      Description copied from interface: IndependentModelParameterProvider
      Returns a map of independent model parameters of this model.
      Specified by:
      getModelParameters in interface IndependentModelParameterProvider
      Returns:
      Map of independent model parameters of this model.
    • toString

      public String toString()
      Overrides:
      toString in class Object