Hi Quantlib,
How can I get the expected value of the short rate at a given time in the future,for the Vasicek model?
After calibrating the model using the swaptions as given in the example for BermudanSwaption, the values I obtained are:
a = 0.0162584
b = 0.744713 sigma = 0.0294303 Assuming a spot rate of 0.05, I tried using the expectation method of the underlying dynamics of Vasicek, but the values seem to decrease as time is increased from 1 to 30 years. I wonder, if it should approach the long term mean towards 0.744 . I also tried using shortRate method ,but it returns a constant value.
Thanking you,
asd
Following is the code I tried(Also attached the files):
Handle<Model> modelVasicek(new Vasicek());
std::cout << "Calibrating to swaptions" << std::endl;
swaptions.setPricingEngine( Handle<PricingEngine>(new JamshidianSwaption(modelVasicek))); calibrateModel(modelVasicek, swaptions, 0.25); std::cout << "calibrated to " << modelVasicek->params() << std::endl << std::endl; ofstream myfile("outvas_file.txt");
myfile << "a = " << modelVasicek->params()[0] << endl ; myfile << "b = " << modelVasicek->params()[1] << endl ; myfile << "sigma = " << modelVasicek->params()[2] << endl ; Handle<Vasicek::ShortRateDynamics> dynamics = ( (Vasicek*)(&(*modelVasicek)) )->dynamics();
Handle<DiffusionProcess> diffProcess = dynamics->process() ;
for (i=0;i<30;i++) { double expectation = diffProcess->expectation(i,0.05,i); myfile << "(T-t) : " << i << " expectation " << expectation << " short rate " << dynamics->shortRate(i,0.05) << endl; } Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software a = 0.0162584 b = 0.744713 sigma = 0.0294303 (T-t) : 0 expectation 0.05 short rate 0.794713 (T-t) : 1 expectation 0.0491937 short rate 0.794713 (T-t) : 2 expectation 0.0484003 short rate 0.794713 (T-t) : 3 expectation 0.0476198 short rate 0.794713 (T-t) : 4 expectation 0.0468518 short rate 0.794713 (T-t) : 5 expectation 0.0460962 short rate 0.794713 (T-t) : 6 expectation 0.0453528 short rate 0.794713 (T-t) : 7 expectation 0.0446214 short rate 0.794713 (T-t) : 8 expectation 0.0439018 short rate 0.794713 (T-t) : 9 expectation 0.0431938 short rate 0.794713 (T-t) : 10 expectation 0.0424973 short rate 0.794713 (T-t) : 11 expectation 0.0418119 short rate 0.794713 (T-t) : 12 expectation 0.0411376 short rate 0.794713 (T-t) : 13 expectation 0.0404742 short rate 0.794713 (T-t) : 14 expectation 0.0398215 short rate 0.794713 (T-t) : 15 expectation 0.0391793 short rate 0.794713 (T-t) : 16 expectation 0.0385474 short rate 0.794713 (T-t) : 17 expectation 0.0379258 short rate 0.794713 (T-t) : 18 expectation 0.0373142 short rate 0.794713 (T-t) : 19 expectation 0.0367124 short rate 0.794713 (T-t) : 20 expectation 0.0361203 short rate 0.794713 (T-t) : 21 expectation 0.0355378 short rate 0.794713 (T-t) : 22 expectation 0.0349647 short rate 0.794713 (T-t) : 23 expectation 0.0344008 short rate 0.794713 (T-t) : 24 expectation 0.0338461 short rate 0.794713 (T-t) : 25 expectation 0.0333002 short rate 0.794713 (T-t) : 26 expectation 0.0327632 short rate 0.794713 (T-t) : 27 expectation 0.0322348 short rate 0.794713 (T-t) : 28 expectation 0.031715 short rate 0.794713 (T-t) : 29 expectation 0.0312035 short rate 0.794713 BermudanSwaption.cpp (14K) Download Attachment |
Free forum by Nabble | Edit this page |