SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
Darrell1977
Topic Author
Posts: 114
Joined: August 21st, 2002, 4:03 pm

Implementation of BGM/Libor market model

March 5th, 2003, 2:02 pm

Hi!Out of curiosity: Which software do you use to implement the BGM/LIBOR market model if you program it yourself? If you would plan on replicating the results of some of the papers of Brigo&Mercurio, Pelsser, Hull&White, Rebonato i.e. calibrate to caps and/or swaptions, what is a good choice? Mathematica/Matlab/or even C++? Just a neat, fast implementation, no software development.ThanksD.
 
User avatar
duj
Posts: 6
Joined: July 14th, 2002, 3:00 am

Implementation of BGM/Libor market model

March 5th, 2003, 2:19 pm

It depends on what you really want to do.A good compromise could be C++ (what we have done with my team) and a linking to NAG library since you will be able to reuse everything everywhere after implementation.Besides the particular implementation in Brigo is well adapted to some object-oriented languages.As for the implementation, if you want to run it fast, first consider the implementation of a piecewise constant volatility function through the caption prices. And, as a second step, the implementation of the correlation matrix through the swaptions. The third step could be the reduction of the rank of your matrix to the required number of factors (there is a good example of rank reduction done by Zhou).
 
User avatar
Darrell1977
Topic Author
Posts: 114
Joined: August 21st, 2002, 4:03 pm

Implementation of BGM/Libor market model

March 5th, 2003, 5:19 pm

Thanks for the advice. I should maybe mention that my C++ skills are quite limited, that's why I tend more to Mathematica (easier to use). I do not need the actual program to run fast, I'd rather be fast at writing the program :-) That's why I just wanted to hear some opinions and maybe experiences with different programming languages.
 
User avatar
trc
Posts: 95
Joined: April 4th, 2002, 2:28 pm

Implementation of BGM/Libor market model

May 12th, 2003, 7:25 pm

Libor modellers,As we all know the drift term in the dynamics of forward Libors is the bane of our happiness for a variety of reasons:1. It is state dependent leading to a process with unknown distribution even if Libor volatilities are deterministic.2. It necessitates approximation in the simulation of paths (predictor-corrector algorithm for example).3. It consumes the majority of computational resources and is impervious to all attempts to obtain increased speed(such as factor reduction).I believe that 2. is a problem even with the predictor-corrector algorithm.When we model Libor in the forward martingale measure at the horizon cashflows have to be compounded forward to the horizonand aggregated there for Monte Carlo valuation. The compounding factorsf=(1+X_j(t))(1+X_{j+1}(t))....(1+X_{n-1}(t)), where X_j(t)=\delta_jL_j(t),seem to compound inaccuracies also. To check this I compute prices of caplets 1/3 of the way out to the horizon and compareMonte Carlo prices to the analytic caplet price. The payoff of such a caplet has to be compounded forward over a large number of accrual periods and this involves a significant number of Libors.This is what I am finding in my own implementation of the predictor-corrector scheme(n is the number of accrual periods in the model):The model works perfectly for n<=50.For n=60 it deteriorates a little (3-5%) pricing error.For n=80 it blows up: 30% pricing error.It could be a program bug but I don't believe it. The caplets which are close to the horizon are still priced perfectly. I wonder if you have the same experience. What happens in your model when you price such a caplet?mj, pj are you out there?Note: it is obviously inefficient to price the caplet on the interval [T_j,T_{j+1}] for j=n/3 with the forward martingale measureP_n at time t=T_n. However this inefficiency is now desired since we want to stress the model.Now the good news:I found a way to eliminate the Libor drift completely.The model is fully accurate, no approximation involved.The state variables follow a Gaussian process with known distribution.The forward Libors have stochastic volatility but this volatility is dominated by a determinisitic term.The model is very efficient in the computation of Libors, accrual factors, annuity numeraires and swap rates(more so than the usual Libor market model). Libors are of course nonnegative and the Libors themselves do follow the arbitrage free dynamics of theLibor process.The model is blissfully fast and factor reduction leads to a proportional speedup.There is a price to pay however: the caplet price is no longer given by the Black caplet formula because of thestochastic volatility of the Libors. Instead we have a highly accurate analytic approximation to the caplet price(similar to the approximate swaption price formula in the usual LMM). Likewise there still is an accurate approximate swaption price formula so fast model calibration is still possible. With n=80 Monte Carlo and approximate analytic caplet prices are still very close.Paul, are you interested in a paper on this for your magazine?It would have to be somewhat technical (stochastic integration and Ito formula).
Last edited by trc on May 11th, 2003, 10:00 pm, edited 1 time in total.
 
User avatar
trc
Posts: 95
Joined: April 4th, 2002, 2:28 pm

Implementation of BGM/Libor market model

May 29th, 2003, 10:32 pm

Folks,I am the only one left on the continent who works tirelessly for the continued happiness of the Anglosphere.Please obtain the file FastLibors.pdf from the download link on my website http://martingale.berlios.de/Martingale.html.It describes a Libor model without drift term.I also have some new material on Bermudan option pricing (Overview->Finance) to be viewed online.There are now two mailing lists for the project. Please subscribe. I am very close to uploading a new version of the projectwhich is significantly expanded and I am working on C++ code now.
Last edited by trc on May 29th, 2003, 10:00 pm, edited 1 time in total.
 
User avatar
mj
Posts: 3449
Joined: December 20th, 2001, 12:32 pm

Implementation of BGM/Libor market model

May 30th, 2003, 7:20 am

just got back from vacation.re problems with predictor corrector -- these tend to occur only if you have positive drift, in my experience. Try using the final bond as numeraire so that all drifts are negative. I would also advise against doing too long time steps. re point 3 -- see my article in this months wilmott magazineI'll try and have a look at your paper. MJ
 
User avatar
Val
Posts: 414
Joined: June 5th, 2002, 12:51 pm

Implementation of BGM/Libor market model

May 30th, 2003, 7:46 am

QuoteOriginally posted by: trcFolks,I am the only one left on the continent who works tirelessly for the continued happiness of the Anglosphere.Please obtain the file FastLibors.pdf from the download link on my website http://martingale.berlios.de/Martingale.html.It describes a Libor model without drift term.I also have some new material on Bermudan option pricing (Overview->Finance) to be viewed online.There are now two mailing lists for the project. Please subscribe. I am very close to uploading a new version of the projectwhich is significantly expanded and I am working on C++ code now. Hi trc,Do you have a pdf version of your paper?It's much easier to read than html format.Regards,
 
User avatar
trc
Posts: 95
Joined: April 4th, 2002, 2:28 pm

Implementation of BGM/Libor market model

May 30th, 2003, 7:52 am

Yes, there is a pdf version in the download section.The link to downloading is to the left of the big Mozilla icon.
 
User avatar
Val
Posts: 414
Joined: June 5th, 2002, 12:51 pm

Implementation of BGM/Libor market model

May 30th, 2003, 7:56 am

QuoteOriginally posted by: trcYes, there is a pdf version in the download section.The link to downloading is to the left of the big Mozilla icon.I tried few times and it doesn't work.
 
User avatar
Val
Posts: 414
Joined: June 5th, 2002, 12:51 pm

Implementation of BGM/Libor market model

May 30th, 2003, 8:03 am

Trc,Could you attach your papers to this thread? Regards,
 
User avatar
trc
Posts: 95
Joined: April 4th, 2002, 2:28 pm

Implementation of BGM/Libor market model

May 30th, 2003, 8:15 am

MJ,I am simulating in the terminal martingale measure.There is always the possibility that my implementation is not correct.I am coding all this now in C++ and will make the code freely availableas soon as it is in a nice form.Regarding your paper: how do I get the Wilmott magazine?Do I have to buy a subscription?I have become really cheap of late relying on free stuff all the time.I have two implementations of the LMM with a predictor corrector algorithm.I found out that one can economize a little as follows:Set X_j=delta_jL_j (Libor times accrual period).In the Libor drift you have quotients X_j(s)/(1+X_j(s)).The predictor corrector algorithm for a time step t -> T will approximate thiswith X_j(t)/(1+X_j(t)) on the interval [t,T] to compute the predicted values X_j(T).The values X_j(t) are available at the beginning of the time step but are state dependent.If you instead use the approximation X_j(0)/(1+X_j(0)) you get the state independenttrivial drift approximation. The resulting drift increments can be cached in advance of any simulation.Use this drift to compute the predicted values X_j(T) for the predictor corrector time step.Now you have the values X_j(t), X_j(T) and you can compute the drift which is actually used in the time stepby using the approximation 0.5*[ X_j(t)/(1+X_j(t))+X_j(T)/(1+X_j(T) ]It's slightly sloppier but more economical than computing the drift step twice.I saw about a 20% speedup versus true predictor-corrector simulation.In all my experiments I never saw a significant difference in prices computed this way rather than true predictor corrector.
Last edited by trc on May 29th, 2003, 10:00 pm, edited 1 time in total.
 
User avatar
mj
Posts: 3449
Joined: December 20th, 2001, 12:32 pm

Implementation of BGM/Libor market model

May 30th, 2003, 9:10 am

the best way to resolve the issue is to see if i can reproduce the problems. So i suggest give us the simplest specs under which the drift approximation fails. e.g. all the rate times, the precise vols, the precise curve.MJ
 
User avatar
trc
Posts: 95
Joined: April 4th, 2002, 2:28 pm

Implementation of BGM/Libor market model

May 30th, 2003, 9:38 am

If you have some time please compute a caplet price by Monte Carloin the terminal martingale measure and compare this with the analytic price.Use n=80 periods (Libors) and with n=80 time steps of size dt=0.25.Choose the caplet on the interval [T_i,T_{i+1}] with i=n/3 and caplet vols of about 33%.I had all initial Libors at 4% and the caplets were at the money.Obviously it does depend on the correlations also. I suspect there should be problemsstemming from compounding the caplet payoff forward over many accrual periods to the time horizon.This procedure compounds systematic errors also.I am really interested to see what you get.I'll distribute my C++ code hopefully within the month.Maybe there is an implementation error.I don't have any problems in the driftless model.
Last edited by trc on May 29th, 2003, 10:00 pm, edited 1 time in total.
 
User avatar
mj
Posts: 3449
Joined: December 20th, 2001, 12:32 pm

Implementation of BGM/Libor market model

May 30th, 2003, 9:41 am

what correlation did you use?MJ
 
User avatar
trc
Posts: 95
Joined: April 4th, 2002, 2:28 pm

Implementation of BGM/Libor market model

May 30th, 2003, 9:45 am

I used a correlation similar to what a paper by Shoenmakers and Coffee suggested.I also have an implementation of the correlation structure from PJ's book.I'll try it with that one and see what happens. It'll take a couple of minutes.I suspect that there should nearly always be problems but I will make the experiment now. I am having some problems with the C++ code. The correlation structure crashes from non positive definitecovariance matrix. I haven't tested this factor loading since I always use the Coffee-Shoenmakersfactor loading. It'll take more than a couple of minutes to get this resolved. RESULT: YES, there is a problem. I increased the Libor volatility to 43% and with this the model blows up.I am using the volatility and correlation structure from PJ's book as follows:volatility: a=-0.05, b=0.5, c=1.5, d=0.15, k_i=2.6 (p164, 12.11)correlation beta=0.1 (page 173, 12.37: rho_{ij}=exp(-beta*|T_i-T_j|) )number n of accrual periods (Libors) n=80.caplet: on [T_i,T_{i+1}], i=n/3=26, strike rate 0.05all initial Libors at 0.04all accrual periods: delta=0.25time steps dt=0.25Monte Carlo misprices the caplet by 35%Monte Carlo with control variate (correlation 95%) misprices the caplet by -52%Please let me know if you can reproduce these results.This was run on my Java code.
Last edited by trc on May 29th, 2003, 10:00 pm, edited 1 time in total.
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On