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:
- Calculate the row difference of the historical data matrix \(M\):
- 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:
- 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:
where \(Y = L_i\) and \(A\) is the vandermonde matrix with \(j = D + 1\) columns and \(x = 0,1,...,n\)
- 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
- From there we get the 3 volatility vectors by evaluating each polynomial at \(x = 0,1,...,n\) tenors.
- 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\):
- 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\)