Brownian bridge newbie question

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Brownian bridge newbie question

camillo-2
Hi all,
i'm quite a newbie to QuantLib, however started writing a set of managed c++ wrapper classes to make selected modules from QuantLib available to C#. So maybe i misunderstood the usage a bit but when working with the brownian bridge class i would have expected the endpoint to coincide with the starting point of the output path, but this neither happens in my wrapper code (there i would have assumed that i had a bug in it) but also in the examples coming with the QuantLib testsuite the outcoming samples do not enjoy this property.
Can anyone point me to whats going wrong here (possibly in what i expect to get or what i missed) and how i could construct a brownian bridge ?

thx
camillo
Reply | Threaded
Open this post in threaded view
|

Re: Brownian bridge newbie question

Bojan Nikolic

Hi Camillo,

Looking through the code (ql/methods/montecarlo/brownianbridge.cpp) I
can see that the meaning of the input sequence to the transform
function is quite tricky and probably you went wrong there. The
*first* element of this sequence controls the global slope over the
bridge process. Therefore the first element needs to be zero if you
want a classical Brownian bridge. The rest of the elements should be
normally distributed random numbers as usual.

Probably the documentation in the header files ought to be updated a
bit to reflect this.

I've posted some code and a plot @

http://www.bnikolic.co.uk/blog/ql-brownian-bridge.html

Best,
Bojan

--
Bojan Nikolic          ||          http://www.bnikolic.co.uk

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Brownian bridge newbie question

camillo-2
Hi Bojan

thx for your quick response, now my brownian bridges behave like i expected them to do. Once catching the idea it appears quite natural to use the first entry as a slope for the bridge, however this was not obvious to me prior to your hint; especially this also answers the follow-up question how to create a BB with given start and end-point, not necessarily having same y-value.
imho it would be a good idea to include your code with the docs / samples shipped with quantlib

best wishes
camillo
Reply | Threaded
Open this post in threaded view
|

Re: Brownian bridge newbie question

Bojan Nikolic

If you are creating bridges with a non-zero slope, note that the last
y-value is going the be input_variate[0]*sqrt(last_time).  If you
didn't supply the time parameter when creating the bridge class it
will be equal to the number of points in the bridge.

I.e., if you have a 100 point bridge and input_variate[0]=0.5 then the
last y-value is going to be 5.

If somebody wants to commit the code from the web-page to the
repository, they are welcome to do so under the usual QuantLib
license.

Best,
Bojan

--
Bojan Nikolic          ||          http://www.bnikolic.co.uk

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users