The Black Karasinski Calibration Problem continued

In my last blog I introduced the Black Karasinski model. Today I will present some more details of the two step procedure used for the identification of the model parameters.
  1. inner loop: identification of the time dependent drift function by solving the regularized curve fitting problem given the speed and the volatility parameters
  2. outer loop: identification of the speed and volatility parameter, such that the model prices of caps and swaptions are close to the quoted market prices.
Since the problem of fitting of the drift function is ill posed (see the oscillating behaviour of the drift in the picture), regularization techniques have to be applied.
Formulation as a minimization problem including a penalty term (penalizing the L2 norm or the H1 norm of the solution x), leads to a smooth drift, which is consistent with the initial term structure of interest.

For the calculations in step 2 of the algorithm we minimize the functional

To end up with a calibration algorithm which is not too time consuming (compared to models where analytic formulas are available), for the calculation of the gradient with respect to the time dependent drift parameter an adjoint approach is applied. 
Finally we end up with a calibration algorithm with a computational time < 10 sec.

Goodness of Fit   

                                   market data (red) compared to the model data (green)