0
$\begingroup$

I have a question about the optimizer method to calibrate the parameters of two factor hull white model. I have the analytical pricing formula for cap and market cap price. There are five parameters need to calibrate ($\gamma_1$. $\gamma_2$, $\sigma_1$, $\sigma_2$, $\rho$). The problem is I can not get the fixed parameters, when I change the initial guess for these five paras, I will get different result. Any suggestions are appreciated.

The optimize code is as following:

minimize(error_func, initial_guess, args = (strikes, cap_tenor, zcb, cap_price_market), 
                                            bounds=bound, method="Nelder-Mead")
$\endgroup$
0
$\begingroup$

You are obviously using a local-optimizer ( here Nelder-Mead method). One should expect different results for different initial guesses as it will get stuck to a local minima ( or just a "solution" for Nelder-Mead, as it is a heuristic optimizer). In practice, play around and collect the different solutions and their errors, the smaller the error , the better. You can also use the differential evolution optimizer which is a global optimizer, it is slower but it can give you a good indication of where the actual solution is.

The calibrating instruments is also another thing that you should look at. If you remove one instrument, you might get totally different results. You can compromise the accuracy( i.e. choosing the set of parameters that yields the smallest error) for stability

$\endgroup$
1
  • $\begingroup$ Thank you for your reply. I have some further questions want to ask. How will you choose the target function? I use the $\sum(c_{model} - c_{market})^2$, which give me very small error, even I am in local minima. And does HW2 model use a lot in practice? Since it look so hard to calibrate the parameters (for me). $\endgroup$
    – wen
    Feb 11 '20 at 21:50
0
$\begingroup$

I have been working with the HW2 model for three years (medium-sized European Bank). I calibrate the paramters on ATM-swaption volatilities. As @Canardini said in his answer, it might be better to do also include a global search for optimal paramters.

I use the following procedure:

Day1: First use a global search algorithm (I use controlled random search, which is implemented in nlopt). Then use a local-optimizer and use the result of the global search as a starting point.

Then on Day2: Use only a local-optimizer and use the optimal values from Day1 as starting values. If the value of the target function for both days is similar, then we are finished. Otherwise do a global search followed by local-optimization.

As a target function I use $$ \sum ( c_{i, \text{model}} - c_{i, \text{market}})^2 \cdot \text{vega}_i, $$

where $\text{vega}_i$ is the (analytical) vega of swaption $i$.

Here is some R-code skeleleton:

global <- nloptr::nloptr(
  x = as.numeric(local_start)[1:5], eval_f = target_fun,
  lb = c(1e-7, 1e-7,  1e-7, 1e-7, -1 + 1e-7),
  ub = c(2, 2, 0.1, 0.1, 1 - 1e-7),
  opts = list(algorithm = "NLOPT_GN_CRS2_LM", ftol_abs = 5e-6,
              xtol_rel = 5e-6, ranseed = 1234, maxeval = 1e4)
)

local <- nloptr::nloptr(
  x = global$solution, eval_f = target_fun,
  lb = c(1e-7, 1e-7,  1e-7, 1e-7, -1 + 1e-7),
  ub = c(2, 2, 0.1, 0.1, 1 - 1.e-7),
  opts = list(algorithm = "NLOPT_LN_NELDERMEAD", ftol_abs = 1e-8,
              xtol_rel = 1e-8, ranseed = 1234, maxeval = 1e4)
)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.