Login  Register

RE: Re: bermudan swaption, simplex

Posted by Zakoian2000 on Jul 16, 2003; 2:21pm
URL: http://quantlib.414.s1.nabble.com/Re-bermudan-swaption-simplex-tp2586p2588.html

Nehal,

Thank you very very much for your deep response. I will think about what you
have said and re-look at the code.

Regards,

Zakoian

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]On Behalf Of Nehal Patel
Sent: Tuesday, July 15, 2003 5:49 PM
To: '[hidden email]'; '[hidden email]'
Subject: RE: [Quantlib-users] Re: bermudan swaption, simplex


FYI,
The constructor of g2 has a bug in it... the m_ member variable never gets
initialized and so when the constructor runs you get a "null pointer"
exception (excuse my java-speak).

I noticed this when I tried to modify the Bermudan swaption example to
include g2.  I added a section something like:

Handle<Model> modelG2(new G2(rhTermStructure));
time(&tstart);
bermudanSwaption.setPricingEngine(
 Handle<PricingEngine>(new TreeSwaption(modelG2, 40)));
std::cout << "G2:       " << bermudanSwaption.NPV() << std::endl;
std::cout << "Elapsed time : " << time(&tend)-tstart << std::endl <<
std::endl ;

Obviously this is an uncalibrated g2 w/ default parameters so the price is
meaningless in comparison with the other models, but I was curious how slow
a 2factor tree might be in comparison to the 1 factor models.

If one actually wanted to calibrate g2, what's the best way to do this?

time(&tstart);
std::cout << "G2: " << std::endl;
swaptions.setPricingEngine(
    Handle<PricingEngine>(new TreeSwaption(modelG2, grid)));
calibrateModel(modelG2, swaptions, 0.25);
std::cout << "calibrated to "
          << ArrayFormatter::toString(modelG2->params(),6)
          << std::endl;
std::cout << "Elapsed time : " << time(&tend)-tstart << std::endl <<
std::endl ;

...might take forever to run.

swaptions.setPricingEngine(
    Handle<PricingEngine>(new JamshidianSwaption(modelG2));

compiles but results in a run time "null pointer" error.  (I haven't
throroughly investigated, but it seems that modelG2 is of type
Handle<Model>, which is somehow allowed to be implicitly be cast to Handle<
ShortRateModels::OneFactorAffineModel>, but this cast must be done using
dynamic_cast because the resulting "pointer" is null.  Hope that's not too
confusing.  I'm not sure exactly what change to Handle or JamshidianSwaption
could be made to detect this error at compile time.)

Anyway it seems to do a quick calibration of g2, you would either need a
special JamshidianG2Swaption class which could utilize G2 "analytic" zero
coupon bond formula, or better yet somehow modify/expand/generalize G2 and
JamshidianSwaption so that my naïve attempt above would work.

I'll think a little about this but I thought I'd share my limited experience
so far.

Cheers, nehal


-----Original Message-----
From: Sad [mailto:[hidden email]]
Sent: Tuesday, July 15, 2003 8:01 AM
To: [hidden email]
Subject: Re: [Quantlib-users] Re: bermudan swaption, simplex

Hello everyone,

On Thursday 10 July 2003 11:51, Luigi Ballabio wrote:
> Sad, may you step in? What was the status of two-factor models?
Well, if you want these models to work, you will have to dig into the dirt!
Basically, G2++ was just here to see if multi-factor short-rate models can
integrate into the current framework. It was hardly numerically tested at
all.

Regards,
Sad


-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
_______________________________________________
Quantlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
Quantlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users