SlideShare a Scribd company logo
1 of 12
Download to read offline
Implementing Heath, Jarrow & Merton (HJM) Model,
Abukar Ali
1.1 HJM model by Monte Carlo Simulation.
The Heath-Jarrow-Morton framework refers to a class of models that are derived by directly
modelling the dynamics of instantaneous forward-rates. The central insight of this framework
is to recognize that there is an explicit relationship between the drift and volatility parameters
of the forward-rate dynamics in a no-arbitrage world.
The familiar short-rate models can be derived in the HJM framework but in general, however,
HJM models are non-Markovian. As a result, it is not possible to use the PDE-based
computational approach for pricing derivatives. Instead, discrete-time HJM models and Monte-
Carlo methods are often used in practice.
Instead of modelling the short-end of the curve and then building the forward curve for the
longer end of the curve, HJM employ a model for the whole forward rate curve.
Let 𝐹(𝑡; 𝑇)denote the forward rate curve for time t. Therefore the price of a zero coupon bond
at time t and maturing at time T and which pay $1, can be written as:
𝑍(𝑡; 𝑇) = 𝑒∫ 𝐹(𝑡;𝑠)𝑑𝑠.
𝑇
𝑡 (1.1)
The stochastic differential for the above zero coupon bond can then be written as:
𝑑𝑍(𝑡; 𝑇) = 𝑢(𝑡, 𝑇)𝑍(𝑡, 𝑇)𝑑𝑡 + 𝜎(𝑡, 𝑇)𝑍(𝑡; 𝑇)𝑑𝑋. (1.2)
Since the value of the zero coupon bond at time par 𝑍(𝑡; 𝑡) = 1, the volatility of the bond must
also be zero such that 𝜎(𝑡, 𝑡) = 0. we can write 𝑍(𝑡; 𝑇):
𝐹(𝑡; 𝑇) = −
𝜕
𝜕𝑇
𝑙𝑜𝑔𝑍(𝑡; 𝑇) (1.3)
Differentiating with respect to t and by substitution, an equation for the evolution of the forward
curve is found.
𝑑𝑍(𝑡; 𝑇) =
𝜕
𝜕𝑇
(
1
2
𝜎2(𝑡, 𝑇) − 𝑢(𝑡, 𝑇)) 𝑑𝑡 −
𝜕
𝜕𝑇
𝜎(𝑡, 𝑇)𝑑𝑋. (1.4)
We can use the forward rate to derive the stochastic differential equation for the spot rate.
𝑟(𝑡) = 𝐹(𝑡; 𝑡)
Assume today is t* and the whole forward curve is known today, 𝐹(𝑡; 𝑇), the spot rate for
anytime t in the future can then be written as:
𝑟(𝑡) = 𝐹(𝑡; 𝑇) = 𝐹(𝑡∗
, 𝑡) + ∫ 𝑑𝐹(𝑠; 𝑡).
𝑡
𝑡∗ (1.5)
From (1.4) for the forward rate process for F, we have
𝑟(𝑡) = 𝐹(𝑡∗
, 𝑡) + ∫ (𝜎(𝑠, 𝑡)
𝜕𝜎(𝑠,𝑡)
𝜕𝑡
−
𝜕𝑢(𝑠,𝑡)
𝜕𝑡
) 𝑑𝑠 − ∫
𝜕𝜎(𝑠,𝑡)
𝜕𝑡
𝑡
𝑡∗
𝑑𝑋(𝑠).
𝑡
𝑡∗ (1.6)
The stochastic differential equation for r is found after differentiating (1.6) with respect to time
t.
𝑑𝑟 = (
𝜕𝐹(𝑡∗,𝑡)
𝜕𝑡
−
𝜕𝑢(𝑠,𝑡)
𝜕𝑡
+ ∫ (𝜎(𝑠, 𝑡)
𝜕2(𝑠,𝑡)
𝜕𝑡2
+ (
𝜕𝜎 (𝑠,𝑡)
𝜕𝑡
)
2
−
𝜕2 𝑢(𝑠,𝑡)
𝜕𝑡2
) 𝑑𝑠
𝑡
𝑡∗ )
− ∫
𝜕2 𝜎(𝑠,𝑡)
𝜕𝑡2
𝑡
𝑡∗
𝑑𝑋(𝑠))𝑑𝑡 −
𝜕𝜎 (𝑠,𝑡)
𝜕𝑠
𝑑𝑋 (1.7)
The last term is highly path-dependent as both the random and the volatility component depend
on historical observations of these parameters. Because of the dependency of historical values,
this makes the above model a non Markov for derivative pricing, one need to be in risk neutral
world. To move to the risk-neutral world, we start with a hedged portfolio.
Suppose we can hedge a bond with another bond with maturity T. The hedged portfolio is then
:
Π = 𝑍(𝑡; 𝑇1) − Δ𝑍(𝑡; 𝑇2)
The change of the portfolio is given by
Π = 𝑍(𝑡; 𝑇1) − Δ𝑍(𝑡; 𝑇2)
= 𝑍(𝑡; 𝑇1)(𝑢(𝑡, 𝑇1)𝑑𝑡 + 𝜎(𝑡, 𝑇1)𝑑𝑋) − Δ𝑍(𝑡; 𝑇2)(𝑢(𝑡, 𝑇2)𝑑𝑡 + 𝜎(𝑡, 𝑇2)𝑑𝑋)
If Δ =
𝑍(𝑡;𝑇1)𝜎(𝑡,𝑇1)
𝑍(𝑡;𝑇2)𝜎(𝑡,𝑇2)
The portfolio is hedged and is therefore risk-free. Let the return equal to the risk-free rate r(t)
and rearranging we find that
u(𝑡;𝑇1)−𝑟(𝑡)
𝜎(𝑡;𝑇1)
=
u(𝑡;𝑇2)−𝑟(𝑡)
𝜎(𝑡;𝑇2)
and 𝑢(𝑡, 𝑇) = 𝑟(𝑡) + λ(t)σ(t, T).
Where 𝜆(𝑡)𝑖𝑠 𝑡ℎ𝑒 𝑚𝑎𝑟𝑘𝑒𝑡 𝑝𝑟𝑖𝑐𝑒 𝑜𝑓 𝑟𝑖𝑠𝑘
In order to write down an expression for the risk-neutral forward curve, we know that the term
u(t,T) is disappears and is replaced instead with r(t). From equation 1.2, we can then write the
evolution of the zero coupon bond as:
𝑑𝑍(𝑡; 𝑇) = 𝑟(𝑡)𝑍(𝑡, 𝑇)𝑑𝑡 + 𝜎(𝑡, 𝑇)𝑍(𝑡; 𝑇)𝑑𝑋.
The SDE for the risk-neutral forward rate curve is written as:
𝑑𝐹(𝑡; 𝑇) = 𝑚(𝑡, 𝑇)𝑑𝑡 − 𝑣(𝑡, 𝑇)𝑑𝑋.
Where the forward volatility is 𝑣(𝑡, 𝑇)1 = −
𝜕
𝜕𝑇
𝜎(𝑡, 𝑇)
And the drift of the forward is given by 𝑚(𝑡, 𝑇)2 = 𝑣(𝑡, 𝑇) ∫ 𝑣(𝑡, 𝑠)𝑑𝑠.
𝑇
𝑡
The SDE for the risk-neutral forward curve becomes:
1
See lecture HJM lecture for derivation of volatility of the forward curve.
2
See lecture HJM lecture for derivation of the drift of the forward curve.
𝑑𝐹(𝑡: 𝑇) = 𝑣(𝑡, 𝑇) (∫ 𝑣(𝑡, 𝑠)𝑑𝑠.
𝑇
𝑡
) + 𝑣(𝑡, 𝑇)𝑑𝑋. (1.8)
This is a single factor model which can be problematic if one is pricing derivative with various
maturities. For example, spread option which pays the difference between rates at two different
maturities. The above HJM model can be generalized for as N-dimensional stochastic
differential equation
𝑑𝐹(𝑡; 𝑇) = 𝑚(𝑡, 𝑇)𝑑𝑡 − ∑ 𝑣𝑖
𝑁
𝑖=1 (𝑡, 𝑇)𝑑𝑋𝑖
Via Musiela parameterization for multi-factor, we use the equation below to simulate the
forward curve at different maturities.
𝑑𝐹̅(𝑡, 𝜏) = (∑ 𝜐𝑖̅(𝑡, 𝜏) ∫ 𝜐𝑖̅(𝑡, 𝜏)𝑑𝑠 +
𝜕𝐹̅(𝑡,𝜏)
𝜕𝜏
𝜏
0
𝑑
𝑖=1 ) 𝑑𝑡 + ∑ 𝜐𝑖̅(𝑡, 𝜏)𝑑𝑋𝑑
𝑖=1 (1.9)
Where d < n and n is the number of factors to be included in the model. Since we have semi-
annual data from 6 month to 25 years, the full dimension of the data would require 50 factors
but in practise only 3 factors is used.
To implement multi-factor HJM model, one needs to account for correlation in the term
structure and the technique used to accomplish this is the Principal Component Analysis
(PCA). This technique also enables us to estimate the volatility functions.
1.2 Principal Component Analysis
Principal Component Analysis (PCA) is a way to analyse the yield curve. It makes use of
historical time series data and implied covariances to find factors that explain the variance in
the term structure. Each additional factor is found so that they cumulatively maximize the
contribution to the variance. Based on these factors, volatility functions are obtained to explain
the underlying volatility of an interest rate model. For example, when implementing the HJM
model there are two main elements used in the model construction process-one is the definition
of volatility function for the model, the other involves a practical way of obtaining prices from
the model.
.
PCA can also be explained as a technique for finding common movements in the rates, for
finding the eigenvalues and eigenvectors of the matrix. This tells us that large part of the
movement of the forward curve is due to parallel shift. The next most important movement
would be twisting of the curve, followed by a bending.
Data
To implement the HJM model we use historical yield curve data from Bank of England from
January 4th
2005 to May 31st
2011. The data is semi-annually spaced starting from 6 month
maturity to 25 years maturity. For example, the data are the yield implied from zero coupon
bonds from 6 month maturity to 25 years. In addition, these data are nominal yield data which
has already been stripped and are downloaded from Bank of England website.
Figure 1.1
Data Source: See spreadsheet attached. Fwd curve tap.
1.3 Covariance Matrix
Once we have obtained the daily time series and removed all the gaps in the data and adjusted
for possible jumps, we then take the difference of the data in the form of
𝑑𝑖,𝑗 = 𝑟(𝑡𝑖 + 1, 𝜏𝑗) − 𝑟(𝑡, 𝜏)
We then calculate the covariance using the differenced data and we can write it in the form of
covariance matrix, Σ.
𝐶𝑜𝑣(𝑋) = Σ = 𝐸(𝑋𝑋 𝑇) = (
𝜎1
2
⋯ 𝜎1𝑛
2
⋮ ⋱ ⋮
𝜎 𝑛1
2
⋯ 𝜎 𝑛
2
)
See the NxN covariance matrix tap in the attached spreadsheet. Once the spreadsheet is opened,
then it can be seen that the function CovMat is used referencing the entire array of covariance
data (=CovMat(Data_difference!B2:AY1618)). The covariance data are annualized by scaling
a factor of 252/10,0000. This can be seen in the VBA code in the spreadsheet
(WorksheetFunction.Covar(x, y) * 252 / 10000)
0.0
1.0
2.0
3.0
4.0
5.0
6.0
7.0
years:
14Mar05
26May05
05Aug05
17Oct05
28Dec05
09Mar06
23May06
02Aug06
12Oct06
21Dec06
06Mar07
18May07
30Jul07
09Oct07
18Dec07
29Feb08
14May08
24Jul08
03Oct08
12Dec08
25Feb09
11May09
21Jul09
30Sep09
09Dec09
22Feb10
06May10
16Jul10
27Sep10
06Dec10
17Feb11
04May11
Historcal time series of Forward Curve , 6M-2Yr
1.4 Eigenvalues / Eigenvectors.
The above covariance matrix can be factorized further by:
Σ = VΛVT
Where V is an eigenvector matrix (𝑉𝑖, … . 𝑉𝑛) and Λ is and eiganvlue matrix (
𝜆𝑖 ⋯ 0
⋮ ⋱ ⋮
0 ⋯ 𝜆 𝑛
)
And we end up with transformed independent Brownian motions. VΛ
1
2⁄
dX where dX is
independent Brownian motions or these are also referred to as principle component.
To compute the eigenvalues and the eigenvectors, we use the data from the covariance matrix
and a numerical method called the Jacobi method which is suitable for symmetric matrix. We
can then use the pre-build VBA function to compute the eigenvalues and eigenvectors. This
function is available within the spreadsheet provided during the CQF HJM lecture.
From the attached spreadsheet and within the “Prin.Component.Analysis” tab, we use the
function =Eigenvaluesevec(CoverianceMatrixs!B2:AY51,Prin.Component.Analysis!B4) to
compute a raw vector of the eigenvalues form the covariance matrix and we referemce ce;; B4
for numerical tolerance for computation.
We also use the function
=EigenvectorsEmat(CoverianceMatrixs!B2:AY51,Prin.Component.Analysis!B4) to compute
the eigenvector of the covariance matrix dat. The result is then a 50x50 matrix of the
eigenvector data. So, for each eigenvalues there is a corresponding column vector of
eigenvectors.
We highlight the largest eigenvalues and the corresponding eigenvectors which are for the
maturity point of 1.5 years, 6 years and 25 years. We can then take the eigenvelues data, sort
them in ascending order. The result shows the following largest eigenvalues or largest principal
components.
Table 1.1
Maturity Eigenvalues Variance
6 0.000320268 93.10%
25 0.000691603 84.95%
1.5 0.002647853 67.36%
sum 0.003931095
The largest eigenvalue at the maturity point of 1.5 has a value of 0.002647853 and a variance
of 67%. This means that 67% of total variations are explained by the first principal component
which has the highest eigenvalue. 84.9% of the total variation is explained by the sum of the
first two principal components and finally, 93% of the total variations are explained by the all
three principal components. The figure below shows the term-structure of eigenvectors
corresponding to the largest eigenvalues (principal components).
Figure 1.2
The figure above shows how the yield curve responds to different shocks. For example, as
stated before the first principal component is due to parallel shift in the yield curve while, the
second and the third principal components are due to twist and bending of the curve
respectively.
1.5 Risk-Neutral Drift
Once we have calculated the eigenvalues and eigenvectors, we need to also calculate the
volatility matrix and finally the risk-neutral drift before we begin HJM simulations.
The volatility matrix is given by
𝑣̅( 𝜏𝑗) = √𝜆𝑖(𝑣𝑖)𝑗
To compute first the drift, we take the largest eigenvalues given in table 1.1. We take the square
root of these and multiply these result with an array of data corresponding to the three principal
components. The result is a volatility matrix corresponding to all three principal components
for all maturities (see the volatilitymatrix tab).
The next step is to find the risk-neutral drift m(t) by integrating the volatility function
𝑣(𝑡, 𝑇) = ∫ 𝑣(𝑡, 𝑠)𝑑𝑠
𝑇
𝑡
We then fit a function of the volatility so that we can do the integration. The first volatility is a
flat line (parallel shift). We also fit polynomial function of the second and the third volatility
function. Once we have these functions, we then do the integration. (See figure 1.3 below for
the 2nd
volatility function). See also the attached spreadsheet, v1, v2 and v3 tabs.
Table 1.2 (Volatility matrix)
Lambda Lambda^1/2
Maturit
y 0.5 1 1.5 2 2.5
0.002647853
0.0514572900910
4 PC1 4.06% 9.31% 11.36% 11.94% 12.39%
0.000691603
0.0262983456804
5 PC2 -11.07% -20.95% -22.45% -21.05% -19.65%
0.000320268
0.0178960398909
9 PC3 -21.03% -39.26% -40.75% -34.71% -26.94%
-50.00%
-40.00%
-30.00%
-20.00%
-10.00%
0.00%
10.00%
20.00%
30.00%
0.5
1.5
2.5
3.5
4.5
5.5
6.5
7.5
8.5
9.5
10.5
11.5
12.5
13.5
14.5
15.5
16.5
17.5
18.5
19.5
20.5
21.5
22.5
23.5
24.5
Principal Component Anlysis (PCA)
Maturit
y 0.5 1 1.5 2 2.5
Volatility Matrix Volat_1 0.21% 0.48% 0.58% 0.61% 0.64%
Volat_2 -0.29% -0.55% -0.59% -0.55% -0.52%
Volat_3 -0.38% -0.70% -0.73% -0.62% -0.48%
Figure 1.3
In spreadsheet, under the “simforwardrates” tab, we show the calculated risk-neutral function
M(t) with fitted values.
1.6 Simulated Forward Curves
We have now the drift M(t) for each maturity. We also have the three factor volatilities for each
maturity. Before we do the simulation we need to generate three columns of normal random
variables for the whole curve using excel build function (=Rand).
=RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RA
ND()+RAND()+RAND()+RAND()-6
Now we have all the ingredients to start to simulate the forward curve using the following
equation:
𝐹(𝑡, 𝑇) = 𝐹(𝑡, 𝑡) + 𝑚(𝑡)𝑑𝑡 + (𝑣𝑜𝑙1 ∗ 𝑊1 + 𝑣𝑜𝑙2 ∗ 𝑊2 + 𝑣𝑜𝑙3 ∗ 𝑊3) ∗ √𝑑𝑡
+ (
𝐹(𝑡) − 𝐹(𝑡 − 1
𝑑𝑡
) 𝑑𝑡
Where F(t,t) is the current rate, M(t) is the drift, vols are the volatilities for the first, second and
third factors. The W is the Brownian motion generated via the excel function Rand.
We then get the simulated entire HJM forward curve which we can use to price bonds or
derivatives for any maturity points.
One issue we may notice in the simulated forward curve is that the rates we get at the longer
end of the maturity seems to be negative. We may simply take the absolute value of the result
alternatively, re-investigate or check any potential errors in the data (this may be difficult if
one is working with large data set as in this case).
-6
-4
-2
0
2
4
X
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0
10.0
11.0
12.0
13.0
14.0
15.0
16.0
17.0
18.0
19.0
20.0
21.0
22.0
23.0
24.0
25.0
Figure 1.4
1.7 Pricing Zero Coupon Bond
Since we have simulated the forward curve, we can easily compute the zero coupon bond for
any maturity point. For example, to compute the zero coupon yield now for a maturity of 2
years, we can start by summing up the 2 year forward rates. Below are more detailed
information on how to compute the zero coupon bond under HJM model.
There are two ways to calculate ZCB in HJM model:
Numerical integration of the current forward curve.
𝑍(𝑡, 𝑇) = exp(∫ 𝑓(𝑡, 𝑠)𝑑𝑠
𝑇
0
Monte-Carlo (MC) Simulation
𝑍(𝑡, 𝑇) = exp(∫ 𝑟(𝑠)𝑑𝑠
𝑇
0
We now use the MC method to compute the zero coupon bond.
From our previous calculation we do have the risk-neutral drift for all maturity points. We do
also have all the volatility factors for each maturity points. In addition, we do have also the
initial yield curve data. The next step is to integrate the forward rate curve for specific maturity
point and repeat these N times to come up with final ZCB price using the formula
exp(− ∑ 𝑟(𝑡)𝑑𝑡)
We then use the trapezium rule to compute the ZCB price by integrating the initial forward
curve. We use the function
=EXP(-int_trpzm(C8,$B$11))
(see VBA code module6 to see the function used). We can also either use the simulated forward
curve or use HJM function to calculate the forward curve quickly.
0%
1%
2%
3%
4%
5%
year 0.98 1.98 2.98 3.98 4.98 5.98 6.98 7.98 8.98 9.98
Simulated Forward Rates
The final result can be seen in the spreadsheet under the tab “Zero_cpn_Price”. Enter the
parameters and also number of simulations and the price of the bond is calculated. Reaching
the number of simulations to 1000, excel is extremely slow. The chart below shows the
simulated zero coupon bond price.
Figure 1.5
Interest Rate Options (Cap/Floor)
1.8 Discount Factors
Since the underlying forward rates under HJM follow some stochastic process,
we need to use unique discounting factors for each simulation. For example, for
each simulation, the pay-off made at expiry T should be discounted by
exp(∫ 𝑟(𝑠)𝑑𝑠
𝑇
0
Given the discount factors for each simulation and the simulated libor rates for the options
expiry date, we can calculate the price of each caplet and floorlet using the payoff
Cap: 𝑀𝑎𝑥(𝐿 − 𝐾, 0)
Floor: 𝑀𝑎𝑥(𝐾 − 𝐿, 0)
We then take the above payoff and scale these by a unique discount factor for each simulation.
In the attached spreadsheet, you will be able to see the discounted cap and floor prices for each
simulation
Table. 1.3
Sim
Distcount
Factors 6m Libor
Dis.Cap
Prices
Dis.Floor
Prices
Runing
Average
Caplet
1 0.736962493 1.35% 0.00% 2.11% 0.00%
2 0.718482632 1.43% 0.00% 2.00% 0.00%
3 0.494495649 9.02% 2.38% 0.00% 0.79%
0.976
0.977
0.978
0.979
0.98
0.981
year
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
ZCB YIELD CURVE
Change the number of simulation input and press the gray button to see different iterations of
the Cap and Floor price computations. The figure below shows the CAP price convergence as
the number of simulations is increased from low number up to 1000 simulations. At lower
simulations prices seem to fluctuates but stabilize later afer 200 simulations. So increasing the
number of simulations from 400 to 1000 does not have any significant change in the prices but
also reduces the computation speed.
Figure 1.6
0.00%
0.20%
0.40%
0.60%
0.80%
1.00%
Sim
32
64
96
128
160
192
224
256
288
320
352
384
416
448
480
512
544
576
608
640
672
704
736
768
800
832
864
896
928
960
992
Cap price covergence
References
M. Avellaneda, A. Levy, A. Paras, “Pricing and hedging derivative securities in markets with uncertain
volatilities”, Journal of Applied Finance, Vol 1, 1995
Paul Wilmott, P.Wilmott on Quantitative Finance”, 2nd
Edition, Volume 3, Wiley.
CQF Lecture 2010/2011 – Heath, Jarrow and Merton Model
CQF Lecture 2010/ 2011 - Advanced Volatility Modelling in Complete Markets
P. Wilmott, A. Oztukel, “

More Related Content

What's hot

OpenFoam Simulation of Flow over Ahmed Body using Visual CFD software
OpenFoam Simulation of Flow over Ahmed Body using Visual CFD softwareOpenFoam Simulation of Flow over Ahmed Body using Visual CFD software
OpenFoam Simulation of Flow over Ahmed Body using Visual CFD softwareSrinivas Nag H.V
 
R workshop xiv--Survival Analysis with R
R workshop xiv--Survival Analysis with RR workshop xiv--Survival Analysis with R
R workshop xiv--Survival Analysis with RVivian S. Zhang
 
Introduction to Interest Rate Models by Antoine Savine
Introduction to Interest Rate Models by Antoine SavineIntroduction to Interest Rate Models by Antoine Savine
Introduction to Interest Rate Models by Antoine SavineAntoine Savine
 
Multivariate time series
Multivariate time seriesMultivariate time series
Multivariate time seriesLuigi Piva CQF
 
Black scholes model
Black scholes modelBlack scholes model
Black scholes modelUmang Patel
 
Forecasting with Vector Autoregression
Forecasting with Vector AutoregressionForecasting with Vector Autoregression
Forecasting with Vector AutoregressionBryan Butler, MBA, MS
 
buoyantBousinessqSimpleFoam
buoyantBousinessqSimpleFoambuoyantBousinessqSimpleFoam
buoyantBousinessqSimpleFoamMilad Sm
 
ForecastIT 3. Simple Exponential Smoothing
ForecastIT 3. Simple Exponential SmoothingForecastIT 3. Simple Exponential Smoothing
ForecastIT 3. Simple Exponential SmoothingDeepThought, Inc.
 
Mba 532 2011_part_3_time_series_analysis
Mba 532 2011_part_3_time_series_analysisMba 532 2011_part_3_time_series_analysis
Mba 532 2011_part_3_time_series_analysisChandra Kodituwakku
 
Pairs Trading: Optimizing via Mixed Copula versus Distance Method for S&P 5...
	 Pairs Trading: Optimizing via Mixed Copula versus Distance Method for S&P 5...	 Pairs Trading: Optimizing via Mixed Copula versus Distance Method for S&P 5...
Pairs Trading: Optimizing via Mixed Copula versus Distance Method for S&P 5...Fernando A. B. Sabino da Silva
 
Fundamentals of Finite Difference Methods
Fundamentals of Finite Difference MethodsFundamentals of Finite Difference Methods
Fundamentals of Finite Difference Methods1rj
 
Financial Cash-Flow Scripting: Beyond Valuation by Antoine Savine
Financial Cash-Flow Scripting: Beyond Valuation by Antoine SavineFinancial Cash-Flow Scripting: Beyond Valuation by Antoine Savine
Financial Cash-Flow Scripting: Beyond Valuation by Antoine SavineAntoine Savine
 

What's hot (20)

Heat 4e chap11_lecture
Heat 4e chap11_lectureHeat 4e chap11_lecture
Heat 4e chap11_lecture
 
OpenFoam Simulation of Flow over Ahmed Body using Visual CFD software
OpenFoam Simulation of Flow over Ahmed Body using Visual CFD softwareOpenFoam Simulation of Flow over Ahmed Body using Visual CFD software
OpenFoam Simulation of Flow over Ahmed Body using Visual CFD software
 
Ch10 slides
Ch10 slidesCh10 slides
Ch10 slides
 
Instrumental Variables
Instrumental VariablesInstrumental Variables
Instrumental Variables
 
R workshop xiv--Survival Analysis with R
R workshop xiv--Survival Analysis with RR workshop xiv--Survival Analysis with R
R workshop xiv--Survival Analysis with R
 
Metodi numerici
Metodi numericiMetodi numerici
Metodi numerici
 
Introduction to Interest Rate Models by Antoine Savine
Introduction to Interest Rate Models by Antoine SavineIntroduction to Interest Rate Models by Antoine Savine
Introduction to Interest Rate Models by Antoine Savine
 
Time series Analysis
Time series AnalysisTime series Analysis
Time series Analysis
 
Multivariate time series
Multivariate time seriesMultivariate time series
Multivariate time series
 
Ch11 slides
Ch11 slidesCh11 slides
Ch11 slides
 
Black scholes model
Black scholes modelBlack scholes model
Black scholes model
 
Game theory
Game theoryGame theory
Game theory
 
Forecasting with Vector Autoregression
Forecasting with Vector AutoregressionForecasting with Vector Autoregression
Forecasting with Vector Autoregression
 
Turbulence 2020 gt
Turbulence 2020 gtTurbulence 2020 gt
Turbulence 2020 gt
 
buoyantBousinessqSimpleFoam
buoyantBousinessqSimpleFoambuoyantBousinessqSimpleFoam
buoyantBousinessqSimpleFoam
 
ForecastIT 3. Simple Exponential Smoothing
ForecastIT 3. Simple Exponential SmoothingForecastIT 3. Simple Exponential Smoothing
ForecastIT 3. Simple Exponential Smoothing
 
Mba 532 2011_part_3_time_series_analysis
Mba 532 2011_part_3_time_series_analysisMba 532 2011_part_3_time_series_analysis
Mba 532 2011_part_3_time_series_analysis
 
Pairs Trading: Optimizing via Mixed Copula versus Distance Method for S&P 5...
	 Pairs Trading: Optimizing via Mixed Copula versus Distance Method for S&P 5...	 Pairs Trading: Optimizing via Mixed Copula versus Distance Method for S&P 5...
Pairs Trading: Optimizing via Mixed Copula versus Distance Method for S&P 5...
 
Fundamentals of Finite Difference Methods
Fundamentals of Finite Difference MethodsFundamentals of Finite Difference Methods
Fundamentals of Finite Difference Methods
 
Financial Cash-Flow Scripting: Beyond Valuation by Antoine Savine
Financial Cash-Flow Scripting: Beyond Valuation by Antoine SavineFinancial Cash-Flow Scripting: Beyond Valuation by Antoine Savine
Financial Cash-Flow Scripting: Beyond Valuation by Antoine Savine
 

Viewers also liked

Saturn Users Conference 2012: Portfolio Hedging and Optimization An Electric ...
Saturn Users Conference 2012: Portfolio Hedging and Optimization An Electric ...Saturn Users Conference 2012: Portfolio Hedging and Optimization An Electric ...
Saturn Users Conference 2012: Portfolio Hedging and Optimization An Electric ...Eric Meerdink
 
Portfolio Management: An Electric Retailer's Perspective
Portfolio Management: An Electric Retailer's PerspectivePortfolio Management: An Electric Retailer's Perspective
Portfolio Management: An Electric Retailer's PerspectiveEric Meerdink
 
The nuances of hedging electric portfolio risks
The nuances of hedging electric portfolio risksThe nuances of hedging electric portfolio risks
The nuances of hedging electric portfolio risksEric Meerdink
 
Modeling and Hedging the Risk in Retail Load Contracts
Modeling and Hedging the Risk in Retail Load ContractsModeling and Hedging the Risk in Retail Load Contracts
Modeling and Hedging the Risk in Retail Load ContractsEric Meerdink
 

Viewers also liked (8)

Option_Greeks
Option_GreeksOption_Greeks
Option_Greeks
 
IEPN HJM Report 130916
IEPN HJM Report 130916IEPN HJM Report 130916
IEPN HJM Report 130916
 
VaR_My_Presentation
VaR_My_PresentationVaR_My_Presentation
VaR_My_Presentation
 
Shonen
ShonenShonen
Shonen
 
Saturn Users Conference 2012: Portfolio Hedging and Optimization An Electric ...
Saturn Users Conference 2012: Portfolio Hedging and Optimization An Electric ...Saturn Users Conference 2012: Portfolio Hedging and Optimization An Electric ...
Saturn Users Conference 2012: Portfolio Hedging and Optimization An Electric ...
 
Portfolio Management: An Electric Retailer's Perspective
Portfolio Management: An Electric Retailer's PerspectivePortfolio Management: An Electric Retailer's Perspective
Portfolio Management: An Electric Retailer's Perspective
 
The nuances of hedging electric portfolio risks
The nuances of hedging electric portfolio risksThe nuances of hedging electric portfolio risks
The nuances of hedging electric portfolio risks
 
Modeling and Hedging the Risk in Retail Load Contracts
Modeling and Hedging the Risk in Retail Load ContractsModeling and Hedging the Risk in Retail Load Contracts
Modeling and Hedging the Risk in Retail Load Contracts
 

Similar to Implimenting_HJM

LFM Pedersen Calibration - Cappelli
LFM Pedersen Calibration - CappelliLFM Pedersen Calibration - Cappelli
LFM Pedersen Calibration - CappelliJoel Cappelli
 
Stochastic Vol Forecasting
Stochastic Vol ForecastingStochastic Vol Forecasting
Stochastic Vol ForecastingSwati Mital
 
Numerical disperison analysis of sympletic and adi scheme
Numerical disperison analysis of sympletic and adi schemeNumerical disperison analysis of sympletic and adi scheme
Numerical disperison analysis of sympletic and adi schemexingangahu
 
Pricing interest rate derivatives (ext)
Pricing interest rate derivatives (ext)Pricing interest rate derivatives (ext)
Pricing interest rate derivatives (ext)Swati Mital
 
Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...
Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...
Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...IJERA Editor
 
Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...
Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...
Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...IJERA Editor
 
A Computationally Efficient Algorithm to Solve Generalized Method of Moments ...
A Computationally Efficient Algorithm to Solve Generalized Method of Moments ...A Computationally Efficient Algorithm to Solve Generalized Method of Moments ...
A Computationally Efficient Algorithm to Solve Generalized Method of Moments ...Waqas Tariq
 
THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...
THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...
THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...ieijjournal
 
THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...
THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...
THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...ieijjournal1
 

Similar to Implimenting_HJM (20)

LFM Pedersen Calibration - Cappelli
LFM Pedersen Calibration - CappelliLFM Pedersen Calibration - Cappelli
LFM Pedersen Calibration - Cappelli
 
The Short-term Swap Rate Models in China
The Short-term Swap Rate Models in ChinaThe Short-term Swap Rate Models in China
The Short-term Swap Rate Models in China
 
solver (1)
solver (1)solver (1)
solver (1)
 
Diff eq
Diff eqDiff eq
Diff eq
 
Stochastic Vol Forecasting
Stochastic Vol ForecastingStochastic Vol Forecasting
Stochastic Vol Forecasting
 
Chapter26
Chapter26Chapter26
Chapter26
 
ETSATPWAATFU
ETSATPWAATFUETSATPWAATFU
ETSATPWAATFU
 
Numerical disperison analysis of sympletic and adi scheme
Numerical disperison analysis of sympletic and adi schemeNumerical disperison analysis of sympletic and adi scheme
Numerical disperison analysis of sympletic and adi scheme
 
Pricing interest rate derivatives (ext)
Pricing interest rate derivatives (ext)Pricing interest rate derivatives (ext)
Pricing interest rate derivatives (ext)
 
Differential Evolution Algorithm with Triangular Adaptive Control Parameter f...
Differential Evolution Algorithm with Triangular Adaptive Control Parameter f...Differential Evolution Algorithm with Triangular Adaptive Control Parameter f...
Differential Evolution Algorithm with Triangular Adaptive Control Parameter f...
 
working with python
working with pythonworking with python
working with python
 
Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...
Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...
Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...
 
Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...
Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...
Stochastic Analysis of Van der Pol OscillatorModel Using Wiener HermiteExpans...
 
recko_paper
recko_paperrecko_paper
recko_paper
 
Environmental Engineering Assignment Help
Environmental Engineering Assignment HelpEnvironmental Engineering Assignment Help
Environmental Engineering Assignment Help
 
A Computationally Efficient Algorithm to Solve Generalized Method of Moments ...
A Computationally Efficient Algorithm to Solve Generalized Method of Moments ...A Computationally Efficient Algorithm to Solve Generalized Method of Moments ...
A Computationally Efficient Algorithm to Solve Generalized Method of Moments ...
 
THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...
THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...
THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...
 
THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...
THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...
THE LEFT AND RIGHT BLOCK POLE PLACEMENT COMPARISON STUDY: APPLICATION TO FLIG...
 
Arellano bond
Arellano bondArellano bond
Arellano bond
 
Time Series Decomposition
Time Series DecompositionTime Series Decomposition
Time Series Decomposition
 

Implimenting_HJM

  • 1. Implementing Heath, Jarrow & Merton (HJM) Model, Abukar Ali
  • 2. 1.1 HJM model by Monte Carlo Simulation. The Heath-Jarrow-Morton framework refers to a class of models that are derived by directly modelling the dynamics of instantaneous forward-rates. The central insight of this framework is to recognize that there is an explicit relationship between the drift and volatility parameters of the forward-rate dynamics in a no-arbitrage world. The familiar short-rate models can be derived in the HJM framework but in general, however, HJM models are non-Markovian. As a result, it is not possible to use the PDE-based computational approach for pricing derivatives. Instead, discrete-time HJM models and Monte- Carlo methods are often used in practice. Instead of modelling the short-end of the curve and then building the forward curve for the longer end of the curve, HJM employ a model for the whole forward rate curve. Let 𝐹(𝑡; 𝑇)denote the forward rate curve for time t. Therefore the price of a zero coupon bond at time t and maturing at time T and which pay $1, can be written as: 𝑍(𝑡; 𝑇) = 𝑒∫ 𝐹(𝑡;𝑠)𝑑𝑠. 𝑇 𝑡 (1.1) The stochastic differential for the above zero coupon bond can then be written as: 𝑑𝑍(𝑡; 𝑇) = 𝑢(𝑡, 𝑇)𝑍(𝑡, 𝑇)𝑑𝑡 + 𝜎(𝑡, 𝑇)𝑍(𝑡; 𝑇)𝑑𝑋. (1.2) Since the value of the zero coupon bond at time par 𝑍(𝑡; 𝑡) = 1, the volatility of the bond must also be zero such that 𝜎(𝑡, 𝑡) = 0. we can write 𝑍(𝑡; 𝑇): 𝐹(𝑡; 𝑇) = − 𝜕 𝜕𝑇 𝑙𝑜𝑔𝑍(𝑡; 𝑇) (1.3) Differentiating with respect to t and by substitution, an equation for the evolution of the forward curve is found. 𝑑𝑍(𝑡; 𝑇) = 𝜕 𝜕𝑇 ( 1 2 𝜎2(𝑡, 𝑇) − 𝑢(𝑡, 𝑇)) 𝑑𝑡 − 𝜕 𝜕𝑇 𝜎(𝑡, 𝑇)𝑑𝑋. (1.4) We can use the forward rate to derive the stochastic differential equation for the spot rate. 𝑟(𝑡) = 𝐹(𝑡; 𝑡) Assume today is t* and the whole forward curve is known today, 𝐹(𝑡; 𝑇), the spot rate for anytime t in the future can then be written as: 𝑟(𝑡) = 𝐹(𝑡; 𝑇) = 𝐹(𝑡∗ , 𝑡) + ∫ 𝑑𝐹(𝑠; 𝑡). 𝑡 𝑡∗ (1.5) From (1.4) for the forward rate process for F, we have 𝑟(𝑡) = 𝐹(𝑡∗ , 𝑡) + ∫ (𝜎(𝑠, 𝑡) 𝜕𝜎(𝑠,𝑡) 𝜕𝑡 − 𝜕𝑢(𝑠,𝑡) 𝜕𝑡 ) 𝑑𝑠 − ∫ 𝜕𝜎(𝑠,𝑡) 𝜕𝑡 𝑡 𝑡∗ 𝑑𝑋(𝑠). 𝑡 𝑡∗ (1.6) The stochastic differential equation for r is found after differentiating (1.6) with respect to time t.
  • 3. 𝑑𝑟 = ( 𝜕𝐹(𝑡∗,𝑡) 𝜕𝑡 − 𝜕𝑢(𝑠,𝑡) 𝜕𝑡 + ∫ (𝜎(𝑠, 𝑡) 𝜕2(𝑠,𝑡) 𝜕𝑡2 + ( 𝜕𝜎 (𝑠,𝑡) 𝜕𝑡 ) 2 − 𝜕2 𝑢(𝑠,𝑡) 𝜕𝑡2 ) 𝑑𝑠 𝑡 𝑡∗ ) − ∫ 𝜕2 𝜎(𝑠,𝑡) 𝜕𝑡2 𝑡 𝑡∗ 𝑑𝑋(𝑠))𝑑𝑡 − 𝜕𝜎 (𝑠,𝑡) 𝜕𝑠 𝑑𝑋 (1.7) The last term is highly path-dependent as both the random and the volatility component depend on historical observations of these parameters. Because of the dependency of historical values, this makes the above model a non Markov for derivative pricing, one need to be in risk neutral world. To move to the risk-neutral world, we start with a hedged portfolio. Suppose we can hedge a bond with another bond with maturity T. The hedged portfolio is then : Π = 𝑍(𝑡; 𝑇1) − Δ𝑍(𝑡; 𝑇2) The change of the portfolio is given by Π = 𝑍(𝑡; 𝑇1) − Δ𝑍(𝑡; 𝑇2) = 𝑍(𝑡; 𝑇1)(𝑢(𝑡, 𝑇1)𝑑𝑡 + 𝜎(𝑡, 𝑇1)𝑑𝑋) − Δ𝑍(𝑡; 𝑇2)(𝑢(𝑡, 𝑇2)𝑑𝑡 + 𝜎(𝑡, 𝑇2)𝑑𝑋) If Δ = 𝑍(𝑡;𝑇1)𝜎(𝑡,𝑇1) 𝑍(𝑡;𝑇2)𝜎(𝑡,𝑇2) The portfolio is hedged and is therefore risk-free. Let the return equal to the risk-free rate r(t) and rearranging we find that u(𝑡;𝑇1)−𝑟(𝑡) 𝜎(𝑡;𝑇1) = u(𝑡;𝑇2)−𝑟(𝑡) 𝜎(𝑡;𝑇2) and 𝑢(𝑡, 𝑇) = 𝑟(𝑡) + λ(t)σ(t, T). Where 𝜆(𝑡)𝑖𝑠 𝑡ℎ𝑒 𝑚𝑎𝑟𝑘𝑒𝑡 𝑝𝑟𝑖𝑐𝑒 𝑜𝑓 𝑟𝑖𝑠𝑘 In order to write down an expression for the risk-neutral forward curve, we know that the term u(t,T) is disappears and is replaced instead with r(t). From equation 1.2, we can then write the evolution of the zero coupon bond as: 𝑑𝑍(𝑡; 𝑇) = 𝑟(𝑡)𝑍(𝑡, 𝑇)𝑑𝑡 + 𝜎(𝑡, 𝑇)𝑍(𝑡; 𝑇)𝑑𝑋. The SDE for the risk-neutral forward rate curve is written as: 𝑑𝐹(𝑡; 𝑇) = 𝑚(𝑡, 𝑇)𝑑𝑡 − 𝑣(𝑡, 𝑇)𝑑𝑋. Where the forward volatility is 𝑣(𝑡, 𝑇)1 = − 𝜕 𝜕𝑇 𝜎(𝑡, 𝑇) And the drift of the forward is given by 𝑚(𝑡, 𝑇)2 = 𝑣(𝑡, 𝑇) ∫ 𝑣(𝑡, 𝑠)𝑑𝑠. 𝑇 𝑡 The SDE for the risk-neutral forward curve becomes: 1 See lecture HJM lecture for derivation of volatility of the forward curve. 2 See lecture HJM lecture for derivation of the drift of the forward curve.
  • 4. 𝑑𝐹(𝑡: 𝑇) = 𝑣(𝑡, 𝑇) (∫ 𝑣(𝑡, 𝑠)𝑑𝑠. 𝑇 𝑡 ) + 𝑣(𝑡, 𝑇)𝑑𝑋. (1.8) This is a single factor model which can be problematic if one is pricing derivative with various maturities. For example, spread option which pays the difference between rates at two different maturities. The above HJM model can be generalized for as N-dimensional stochastic differential equation 𝑑𝐹(𝑡; 𝑇) = 𝑚(𝑡, 𝑇)𝑑𝑡 − ∑ 𝑣𝑖 𝑁 𝑖=1 (𝑡, 𝑇)𝑑𝑋𝑖 Via Musiela parameterization for multi-factor, we use the equation below to simulate the forward curve at different maturities. 𝑑𝐹̅(𝑡, 𝜏) = (∑ 𝜐𝑖̅(𝑡, 𝜏) ∫ 𝜐𝑖̅(𝑡, 𝜏)𝑑𝑠 + 𝜕𝐹̅(𝑡,𝜏) 𝜕𝜏 𝜏 0 𝑑 𝑖=1 ) 𝑑𝑡 + ∑ 𝜐𝑖̅(𝑡, 𝜏)𝑑𝑋𝑑 𝑖=1 (1.9) Where d < n and n is the number of factors to be included in the model. Since we have semi- annual data from 6 month to 25 years, the full dimension of the data would require 50 factors but in practise only 3 factors is used. To implement multi-factor HJM model, one needs to account for correlation in the term structure and the technique used to accomplish this is the Principal Component Analysis (PCA). This technique also enables us to estimate the volatility functions. 1.2 Principal Component Analysis Principal Component Analysis (PCA) is a way to analyse the yield curve. It makes use of historical time series data and implied covariances to find factors that explain the variance in the term structure. Each additional factor is found so that they cumulatively maximize the contribution to the variance. Based on these factors, volatility functions are obtained to explain the underlying volatility of an interest rate model. For example, when implementing the HJM model there are two main elements used in the model construction process-one is the definition of volatility function for the model, the other involves a practical way of obtaining prices from the model. . PCA can also be explained as a technique for finding common movements in the rates, for finding the eigenvalues and eigenvectors of the matrix. This tells us that large part of the movement of the forward curve is due to parallel shift. The next most important movement would be twisting of the curve, followed by a bending.
  • 5. Data To implement the HJM model we use historical yield curve data from Bank of England from January 4th 2005 to May 31st 2011. The data is semi-annually spaced starting from 6 month maturity to 25 years maturity. For example, the data are the yield implied from zero coupon bonds from 6 month maturity to 25 years. In addition, these data are nominal yield data which has already been stripped and are downloaded from Bank of England website. Figure 1.1 Data Source: See spreadsheet attached. Fwd curve tap. 1.3 Covariance Matrix Once we have obtained the daily time series and removed all the gaps in the data and adjusted for possible jumps, we then take the difference of the data in the form of 𝑑𝑖,𝑗 = 𝑟(𝑡𝑖 + 1, 𝜏𝑗) − 𝑟(𝑡, 𝜏) We then calculate the covariance using the differenced data and we can write it in the form of covariance matrix, Σ. 𝐶𝑜𝑣(𝑋) = Σ = 𝐸(𝑋𝑋 𝑇) = ( 𝜎1 2 ⋯ 𝜎1𝑛 2 ⋮ ⋱ ⋮ 𝜎 𝑛1 2 ⋯ 𝜎 𝑛 2 ) See the NxN covariance matrix tap in the attached spreadsheet. Once the spreadsheet is opened, then it can be seen that the function CovMat is used referencing the entire array of covariance data (=CovMat(Data_difference!B2:AY1618)). The covariance data are annualized by scaling a factor of 252/10,0000. This can be seen in the VBA code in the spreadsheet (WorksheetFunction.Covar(x, y) * 252 / 10000) 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 years: 14Mar05 26May05 05Aug05 17Oct05 28Dec05 09Mar06 23May06 02Aug06 12Oct06 21Dec06 06Mar07 18May07 30Jul07 09Oct07 18Dec07 29Feb08 14May08 24Jul08 03Oct08 12Dec08 25Feb09 11May09 21Jul09 30Sep09 09Dec09 22Feb10 06May10 16Jul10 27Sep10 06Dec10 17Feb11 04May11 Historcal time series of Forward Curve , 6M-2Yr
  • 6. 1.4 Eigenvalues / Eigenvectors. The above covariance matrix can be factorized further by: Σ = VΛVT Where V is an eigenvector matrix (𝑉𝑖, … . 𝑉𝑛) and Λ is and eiganvlue matrix ( 𝜆𝑖 ⋯ 0 ⋮ ⋱ ⋮ 0 ⋯ 𝜆 𝑛 ) And we end up with transformed independent Brownian motions. VΛ 1 2⁄ dX where dX is independent Brownian motions or these are also referred to as principle component. To compute the eigenvalues and the eigenvectors, we use the data from the covariance matrix and a numerical method called the Jacobi method which is suitable for symmetric matrix. We can then use the pre-build VBA function to compute the eigenvalues and eigenvectors. This function is available within the spreadsheet provided during the CQF HJM lecture. From the attached spreadsheet and within the “Prin.Component.Analysis” tab, we use the function =Eigenvaluesevec(CoverianceMatrixs!B2:AY51,Prin.Component.Analysis!B4) to compute a raw vector of the eigenvalues form the covariance matrix and we referemce ce;; B4 for numerical tolerance for computation. We also use the function =EigenvectorsEmat(CoverianceMatrixs!B2:AY51,Prin.Component.Analysis!B4) to compute the eigenvector of the covariance matrix dat. The result is then a 50x50 matrix of the eigenvector data. So, for each eigenvalues there is a corresponding column vector of eigenvectors. We highlight the largest eigenvalues and the corresponding eigenvectors which are for the maturity point of 1.5 years, 6 years and 25 years. We can then take the eigenvelues data, sort them in ascending order. The result shows the following largest eigenvalues or largest principal components. Table 1.1 Maturity Eigenvalues Variance 6 0.000320268 93.10% 25 0.000691603 84.95% 1.5 0.002647853 67.36% sum 0.003931095 The largest eigenvalue at the maturity point of 1.5 has a value of 0.002647853 and a variance of 67%. This means that 67% of total variations are explained by the first principal component which has the highest eigenvalue. 84.9% of the total variation is explained by the sum of the first two principal components and finally, 93% of the total variations are explained by the all three principal components. The figure below shows the term-structure of eigenvectors corresponding to the largest eigenvalues (principal components).
  • 7. Figure 1.2 The figure above shows how the yield curve responds to different shocks. For example, as stated before the first principal component is due to parallel shift in the yield curve while, the second and the third principal components are due to twist and bending of the curve respectively. 1.5 Risk-Neutral Drift Once we have calculated the eigenvalues and eigenvectors, we need to also calculate the volatility matrix and finally the risk-neutral drift before we begin HJM simulations. The volatility matrix is given by 𝑣̅( 𝜏𝑗) = √𝜆𝑖(𝑣𝑖)𝑗 To compute first the drift, we take the largest eigenvalues given in table 1.1. We take the square root of these and multiply these result with an array of data corresponding to the three principal components. The result is a volatility matrix corresponding to all three principal components for all maturities (see the volatilitymatrix tab). The next step is to find the risk-neutral drift m(t) by integrating the volatility function 𝑣(𝑡, 𝑇) = ∫ 𝑣(𝑡, 𝑠)𝑑𝑠 𝑇 𝑡 We then fit a function of the volatility so that we can do the integration. The first volatility is a flat line (parallel shift). We also fit polynomial function of the second and the third volatility function. Once we have these functions, we then do the integration. (See figure 1.3 below for the 2nd volatility function). See also the attached spreadsheet, v1, v2 and v3 tabs. Table 1.2 (Volatility matrix) Lambda Lambda^1/2 Maturit y 0.5 1 1.5 2 2.5 0.002647853 0.0514572900910 4 PC1 4.06% 9.31% 11.36% 11.94% 12.39% 0.000691603 0.0262983456804 5 PC2 -11.07% -20.95% -22.45% -21.05% -19.65% 0.000320268 0.0178960398909 9 PC3 -21.03% -39.26% -40.75% -34.71% -26.94% -50.00% -40.00% -30.00% -20.00% -10.00% 0.00% 10.00% 20.00% 30.00% 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 10.5 11.5 12.5 13.5 14.5 15.5 16.5 17.5 18.5 19.5 20.5 21.5 22.5 23.5 24.5 Principal Component Anlysis (PCA)
  • 8. Maturit y 0.5 1 1.5 2 2.5 Volatility Matrix Volat_1 0.21% 0.48% 0.58% 0.61% 0.64% Volat_2 -0.29% -0.55% -0.59% -0.55% -0.52% Volat_3 -0.38% -0.70% -0.73% -0.62% -0.48% Figure 1.3 In spreadsheet, under the “simforwardrates” tab, we show the calculated risk-neutral function M(t) with fitted values. 1.6 Simulated Forward Curves We have now the drift M(t) for each maturity. We also have the three factor volatilities for each maturity. Before we do the simulation we need to generate three columns of normal random variables for the whole curve using excel build function (=Rand). =RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RA ND()+RAND()+RAND()+RAND()-6 Now we have all the ingredients to start to simulate the forward curve using the following equation: 𝐹(𝑡, 𝑇) = 𝐹(𝑡, 𝑡) + 𝑚(𝑡)𝑑𝑡 + (𝑣𝑜𝑙1 ∗ 𝑊1 + 𝑣𝑜𝑙2 ∗ 𝑊2 + 𝑣𝑜𝑙3 ∗ 𝑊3) ∗ √𝑑𝑡 + ( 𝐹(𝑡) − 𝐹(𝑡 − 1 𝑑𝑡 ) 𝑑𝑡 Where F(t,t) is the current rate, M(t) is the drift, vols are the volatilities for the first, second and third factors. The W is the Brownian motion generated via the excel function Rand. We then get the simulated entire HJM forward curve which we can use to price bonds or derivatives for any maturity points. One issue we may notice in the simulated forward curve is that the rates we get at the longer end of the maturity seems to be negative. We may simply take the absolute value of the result alternatively, re-investigate or check any potential errors in the data (this may be difficult if one is working with large data set as in this case). -6 -4 -2 0 2 4 X 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0
  • 9. Figure 1.4 1.7 Pricing Zero Coupon Bond Since we have simulated the forward curve, we can easily compute the zero coupon bond for any maturity point. For example, to compute the zero coupon yield now for a maturity of 2 years, we can start by summing up the 2 year forward rates. Below are more detailed information on how to compute the zero coupon bond under HJM model. There are two ways to calculate ZCB in HJM model: Numerical integration of the current forward curve. 𝑍(𝑡, 𝑇) = exp(∫ 𝑓(𝑡, 𝑠)𝑑𝑠 𝑇 0 Monte-Carlo (MC) Simulation 𝑍(𝑡, 𝑇) = exp(∫ 𝑟(𝑠)𝑑𝑠 𝑇 0 We now use the MC method to compute the zero coupon bond. From our previous calculation we do have the risk-neutral drift for all maturity points. We do also have all the volatility factors for each maturity points. In addition, we do have also the initial yield curve data. The next step is to integrate the forward rate curve for specific maturity point and repeat these N times to come up with final ZCB price using the formula exp(− ∑ 𝑟(𝑡)𝑑𝑡) We then use the trapezium rule to compute the ZCB price by integrating the initial forward curve. We use the function =EXP(-int_trpzm(C8,$B$11)) (see VBA code module6 to see the function used). We can also either use the simulated forward curve or use HJM function to calculate the forward curve quickly. 0% 1% 2% 3% 4% 5% year 0.98 1.98 2.98 3.98 4.98 5.98 6.98 7.98 8.98 9.98 Simulated Forward Rates
  • 10. The final result can be seen in the spreadsheet under the tab “Zero_cpn_Price”. Enter the parameters and also number of simulations and the price of the bond is calculated. Reaching the number of simulations to 1000, excel is extremely slow. The chart below shows the simulated zero coupon bond price. Figure 1.5 Interest Rate Options (Cap/Floor) 1.8 Discount Factors Since the underlying forward rates under HJM follow some stochastic process, we need to use unique discounting factors for each simulation. For example, for each simulation, the pay-off made at expiry T should be discounted by exp(∫ 𝑟(𝑠)𝑑𝑠 𝑇 0 Given the discount factors for each simulation and the simulated libor rates for the options expiry date, we can calculate the price of each caplet and floorlet using the payoff Cap: 𝑀𝑎𝑥(𝐿 − 𝐾, 0) Floor: 𝑀𝑎𝑥(𝐾 − 𝐿, 0) We then take the above payoff and scale these by a unique discount factor for each simulation. In the attached spreadsheet, you will be able to see the discounted cap and floor prices for each simulation Table. 1.3 Sim Distcount Factors 6m Libor Dis.Cap Prices Dis.Floor Prices Runing Average Caplet 1 0.736962493 1.35% 0.00% 2.11% 0.00% 2 0.718482632 1.43% 0.00% 2.00% 0.00% 3 0.494495649 9.02% 2.38% 0.00% 0.79% 0.976 0.977 0.978 0.979 0.98 0.981 year 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ZCB YIELD CURVE
  • 11. Change the number of simulation input and press the gray button to see different iterations of the Cap and Floor price computations. The figure below shows the CAP price convergence as the number of simulations is increased from low number up to 1000 simulations. At lower simulations prices seem to fluctuates but stabilize later afer 200 simulations. So increasing the number of simulations from 400 to 1000 does not have any significant change in the prices but also reduces the computation speed. Figure 1.6 0.00% 0.20% 0.40% 0.60% 0.80% 1.00% Sim 32 64 96 128 160 192 224 256 288 320 352 384 416 448 480 512 544 576 608 640 672 704 736 768 800 832 864 896 928 960 992 Cap price covergence
  • 12. References M. Avellaneda, A. Levy, A. Paras, “Pricing and hedging derivative securities in markets with uncertain volatilities”, Journal of Applied Finance, Vol 1, 1995 Paul Wilmott, P.Wilmott on Quantitative Finance”, 2nd Edition, Volume 3, Wiley. CQF Lecture 2010/2011 – Heath, Jarrow and Merton Model CQF Lecture 2010/ 2011 - Advanced Volatility Modelling in Complete Markets P. Wilmott, A. Oztukel, “