WebCab Bonds
v2.01
(J2SE Edition)

webcab.lib.finance.pricing.models.rate
Class HJM

java.lang.Object
  |
  +--webcab.lib.finance.pricing.models.StochasticDifferentialModel
        |
        +--webcab.lib.finance.pricing.core.models.MarkovModel
              |
              +--webcab.lib.finance.pricing.models.rate.HJM

public class HJM
extends MarkovModel

Heath, Jarrow and Morton is a model of the forward rate curve. It uses instantaneous forward rates, not discrete ones as is the case with SimplifiedBGM. Mathematically, the HJM model is an infinite-factor model (it uses infinite-dimensional Brownian motions). In order to be simulated on a computer the model is discretized - so in practice only a finite number of forward rates are used.

The stochastic differential equation for HJM is:

, where F(t, T) is the forward rate with maturity T at moment t; m(t, T) is the drift of the forward rate with maturity T and vol(t, T) is the volatility of the above mentioned rate.

It is proven that if the drifts of forward rates under the risk-neutral probability are entirely determined by their volatility (according to a certain formula) - the model is risk-neutral. You have thus the freedom to choose any volatility structure you want. The HJM specification is so general that almost all models are in fact particular cases of it.

The volatility of the forward rates can be externally specified by the user or can be automatically computed to fit the market data:


Constructor Summary
HJM(String name, ForwardRate initialForwardRateCurve, int forwardCurveSteps)
          Constructs a HJM model.
HJM(String rateName, String volatilityName, double[][] historicZeroCouponBondPrices, double[] forwardRates, double[] maturities, double tol, int forwardCurveSteps, int nObservations, int nPCAVectors, double dt, double t0)
          Constructs a HJM model using PCA to determine the volatility structure.
HJM(String rateName, String volatilityName, double[][] historicZcbPrices, double[] rates, double[] zcbMaturities, double tol, int forwardCurveSteps, int nObservations, int nPCAVectors, double dt, double t0, int internalMemorySteps)
           
HJM(String rateName, String volatilityName, double[][] historicZcbPrices, ForwardRate initialForwardRateCurve, double tol, int nObservations, int nPCAVectors, double dt, double t0, int internalMemorySteps)
          Constructs a HJM model using Principal Components Analysis to determine the volatility structure.
 
Method Summary
 Context dV(Context context, double t, double dt, RandomGenerator generator, Context partialDelta)
           
 double[][] getCorrelationMatrix()
           
 Context getInitialContext()
           
 int[] getNFactors()
           
 int getNumeraire()
           
 int getNVariables()
           
 StochasticDifferentialModel getUpdatedModel(Context context, double t)
          Sets the initial values of the models' variables to the ones given as parameters.
 
Methods inherited from class webcab.lib.finance.pricing.core.models.MarkovModel
comp, dV_MarkovModel, dV
 
Methods inherited from class webcab.lib.finance.pricing.models.StochasticDifferentialModel
compoundModel, compoundModel, compoundModel, compoundModel, compoundModel, compoundModel, dV_StochasticDifferentialModel, getCholeskyMatrix, getContext, getStartVariableForContext, getSuperModel, getTotalFactors, getVariables, resetOnDemand, seekRoot, seekUpwards, setCholeskyMatrix, setSuperModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HJM

public HJM(String rateName,
           String volatilityName,
           double[][] historicZeroCouponBondPrices,
           double[] forwardRates,
           double[] maturities,
           double tol,
           int forwardCurveSteps,
           int nObservations,
           int nPCAVectors,
           double dt,
           double t0)
    throws BondsException
Constructs a HJM model using PCA to determine the volatility structure. If HJM is instantiated using this constructor there is no need for a separate forward rate volatility model. A determinist model will be created and managed internally by HJM. A compound context will be produced, with the first component being a HJMContext, and the second component a HJMFwRateVolatilityContext. The compound context's name is given in the parameter name. !!!!!!!!!Exemplu nume !!!!!!!!1

Parameters:
rateName - The name which will be given to the forward rate model produced by HJM
volatilityName - The name which will be given to the determinist volatility modelproduced by HJM+PCA
tol - A tolerance used in the Power method for eigenvalues determination (necessary for Principal Component Analysis). Recommended value: ........... !!!!!!!!!!!!!!!!!!
forwardCurveSteps - The number of maturities; points of interpolation.
nPCAVectors - ????????????????
dt - The timestep (or average timestep) for the historic observations of the rates/prices.

HJM

public HJM(String rateName,
           String volatilityName,
           double[][] historicZcbPrices,
           double[] rates,
           double[] zcbMaturities,
           double tol,
           int forwardCurveSteps,
           int nObservations,
           int nPCAVectors,
           double dt,
           double t0,
           int internalMemorySteps)
    throws BondsException

HJM

public HJM(String rateName,
           String volatilityName,
           double[][] historicZcbPrices,
           ForwardRate initialForwardRateCurve,
           double tol,
           int nObservations,
           int nPCAVectors,
           double dt,
           double t0,
           int internalMemorySteps)
    throws BondsException

Constructs a HJM model using Principal Components Analysis to determine the volatility structure. If HJM is instantiated using this constructor there is no need for a separate forward rate volatility model.

A context graph will be produced, with the first component being a forward curve context (implements ForwardRateContext), and the second component a MultifactorForwardRateVolatility context. As you can see there are two String parameters. The first is the name of the forward rate context generated; the second is the name of the forward volatility context.

The initial forward rate curve must be supplied. You can do this by instantiating a new ForwardRate class.

You must supply also the historic values of zero coupon bond prices to be used by the PCA algorithm.

Parameters:
rateName - the name of the forward rate curve context produced.
volatilityName - the name of the multifactor forward volatility context produced.
initialForwardRateCurve - the initial forward rate curve
tol - a tolerance used as stopping condition in the Power method for finding the eigenvectors of a matrix (needed in the PCA algorithm). A recommended value for this parameter is 1E-12.
nObservations - the number of historic values of zero coupon bond prices recorded for each maturity
nPCAVectors - the number of forward volatility stochastic factor you want to find using PCA
dt - the fixed time interval between two consecutive observations of zero coupon bond prices
t0 - the initial moment
internalMemorySteps - this parameter sets the length of an internal cache used to speed up the computations. Generally it is a good idea to set this parameter exactly as the number of timesteps in Monte Carlo.
Throws:
BondsException

HJM

public HJM(String name,
           ForwardRate initialForwardRateCurve,
           int forwardCurveSteps)
    throws InvalidParametersException
Constructs a HJM model. It is required that a forward rate volatility model is externally supplied. In this case HJM produces a single forward rate curve context (see ForwardCurveContext).

Parameters:
name - the name of the context produced
initialForwardRateCurve - the initial forward curve
Throws:
InvalidParametersException
Method Detail

getNVariables

public int getNVariables()
Specified by:
getNVariables in class StochasticDifferentialModel

getNFactors

public int[] getNFactors()
Specified by:
getNFactors in class StochasticDifferentialModel

getNumeraire

public int getNumeraire()
Specified by:
getNumeraire in class StochasticDifferentialModel

getInitialContext

public Context getInitialContext()
Specified by:
getInitialContext in class StochasticDifferentialModel

getCorrelationMatrix

public double[][] getCorrelationMatrix()
Specified by:
getCorrelationMatrix in class StochasticDifferentialModel

dV

public Context dV(Context context,
                  double t,
                  double dt,
                  RandomGenerator generator,
                  Context partialDelta)
           throws BondsException
Specified by:
dV in class MarkovModel
BondsException

getUpdatedModel

public StochasticDifferentialModel getUpdatedModel(Context context,
                                                   double t)
                                            throws BondsException
Description copied from class: StochasticDifferentialModel
Sets the initial values of the models' variables to the ones given as parameters.

Specified by:
getUpdatedModel in class StochasticDifferentialModel
Parameters:
context - the context which will be the new initial context of the model
t - the initial moment for the model
Returns:
StochasticDifferentialModel
Throws:
BondsException

WebCab Bonds
v2.01
(J2SE Edition)