PCA HJM Kernel - 2023.2 English

Vitis Libraries

Release Date
2023-12-20
Version
2023.2 English

This sub-kernel deals with the calibration and calculation of the volatility vectors and drift component for the Monte-Carlo simulation. Takes as an input a matrix representing historical data, arranged in a set of vectors \(k\) tenors wide with historical observations going from \(m\) days in the past up to today’s forward curve. For better numerical results, the framework will reduce the historical data into 3 principal components, whose weighted matrix will represent the discrete volatilities for the model. We then approximate each discretised volatility vector with a polynomial. For best results, we have chosen to approximate the first volatility vector with a constant and the remaining two with cubic polynomials.

The outputs are calculated by the following process:

  1. Calculate the row difference of the historical data matrix \(M\):
\[\Delta M = M_{i+1,j} - M_{i,j}\]
  1. Calculate the loadings matrix of the Principal Component Analysis of the matrix’s delta up to 3 factors. This will represent the 3 discrete volatility vectors, \(k\) elements wide:
\[L = pca\_loadings(\Delta M)\]
  1. Apply a polynomial fitting to each volatility vector. We will use a constant approximation (D=0) for the first vector and cubic approximation (D=3) for the second and third vector. A polynomial fitting can be calculated by solving by the least-squares approximation the following system of equations:
\[x=(A^TA)^{-1}A^TY\]

where \(Y = L_i\) and \(A\) is the vandermonde matrix with \(j = D + 1\) columns and \(x = 0,1,...,n\)

\[V_{i,j} = x_{i}^{j-1}\]
  1. Applying polynomial fitting to each loadings matrix’s columns we get the polyfitted vectors \(p_1, p_2, p_3\), each vector is \(D_i\) elements wide and represent the coefficients of the polynomial
\[y = c_0 + c_1x + c_2x^2 + ... + c_nx^n, n = D_i\]
  1. From there we get the 3 volatility vectors by evaluating each polynomial at \(x = 0,1,...,n\) tenors.
  2. For the calculation of the risk neutral drift we take the polyfitted coefficient vectors and calculate the drift vector by evaluating the following function at \(t = 0,1,...,n\):
\[RnD(t)=\sum_{i=0}^{3}(pv(p_i,t\tau)\int_{0}^{t}pv(p_i,s\tau)ds)\]
\[pv(c, x)=c_0 + c_1 x + c_2 x^2 + ... + c_nx^n\]
  1. Lastly, the MonteCarlo engine requires the present interest rate curve in order to serve as the starting point of the path simulation. This is just the last row from the historical data multiplied by \(dt = 0.01\)