G2++ calibration

Joined
8/29/14
Messages
4
Points
11
Hi everyone!

I'm currently trying to calibrate the G2++ model by Brigo and Mercurio to the ATM volatility surface in Matlab.
But, instead of using the percentage difference between market prices and model prices as the objective function (for LSQNONLIN and GA) , I'm using the difference between market volatilities and model's implied volatilities (I know it is unusual, but it is for my master thesis). Unfortunately some G2 implied volatilities are NaN (especially for short tenors and maturities) and stop the Genetic Algorithm from finding the minimum.
So I was wandering if:
Is it a good idea to substitute NaN values with the corrisponding Market Volatility multiplied by a large number or is it better to eliminate the corresponding Market Volatility?
Or is it better to put a large value of the objective function each time there is a NaN implied volatility as a result of the model?
I cannot change algorithm, otherwise I would have used PATTERNSEARCH.
So please help me!

Thanks.

P.S. I'm sorry for any grammar mistake, but English isn't my first language.
 
What specific GA algorithm are you using? I have not used GA but I reckon Differential Evolution(DE) might be 'better'.

In general, the presence of NaN signals that something is fundamentally wrong in your code. That must be addressed.

If you can give me the NL system I can give it a shot in DE.

// e.g. log(0) can give NaN.
 
Last edited:
Thanks for your answer.
I would try to use devec3 and check my code if there is anything wrong.

In addition to Storn et al..

The recent book by Kienitz and Wetterau "Financial Modelling" has a chapter on 6 methods (Lev-Mar, DE, SQP, SA, l-BFGS, Nelder-Mead) + Matlab code.

It would be interesting to determine the optimal parameters for DE and how the method compares to the above 'local'(?) methods.
 
Last edited:
I had a bug in my code... Now everything works fine (I hope). I get some extreme parameters' values (a = 0.4747, b = 0.0045, sigma = 0.0212, eta = 0.0106, rho = -0.9925), but I also get an average percentage error of -0.2318% between model and market implied volatilities. By the way, I am using market data from Bloomberg Euro VCUB on 18-August-2014.
Thanks for the help!
 
I used the matlab built in Genetic Algorithm (GA) solver and used the results as starting parameter guesses for the Non-Linear Least Square solver (LSQNONLIN), another built in matlab function.
 
I had a bug in my code... Now everything works fine (I hope). I get some extreme parameters' values (a = 0.4747, b = 0.0045, sigma = 0.0212, eta = 0.0106, rho = -0.9925), but I also get an average percentage error of -0.2318% between model and market implied volatilities. By the way, I am using market data from Bloomberg Euro VCUB on 18-August-2014.
Thanks for the help!

Hey, may i know how do you get your market data from Bloomberg Euro VCUB?
 
BTW, the G2 model is also implemented in QuantLib.
The implementation seems to be a little bit buggy (at least it crashed sometimes as I did a model risk test and priced one special derivative with many models).
But you may probably use it as a benchmark/test for your implementation in Matlab.
Here are instructions how to build QuantLib:
https://www.quantnet.com/threads/how-to-build-quantlib-1-1-on-visual-studio-2010.6619/
And here is the overview of Term Structure Models and relevant classes in QuantLib
http://www.yetanotherquant.de/QuantLib/ImplementingHPS/
 
Back
Top Bottom