# Calibration: Comparison of deterministic Optimizers

The gaol is to calibrate a time dependent Heston model defined by the following SDE

The parameter set $\{\kappa_t, \theta_t, ,\sigma_t, \rho_t\}$ is supposed to be piecewise constant in time. This model has a semi-closed solution for plain vanilla European put/call options based on the characteristic function method .

The DAX implied volatility surface based on July 5, 2002 data taken from  defines the “benchmark” calibration problem. The benchmark model parameters for the optimization problem are given by $\Theta = \{\nu_0, \kappa_{0\leq t < 0.25}, \kappa_{0.25 \leq t},\theta, \sigma, \rho\}$.

The non-linear least square optimization problem is defined by the goodness of fit measure $\zeta=\min_{\Theta} \sum_{i=1}^N \left( \sigma_i^{market}(K,T) - \sigma_i^{model}(K,T, \Theta) \right)^2$

where $\sigma_i^{market}(K,T)$ is the market implied volatility for strike K and maturity T and $\sigma_i^{model}(K,T, \Theta)$ is the corresponding Black-Scholes volatility implied from the model price. The optimal solution for this problem is $\Theta_{min} = \{ 0.2231, 39.651, 7.546, 0.0954, 5.1865, -0.5004 \}$

leading to a goodness of fit measure of $\zeta_{min}=74.4731$ (Please keep in mind that this result is the outcome of a naive calibration procedure. Due to the large $\kappa$ and $\sigma$ values I’d not use these parameters to price a derivative.). The diagram above shows the “goodness of fit”-surface for the parameter sets in $\Theta = \{ 0.2231, 39.651, \kappa_{0.25 \leq t} \in [0, 16], 0.0954, \sigma \in [0, 16], -0.5004 \}$

To be able to compare a larger number of deterministic optimizers the model calibration will be carried out using R and with help of the additional packages minpack.lm and minqa.

Non-linear Least Square Optimization:

1. nls.lm: Levenberg-Marquardt algorithm(based on MINPACK, also available in QuantLib)
2. nls: Gauss-Newton algorithm
3. nl2sol:based on the PORT library.

Non-linear (trusted region) Minimization:

1. nlm:Newton style minizer
2. bfgs: quasi-Newton method published by Broyden, Fletcher, Goldfarb and Shanno
3. l-bfgs-b: limited memory BFGS algorithm incl.box constraints
4. cg: conjugate gradient algorithm
5. nm: Nelder-Mead method
6. bobyqa:trust region method that forms quadratic models by interpolation.
7. newuoa: trust region method that forms quadratic models by interpolation.
8. uobyqa:trust region method that forms quadratic models by interpolation.

The particular result dependents on the starting vector but the following diagram shows a common outcome. The best methods are the non-linear least square algorithms nls.lm and nls followed by nl2sol. Algorithms not included in the diagram have performed even worse than “nm” for this problem.

The goodness of fit measure is calculated in C++ based on the QuantLib and exposed to R using RCPP. The C++ code and the R scripts to perform the optimizations and to create the plots can be found here.