Re: Model calibration with external optimizers

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Model-calibration-with-external-optimizers-tp7186p7189.html

On Thu, 2009-02-19 at 04:28 -0800, jarkki wrote:
> I have the optimization routine set up as you described(I guess), but my
> optimizer fails to converge.
>
> I am trying to calibrate the Heston model for just one maturity, and to the
> prices, not to the volatilities. I think the problem might lie in the set up
> of the calibration helper and term structure objects. I also tried with some
> reference data/prices, and in the cost function of my optimizer, the
> "problem->values(parameters)" gave wrong prices. I would appreciate, if you
> have time, if you could check my code for errors.

I just had a quick look at the setup (I didn't run the code) and there's
a problem.  (Incidentally, that's one that returns over and over and
keeps fooling people. We'll have to do something about it some time.)
Anyway, if you do:

> //Days to maturity
> Period maturity(dayCounter.dayCount(evaluationDate, expiryDate), Days);

and

> //Create helper for Heston calibration
> boost::shared_ptr<CalibrationHelper> option(new
> HestonModelHelper(maturity, calendar, s0->value(), X[i], vol, riskFreeTS,
> dividendTS, false));

You'll end up with the wrong expiration dates for the helpers, because
maturity (which is a period of n calendar days) will be interpreted by
the helper as a number of business days instead.  May you try replacing
the first by

Period maturity(calendar.businessDaysBetween(evaluationDate,
expiryDate), Days);

and see what happens?

Luigi


--

Green's Law of Debate:
Anything is possible if you don't know what you're talking about.



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users