QuantLib extension for model calibration
Followings are theoretical document of this project. The original document is rendered by the Markdown and Latex, you'd better copy&paste the following document into your favorite Markdown&Latex viewer, at least for the moment.
Author : Hanjin Kim
Generated date : 2018-Jan-3rd
Last modified date : 2018-Jan-16th
Modification log :
* (2018-May-30th, Hanjin Kim) Title changed into "Gaussian affine model" (new reference)
* (2018-May-30th, Hanjin Kim) Formula modified for generalized correlations
* (2018-Jan-16th, Hanjin Kim) Section 'Swaptions' added (WIP)
* (2018-Jan-16th, Hanjin Kim) Page format changed into MathJax + Pacdoc (w/ crossref)
* (2018-Jan-4th, Hanjin Kim) Sections for zero bond options added
* (2018-Jan-3rd, Hanjin Kim) Document generated
This document describes mathmetical details on the short-rate model which is linearly composed with N gaussian factors as,
$$ r(t) = \sum_{i=0}^{N}x_i(t) + \phi(t) $$ {#eq:gausssolution}
where
To solve the @eq:ousde, first we define,
$$
E_i(s,t) = e^{-\int_s^ta(u)du}
\
E_i(t) = E_i(0,t)
$$
This yields a couple of properties, such as : $$ E(u,t) = \frac{E(s,t)}{E(s,u)}\ E(t,s) = \frac{1}{E(s,t)} $$
The solution of the @eq:ousde can be derived by variation of parameters. Changing varable $$ f(x(t),t) = x(t)E(s,t) $$ we get $$ \begin{align} df(x,t) & = -xa(t)E(s,t)dt + E(s,t)dx\ & = -xa(t)E(s,t)dt + E(s,t)[a(t)x(t)dt + \sigma(t)dW(t)]\ & = \sigma(t)E(s,t)dW^Q(t) \end{align} $$
The solution for
Reversing the variation of parameters, we have : $$ \begin{align} x(t) &= \frac{1}{E(s,t)}x(s) + \int_s^t \frac{\sigma(u)}{E(u,t)}dW(u)\ \end{align} $$ {#eq:ousolution}
Using the @eq:ousolution we can obtain the short rate : $$ r(t) = \phi(t) + \sum_{i=0}^{N} \left( \frac{x_i(s)}{E_i(s,t)} + \int_s^t \frac{\sigma_i(u)}{E_i(u,t)}dW(u) \right) $$
Its mean and variance can be combined immediately :
$$
\bar r(t) = \mathbb{E}\left[r(t)|\mathcal{F}s\right]=\phi(t) + \sum_i \frac{x_i(s)}{E_i(s,t)}
$$ {#eq:meanofr}
and the variance is, for $s\le t\le T$ :
$$
\begin{align}
V_r(s,t)
& = \mathbb{Var}\left[r(t)|\mathcal{F}s\right] \
& = \mathbb{E}\left[ \left(r(t) - \bar r(t) | \mathcal{F}s\right)^2\right]\
& = \mathbb{E}\left[ \left(\sum{i=0}^{N} \int_s^t \frac{\sigma_i(u)}{E_i(u,t)}dW_i(u)|\mathcal{F}s \right)^2\right] \
& = \mathbb{E}\left[
\int_s^t \left(\sum{i=0}^{N} \frac{\sigma_i(u)}{E_i(u,t)}\right)^2du | \mathcal{F}s
\right]\
& = \sum{i,j} \int_s^t \frac{ \rho{ij}(u)\sigma_i(u)\sigma_j(u)}{E_i(u,t)E_j(u,t)}du\
& = \sum{i,j} \frac{1}{E_i(t)E_j(t)} \int_s^t \rho_{ij}(u)\sigma_i(u)\sigma_j(u)E_i(u)E_j(u)du
\end{align}
$$ {#eq:varofr}
Having the @eq:meanofr, all we have to do to derived the shor-rate
Before proceed, we define a form of integral of
which has a few of useful properties :
$$ \begin{align} \frac{\partial}{\partial t}B(t,T) & =a(t)B(t,T)-1 \ \frac{\partial}{\partial T}B(t,T) & =\frac{1}{E(t,T)} \ B(t,S) - B(t,T) & = \frac{B(T,S)}{E(t,T)} \end{align} $$ {#eq:BtTprop}
Define the integral of the short rate : $$ \begin{align} I(t,T) & = \int_t^T r(u)du \ & = \int_t^T\phi(u)du + \sum_{i=0}^{N} \left( \int_t^T \frac{x(s)}{E_i(s,u)}du + \int_t^T\int_s^u \frac{\sigma_i(z)}{ E_i(z,u)}dW_i(z)du \right)\ & = \int_t^T\phi(u)du + \sum_{i=0}^{N}\frac{B_i(t,T)}{E_i(s,t)}x_i(s) + \sum_{i=0}^{N} \int_t^T\int_s^u \frac{\sigma_i(z)}{ E_i(z,u)}dW_i(z)du \end{align} $$ {#eq:ItT}
Note that
and the variance :
$$ \begin{align} V_I(t,T) & = \mathbb{Var}\left[I(t,T)|\mathcal{F}t\right] \ & = \mathbb{E}\left[ \left( \sum{i=0}^{N} \int_t^T \left(\int_t^u \frac{\sigma_i(s)}{E_i(s,u)}dW_i(s)\right)du | \mathcal{F}t \right)^2\right] \ & = \mathbb{E}\left[ \left( \sum{i=0}^{N} \int_t^T \left(\int_s^T \frac{\sigma_i(s)}{E_i(s,u)}du\right)dW_i(s) | \mathcal{F}t\right)^2 \right] \ & = \mathbb{E}\left[ \int_t^T \left( \sum{i} \sigma_i(s)\int_s^T \frac{1}{E_i(s,u)}du \right)^2ds | \mathcal{F}t \right]\ & = \mathbb{E}\left[ \int_t^T \left( \sum{i} \sigma_i(s) B(s,T) \right)^2ds | \mathcal{F}t \right]\ & = \sum{i,j}\int_t^T \rho_{ij}(u)\sigma_i(u)\sigma_j(u)B_i(u,T)B_j(u,T)du \end{align} $$ {#eq:varItT}
Recall that if
Given the actual market price,
Writing the similar releation for
We can obtain the deterministic parameter,
where the instantaneous forward rate seen from
$$ P(t,T) = A(t,T)\text{exp}\left(-\sum_i B_i(t,T)x_i(t)\right) $$ {#eq:affineform}
where
A zero-coupon bond option can be priced using the Black formula. It takes the variance of the bond price ratio to obtain the volatility. This section wil be devoted to obtain the variance of the bond price ratio.
We begin from the SDE of the zero-coupon bond price. From the eq.7 : $$ dP(t,T) = r(t)P(t,T)dt -\sum_i \sigma_i(t)B(t,T)P(t,T)dW^Q_i(t) $$
where the risk neutral measure is denoted by
To calculate closedd forms, we are particularly interested in the bond ratio with fixing and paying times
with integrated variance :
$$ \begin{align} V_{P-ratio}(t,T_F,T_P) & = \mathbb{E}\left[ \left( \sum_i\int_t^{T_F}\sigma_i(u)\left(B_i(u,T_P)-B_i(u,T_F)\right)dW_i(u) | \mathcal{F_{T_P}}\right)^2 \right]\ & = \sum_{i,j}\int_t^{T_F}\rho_{ij}(u)\sigma_i(u)\sigma_j(u) \frac{B_i(T_F,T_P)}{E_i(u,T_F)}\frac{B_j(T_F,T_P)}{E_j(u,T_F)} du\ & = \sum_{i,j}B_i(T_F,T_P)B_j(T_F,T_P)\int_t^{T_F} \frac{\rho_{ij}(u)\sigma_i(u)\sigma_j(u)}{E_i(u,T_F)E_j(u,T_F)}du \end{align} $$ {#eq:Vpratio}
For the case
Now consider an zero-bond put option with with strike
Estimating the price of swaptions is essential especially when the N-factor Gaussian model is calibrated to eg. the market data. For the 1-factor case, the well-known Jamshidian's Trick (@Jamshidian). In this section we try to obtain a closed from of the swaption price for the general N-factor model.
Conversion of the drift of a process
with the numeraries evolving under
where
Since @eq:ousde is of the bank-acount measure, its T-forward dynamics can be obtained with having
Then the T-forward dynamics of a gaussian factor becomes : $$ dx_i(t) = \left[-a_i(t)x_i(t) + \sum_j\rho_{ij}\sigma_i(t)\sigma_j(t)B_j(t,T)\right]dt + \sigma dW_i^T(t) $$ {#eq:ouTforwardsde}
which leads to the T-forward solutions : $$ x_i(t) = \frac{1}{E(s,t)}x(s) - M_i^T(s,t) + \int_s^t \frac{\sigma_i(u)}{E_i(u,t)}dW_i^T(u) $$ {#eq:ouTforwardSolution}
with (WIP) $$ M_i^T(s,t) = \sum_j\int_s^t\rho_{ij}\sigma_i(u)\sigma_j(u)\frac{B_j(u,T)}{E_i(u,t)}du $$