Serving the Quantitative Finance Community

  • 1
  • 2
  • 3
  • 4
  • 5
  • 7
 
User avatar
Dimathematician
Topic Author
Posts: 0
Joined: January 13th, 2007, 9:28 am

Seeds and Random Numbers

May 19th, 2007, 4:53 pm

Hi,I have a question ragarding the usage of seeds. I'm confused with some stuff.Case 1:Say I'm simulating 10 times a stock price, each simulation has 100 time steps and standard-normally distributed random numbers.So I need 1000 standard-normally distributed random numbers.Question 1: Is it enough, to use one seed and than produce 1000 numbers with that seed, or would I need to set a different seedfor each of the 10 simulations? I think one seed is enough, because they are i.i.d., but would it be better to use 10 seeds?Case 2:Say I'm simulating 1 stock price, the simulation has 100 time steps. I'm using a Jump Diffusion modell, with normally distributedjumps. So I need to have 100 normally distributed random variables for the continuous part, than a series of poisson rv's for thejump times and a series for the jumps. All random variables need to be independent.Question 2:Do I need three seeds? One for the continuous path, one for the jumptimes and one for the jumps? If not, than every randomvariable would be created with the same series of uniformly distributed random variables, which would make the variables dependent.Thats what I think.Any help appreciated.
 
User avatar
Dimathematician
Topic Author
Posts: 0
Joined: January 13th, 2007, 9:28 am

Seeds and Random Numbers

May 19th, 2007, 7:19 pm

Outrun, thanks for your answer. Your answer seems to describe the general question of why using a seed. I maybe should have been more precise in my question. I'm using a class, which generates uniformly distributed numbers with mersenne-twister and a seed. This numbers are then used by other classes, to generate normally distributed variables, poisson variables or others. Actually I'm using the boost random numbers library. Wouldn't I need to set one seed, generate uniformly distributed variables, set another seed, generate poisson variables.....? Otherwise both, the normal and poisson variables would use the same set of uniformly distributed random variables.
 
User avatar
Dimathematician
Topic Author
Posts: 0
Joined: January 13th, 2007, 9:28 am

Seeds and Random Numbers

May 21st, 2007, 6:39 am

thanks outrun,this is exactly, what I wanted to know.
 
User avatar
DominicConnor
Posts: 41
Joined: July 14th, 2002, 3:00 am

Seeds and Random Numbers

May 23rd, 2007, 8:38 pm

One of the things I'd forgotten until I was writing the multi threaded monte carlo lecture for the CQF C++ was that of course a standard rand() function always returns the same sequence, even if it's in two threads. Thus if you split your MC over mulitiple cores you don't actually get different results.
 
User avatar
Cuchulainn
Posts: 23029
Joined: July 16th, 2004, 7:38 am

Seeds and Random Numbers

June 1st, 2007, 7:11 pm

QuoteOriginally posted by: outrun[ Wouldn't I need to set one seed, generate uniformly distributed variables, set another seed, generate poisson variables.....? ]that depends on how you have coded it. Te safest thing to do is1 set one seed, generate uniformly distributed variables,2 *retrieve seed* from the mersenne twister after generating these numbers3 set this retrieved seed into a new generator, generate poisson distributed variables,or1 set one seed, generate uniformly distributed variables,2 generate more uniformly distributed variables and convert them to poissonthese should give the same resultsoutrun,Is this documented on your site I presume?BTW I am looking for a test suite of SDEs (1, 2, n ) factors in order to test some schemes. Is there somewhere one can find these in one stop shop. Like maybe a STANDARD set of benchmarks against which all solutions could be tested against?
Last edited by Cuchulainn on May 31st, 2007, 10:00 pm, edited 1 time in total.
 
User avatar
Dimathematician
Topic Author
Posts: 0
Joined: January 13th, 2007, 9:28 am

Seeds and Random Numbers

June 3rd, 2007, 11:42 am

Cuchulainn,may I ask, what classes of SDE's you're planning to benchmark? I've started to read some papers about numerical solutions of SDE's, and will take a closer look at numerical schemes for Jump-Diffusions or, more general, Levy processes. Have seen some papers by Platen about weak and strong methods for Jump-Diffusions, though I haven't read them yet. But I will. Are you looking at more complex SDE's or GBM only?
 
User avatar
Cuchulainn
Posts: 23029
Joined: July 16th, 2004, 7:38 am

Seeds and Random Numbers

June 4th, 2007, 11:10 am

Dimathematician,In the book with Joerg Kienitz we do discuss other processes as well: Poisson, compensated and compound Process, Heston, Bates and SVJ. Maybe Joerg could say something on this?As far as design is concerned the objective is that the reader can create his or her own classes for particular processes (using some Design Patterns) and still avail of the functionality without having to write everything from scratch. For example, we could decorate a GBM process with jump information. Clients will still use the same interface as before. QuoteHave seen some papers by Platen about weak and strong methods for Jump-DiffusionsThis?Platen;Jump Diffusions outrunQuotehow about adding performance measures of the different schemes in your framework?You mean accuracy and speed? Like in figures 5.5 and 5.6 of Platen's paper?
Last edited by Cuchulainn on June 3rd, 2007, 10:00 pm, edited 1 time in total.
 
User avatar
Dimathematician
Topic Author
Posts: 0
Joined: January 13th, 2007, 9:28 am

Seeds and Random Numbers

June 4th, 2007, 12:14 pm

I'm currently working on a XLL, which I might publish for free in 3-4 months or so. Can't promise. Will work with objects and handles, where you will be able to plug in a SDE scheme as a string, and it will solve and display the corresponding SDE in Excel. Will have a Seed object as well, whose handle you can pass to other objects, so you will have full control of all simulations anytime. It is a student project, so Cuchulainn, of course, its far away from being as generic and professional as your current work. And it will be for GBM and Jump Diffusions only. That's why I'm asking. I'd be interested in any benchmarking results as well.
 
User avatar
Cuchulainn
Posts: 23029
Joined: July 16th, 2004, 7:38 am

Seeds and Random Numbers

June 4th, 2007, 3:11 pm

QuoteOriginally posted by: DimathematicianI'm currently working on a XLL, which I might publish for free in 3-4 months or so. Can't promise. Will work with objects and handles, where you will be able to plug in a SDE scheme as a string, and it will solve and display the corresponding SDE in Excel. Will have a Seed object as well, whose handle you can pass to other objects, so you will have full control of all simulations anytime. It is a student project, so Cuchulainn, of course, its far away from being as generic and professional as your current work. And it will be for GBM and Jump Diffusions only. That's why I'm asking. I'd be interested in any benchmarking results as well.Sounds very good. It would be a good idea to be able to benchmark a number (4 or more?) of robust and accurate schemes for the processes you mention. The conclusion of Liberati on the suitability of the PC method (splitting?) agrees with our experiences with the method.An (open?) problem is to apply adaptive meshing and prove convergence as is done in ODE theory for this class of SDE. And derivative-free methods make life easier.
Last edited by Cuchulainn on June 3rd, 2007, 10:00 pm, edited 1 time in total.
 
User avatar
Dimathematician
Topic Author
Posts: 0
Joined: January 13th, 2007, 9:28 am

Seeds and Random Numbers

June 4th, 2007, 3:31 pm

QuoteSounds very good. It would be a good idea to be able to benchmark a number (4 or more?) of robust and accurate schemes for the processes you mention.Haven't done enough research yet, but from what I know now, I plan to implement Euler, Milstein, Predictor-Corrector and a Runge-Kutta scheme. QuoteThe conclusion of Liberati on the suitability of the PC method (splitting?) agrees with our experiences with the method.Will you by any chance share some of the results before the book is published (datasim, compplusplus)? Also, did you come across a lot of work on numerical schemes for SDE's driven by Levy processes like Variance Gamma? I currently can't even say if this makes sense for those processes, since they're driven by infinitely many small jumps. But maybe subordination will help.... Anyways, sorry for asking without doing enough research in advance.
 
User avatar
nicobyron
Posts: 0
Joined: February 18th, 2003, 12:50 am

Seeds and Random Numbers

June 7th, 2007, 2:18 am

QuoteYou mean accuracy and speed? Like in figures 5.5 and 5.6 of Platen's paper?In this figures we report only the accuracy and not the speed. Unfortunately, the speed is highly dependent on the particular structure of the SDE. The good thing of a predictor-corrector scheme of Euler type is that you need to generate the same random variables as in the simple Euler schemes. If you go to higher order schemes, then you generally need additional random variables.