|
From: Peter C. <pca...@gm...> - 2022-08-24 13:37:03
|
Hi Daniel yes you'd change T in the ctor call ql.Gsr(...). 1. T is the maturity of the zero bond P(0, T) used as a numeraire in the T-Forward measure 2. years 3. slightly higher than 60 I'd think to capture day counter / convention / lag effects, maybe 61 is sufficient already Thanks Peter On Wed, 24 Aug 2022 at 11:47, Daniel <gr...@gm...> wrote: > > Peter, > Thank you for your reply. > Just want to make sure overwriting T means I should change below statement > model = ql.Gsr(term_structure,stepDates, sigmas,reversions,T=60); > to use some other T value instead, am I right? > Two questions: > 1. What is the meaning of T here? > 2. What is the unit for T (month, year)? > 3. If my calibrated swaption has a maximum 30Y x 30Y matrix, what is the T value I should use? > > Thanks, > Mark > > > On Tue, Aug 23, 2022 at 1:30 PM Peter Caspers <pca...@gm...> wrote: >> >> Hi >> >> the GSR model operates in the T-forward measure with T=60 by default. You can overwrite T in the constructor if longer horizons are needed (as it appears to be the case in your setup). >> >> Best >> Peter >> >> >> Daniel <gr...@gm...> schrieb am Mo. 22. Aug. 2022 um 21:25: >>> >>> Thank you Dmitri for your information. Actually I increased the vol surface number to more than to be calibration volatility number, now I can solve for mean reversion and volatility now. >>> >>> But experience another error when I tried to change the yield curve and volatility surface to some other type, I got below error. >>> >>> ---> 14 model.calibrate(swaptions, optimization_method, end_criteria) >>> >>> ~\.conda\envs\tf-gpu\lib\site-packages\QuantLib\QuantLib.py in calibrate(self, *args) >>> >>> def calibrate(self, *args): >>> > return _QuantLib.Gsr_calibrate(self, *args) >>> >>> def setParams(self, params): >>> >>> RuntimeError: G(t,w) should be called with (t,w)=(29.9985,60.0055) in Range [0,60]. >>> >>> >>> What does this runtimeError mean? >>> >>> >>> Thanks, >>> >>> Mark >>> >>> >>> >>> >>> >>> >>> On Mon, Aug 22, 2022 at 12:50 PM Dmitri Goloubentsev <dm...@ma...> wrote: >>>> >>>> Hi Mark, >>>> >>>> >>>> The error is coming from LM optimiser. You should reduce number of points in your vol surface or add more calibration instruments or add some sort of regularisation. >>>> >>>> Kind regards, >>>> Dmitri. >>>> >>>> On Mon, 22 Aug 2022, 17:26 Daniel, <gr...@gm...> wrote: >>>>> >>>>> All, >>>>> >>>>> Please forgive me if someone has answered a similar question before. >>>>> >>>>> I am trying to calibrate interest rate vol surface using GSR (gaussian short rate model) based on this post >>>>> http://gouthamanbalaraman.com/blog/short-interest-rate-model-calibration-quantlib.html >>>>> >>>>> and I found a python example for GSR model calibration. >>>>> https://github.com/mlungwitz/notebooks/blob/master/GSR_Example.ipynb >>>>> >>>>> What I tried to do is to calibrate the same european swaption vol surface in the 1st python example based on 2nd example gsr model specification, what I added is: >>>>> gsr = ql.Gsr(term_structure,stepDates, sigmas,reversions); >>>>> engine = ql.Gaussian1dSwaptionEngine(gsr, 64, 7.0, True, False, term_structure) >>>>> swaptions = create_swaption_helpers(data, index, term_structure, engine) >>>>> >>>>> optimization_method = ql.LevenbergMarquardt(1.0e-8,1.0e-8,1.0e-8) >>>>> end_criteria = ql.EndCriteria(1000, 100, 1e-6, 1e-8, 1e-8) >>>>> model.calibrate(swaptions, optimization_method, end_criteria) >>>>> >>>>> But this will give me this error: >>>>> >>>>> RuntimeError: less functions (5) than available variables (12) >>>>> >>>>> Is the error caused by Gaussian1dSwaptionEngine? Should I proceed with Gaussian1dNonstandardSwaptionEngine? What change should I do to make it work ? >>>>> >>>>> >>>>> Thanks, >>>>> >>>>> Mark >>>>> >>>>> _______________________________________________ >>>>> QuantLib-users mailing list >>>>> Qua...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>> >>> _______________________________________________ >>> QuantLib-users mailing list >>> Qua...@li... >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users |