Posted by
Alexander Lotter on
URL: http://quantlib.414.s1.nabble.com/Generalized-Hull-White-model-problems-tp12503.html
Hello Javit,
I found the Generalized Hull-White model checked by Luigi into the trunk a couple of months ago.
As you told me, the newest version was (see .zip file):
http://old.nabble.com/Generalized-Hull-White-model-with-non-constant-parameters-td26287370.html#a26635940The last version in trunk on sourceforge as far as I know 17226. This version have some differences to the version you posted in that archive in december 2009.
There is also no examples in the current trunk of the QuantLib, which contains your version of BermudanSwaptions or some code for the test-suite.
There is no a version of PiecewiseConstantParameter2 as you proposed to implement. So, without this change, I couldn't get the current trunk version to run without run-time error (vector subscript out of range). As I added this class, I got the current version to run, but calibration took me too long to wait.
To be simple:
trunk version (quick check
http://quantlib.svn.sourceforge.net/viewvc/quantlib/trunk/QuantLib/ql/experimental/shortrate/)
generalizedhullwhite.cpp
...
a_ = PiecewiseConstantParameter(speedperiods_, PositiveConstraint());
...
your version in the zip file
a_ = PiecewiseConstantParameter2(speedperiods_, PositiveConstraint());
I reduced the TimeGrid from 30 to 1 as you proposed (see your BermudanSwaption example):
// Building time-grid
TimeGrid grid(times.begin(), times.end(), 1);
The calibration still take too long, never comes back.
I get stuck here on calibrateModel:
---------------------------------------
std::cout << "Generalized Hull-White calibration" << std::endl;
for (i=0; i<swaptions.size(); i++)
swaptions[i]->setPricingEngine(boost::shared_ptr<PricingEngine>(
new TreeSwaptionEngine(generalizedHWmodel, grid)));
calibrateModel(generalizedHWmodel, swaptions);
---------------------------------------
I tried
// Building time-grid
TimeGrid grid(times.begin(), times.end(), 30);
as well as
// Building time-grid
TimeGrid grid(times.begin(), times.end(), 1);
Any suggestions?
I would like to assist on this issues and get the trunk version to work properly. We could also add the sample to the BermudanSwaption and test-suite as well.
Please correct me if I missed something.
Take care
Alex