# Two Factor Hull White Model Calibrate

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),

• 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). – wen Feb 11 at 21:50