I know that something like this has been on the forum before, but it didn't solve my problem (the thread leaves of when the poster apparently solved his problem). I am trying to calibrate the G2++ model parameters to swaption prices as described in Brigo and Mercurio (2nd edition pg 158). I use the swaption formula they describe to compute swaption prices and try to fit the parameters to match a number of market observed swaption prices.

The calculation of the swaption price involves numerically solving an integral. The integrant, in return, involves numerically finding a root to an equation. I compute the root of the equation using Matlab's fsolve and the numerical integration with Matlab's quad or quadl procedures (quad (using a adaptive Simpson quadrature, about 100 function evaluations) and quadl (using adaptive Gauss/Lobatto quadrature, about 280 function evaluations, thus slower)). This, as one might expect, is pretty slow, taking a little more than 2.5 seconds to calculate the price of a swaption.

I then try to fit the parameters to a number of swaption prices (originally 70 but have reduced to 9 without convergence in acceptable time) using the Matlab minimizer lsqnonlin.

My questions on this are threefold:1. As the calculation of the swaption price and the evaluation of the integrand seems critical, are there any ways to speed this up in Matlab? What would you consider acceptable evaluation times for the price of a swaption?2. Are there better ways of numerically computing the integral? I read something on the forum about using Gauss-Legendre polynomials to compute it, but am unsure of how that would work.3. Is the optimization algorithm (lsqnonlin) the right approach? I have also read on the forum about using a simulated annealing algorithm, is that a better approach?

Any practical input on this would be highly apreciated. I am also aware that Matlab may not be the best option to do this, but am a little reluctant to implement all of its neat functions myself.Thank you very much in advanceB

Gauss-legendre is easy enough to implement, you just need x-values (abscissas) and weights, evaluate the integral at these points, weight them and the answer magically pops out. 2.5s per swaption is too slow for calibration.

You can get the weights athttp://www.efunda.com/math/num_integration/findgausslegendre.cfmEven using 10 points is accurate, 20 is better.

For the root of the equation use any gradiant method.

I can't tell you much about Matlab, but the optimisation itself is non-trivial, to put it mildly. Convergence anywhere close to a global maximum is difficult to achieve. Also you'll probably get different parameters from swaption prices compared to caplet + swaption prices.

to speed up the pricing of european swaptions you could look at approximating the dynamics of the swap rate under the swap measure, for example using time zero values of so-called 'low variance martingales' yields an approximate normal vol for the swaption. This is a little like some approximations used in BGM models. There is a recent article which discusses this idea, although I'm not sure they explicitly mention g2++.