Path generation

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

Path generation

Gísli Sigurbjörn Óttarsson KB banki
I have been trying to understand path generation for Monte Carlo
simulation.  Specifically, I´ve been wondering about the purpose
of weights.  As far as I can tell, the random sequences that are
used to construct the paths have weights, both on individual points
and on the sequence as a whole.  
 
Mostly these weights seem to be set to 1.0, e.g.:
 
sample_type MersenneTwisterUniformRng::next() const {
    // divide by 2^32
    Real result = (Real(nextInt32()) + 0.5)/4294967296.0;
    return sample_type(result,1.0);
}

Where are these weights used and when are they != 1.0?

Can anyone explain this and perhaps site a motivating reference?

Best regards

  Gísli




Reply | Threaded
Open this post in threaded view
|

Re: Path generation

Luigi Ballabio
On 05/30/2006 12:29:23 PM, Gísli Sigurbjörn Óttarsson KB banki wrote:
> I have been trying to understand path generation for Monte Carlo
> simulation.  Specifically, I´ve been wondering about the purpose
> of weights.  As far as I can tell, the random sequences that are
> used to construct the paths have weights, both on individual points
> and on the sequence as a whole.
>
> Where are these weights used and when are they != 1.0?

Gisli,
        they are used when collecting statistics during the Monte Carlo  
run (if you look at the MonteCarloModel::addSamples method, you'll find

     sampleAccumulator_.add(price, path.weight);

somewhere in there.)

As to when they are not 1.0, well, nowhere in the current code. The  
weight parameter is there in case someone wants to use tricks such as  
Russian Roulette (not putting the weight would have forbidden to use  
such techniques.) But no such method is implemented at this time.

Later,
        Luigi


----------------------------------------

I hate quotations.
-- Ralph Waldo Emerson


Reply | Threaded
Open this post in threaded view
|

RE: Path generation

Gísli Sigurbjörn Óttarsson KB banki
In reply to this post by Gísli Sigurbjörn Óttarsson KB banki

Thanks Luigi.  I had missed this line in the MonteCarlo class.

The Russian Roulette feature may come in handy, but have your considered whether the incessant multiplication by 1.0 may carry with it a performance overhead?

Best regards

  Gisli



 

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: 31. maí 2006 12:40
To: Gísli Sigurbjörn Óttarsson KB banki
Cc: quantlib-users
Subject: Re: [Quantlib-users] Path generation


On 05/30/2006 12:29:23 PM, Gísli Sigurbjörn Óttarsson KB banki wrote:
> I have been trying to understand path generation for Monte Carlo
> simulation.  Specifically, I´ve been wondering about the purpose of
> weights.  As far as I can tell, the random sequences that are used to
> construct the paths have weights, both on individual points and on the
> sequence as a whole.
>
> Where are these weights used and when are they != 1.0?

Gisli,
        they are used when collecting statistics during the Monte Carlo run (if you look at the MonteCarloModel::addSamples method, you'll find

     sampleAccumulator_.add(price, path.weight);

somewhere in there.)

As to when they are not 1.0, well, nowhere in the current code. The weight parameter is there in case someone wants to use tricks such as Russian Roulette (not putting the weight would have forbidden to use such techniques.) But no such method is implemented at this time.

Later,
        Luigi


----------------------------------------

I hate quotations.
-- Ralph Waldo Emerson


Reply | Threaded
Open this post in threaded view
|

Re: Path generation

Luigi Ballabio
On 05/31/2006 02:46:29 PM, Gísli Sigurbjörn Óttarsson KB banki wrote:
>
> The Russian Roulette feature may come in handy, but have your
> considered whether the incessant multiplication by 1.0 may carry with
> it a performance overhead?

I haven't given it much thought, but I'd be very interested in the  
timing results if you decided to measure the overhead.

Later,
        Luigi


----------------------------------------

All generalizations are dangerous, even this one.
-- Alexandre Dumas


Reply | Threaded
Open this post in threaded view
|

RE: Path generation

Gísli Sigurbjörn Óttarsson KB banki
In reply to this post by Gísli Sigurbjörn Óttarsson KB banki
Fair enough.  This will be on my list of things to examine if/when I hit the performance wall.

  Gisli

 

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: 31. maí 2006 12:52
To: Gísli Sigurbjörn Óttarsson KB banki
Cc: quantlib-users
Subject: Re: [Quantlib-users] Path generation


On 05/31/2006 02:46:29 PM, Gísli Sigurbjörn Óttarsson KB banki wrote:
>
> The Russian Roulette feature may come in handy, but have your
> considered whether the incessant multiplication by 1.0 may carry with
> it a performance overhead?

I haven't given it much thought, but I'd be very interested in the timing results if you decided to measure the overhead.

Later,
        Luigi


----------------------------------------

All generalizations are dangerous, even this one.
-- Alexandre Dumas