CTSMMCapletMaxHomogeneityCalibration calibration fails with exception

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

CTSMMCapletMaxHomogeneityCalibration calibration fails with exception

NQ-3
Hello All,
I was trying out the smooth simultaneous calibration routine in Quantlib (CTSMMCapletMaxHomogeneityCalibration). I followed the code in the test-suite as a reference. I ran it with the data provided in Ametrano and Joshi's paper on the same topic. First thing that baffled me was I could not reproduce the published a,b,c,d values using the AbcdCalibration class. But then I verified that the computed swaption values were almost the same in both the cases i.e. the published abcd values and the ones my program spit out. The co-terminal swaption values however did match in both these cases. 

When I tried running the calibration routine it threw an exception "cylinder centre must have positive coordinate". I also tried it using the published values of abcd with the same result. I have verified that the data matches the published data. I know I must have goofed up somewhere but am unable to nail it. Any pointers would be greatly appreciated. 

Below is the relevant portion of code that I used. 
Thanks,
NQ
p.s:This question has been cross-posted on Mark Joshi's forum

Step 1: Build piecewise constant variances with corresponding abcd values

CODE: SELECT ALL
  
       boost::shared_ptr<PiecewiseConstantCorrelation> fwdCorr(new
                  ExponentialForwardCorrelation(rateTimes_,
                                      longTermCorrelation_,
                                      beta_));

        boost::shared_ptr<LMMCurveState> cs(new LMMCurveState(rateTimes_));
        cs->setOnForwardRates(todaysForwards_);

        boost::shared_ptr<PiecewiseConstantCorrelation> corr(new
                  CotSwapFromFwdCorrelation(fwdCorr, *cs, displacement_));

                  for (Size i=0; i<numberOfRates; ++i) {
         
         swapVariances[i] = boost::shared_ptr<PiecewiseConstantVariance>(new
         PiecewiseConstantAbcdVariance(myA[i], myB[i], myC[i], myD[i],
                                   i, rateTimes_));
      }

Step 2: instantiate the calibrator

CODE: SELECT ALL
  
                CTSMMCapletMaxHomogeneityCalibration calibrator(evolution,
                                                    fwdCorr,
                                                    swapVariances,
                                                    capletVols_,
                                                    cs,
                                                    displacement_,
                                                    caplet0Swaption1Priority);


Step 3: calibrate
CODE: SELECT ALL
      Natural maxIterations = 10;
      Real capletTolerance = 1e-4; // i.e. 1 bp
      Natural innerMaxIterations = 100;
      Real innerTolerance = 1e-8;
    
      bool result = calibrator.calibrate(numberOfFactors_,
                                       maxIterations,
                                       capletTolerance,
                                       innerMaxIterations,
                                       innerTolerance);



------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users