R: Doubt in Montecarlo generation of paths

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

R: Doubt in Montecarlo generation of paths

Berardi Luca
Doubt in Montecarlo generation of paths
Sorry if I was not very clear in my previous message.
 
I do agree with the way the QuantLib code updates the drift and diffusion parts while building the path.
What I do not understand is only the way QuantLib updates the local value of the process state (in the code is the variable asset_). Indeed, stepping through timesteps the new value of the state should be set equal to the old value plus the sum of the drift and diffusion components. Is this correct? If so, this is not what happens in the mentioned QuantLib section of code.
 
-----Messaggio originale-----
Da:  ......................................................................... 
Inviato: mercoledì 7 aprile 2004 12:01
A: Berardi Luca
Oggetto: RE: [Quantlib-users] Doubt in Montecarlo generation of paths

Hi there,

 

In fact you simulate your asset S(1) from S(0), S(2) from S(1), and so on, using forward rates and local volatilies (so for calculating S(i) you need S(i-1))

I use this pathGenerator and it gives good prices.

 

next_.value.drift()[i] = dt *
                    diffProcess_->drift(t, asset_);

next_.value.diffusion()[i] = sequence_.value[i] *
                    QL_SQRT(diffProcess_->variance(t, asset_, dt));

 

I hope I have a good understand of your question

 

Regards

 

................

  

-----Original Message-----
From: Berardi Luca [mailto:[hidden email]]
Sent: 07 April 2004 11:38
To: [hidden email]
Cc: Quantlib-Users (E-mail)
Subject: [Quantlib-users] Doubt in Montecarlo generation of paths

 

 

   Hi all

I was looking at the code for setting up a generic Montecarlo simulation, in particular the PathGenerator class.
There is something I could not really understand in the method next( ) [i.e. const typename PathGenerator<GSG>::sample_type& PathGenerator<GSG>::next( ) ].

Looking at the section of code (where the brownian bridge is not used):

            typedef typename GSG::sample_type sequence_type;
            const sequence_type& sequence_ = generator_.nextSequence();

            next_.weight = sequence_.weight;

            // starting point for asset value
            asset_ = diffProcess_->x0();
            double dt;
            Time t;
            for (Size i=0; i<next_.value.size(); i++) {
                t = timeGrid_[i+1];
                dt = timeGrid_.dt(i);
                next_.value.drift()[i] = dt *
                    diffProcess_->drift(t, asset_);
                next_.value.diffusion()[i] = sequence_.value[i] *
                    QL_SQRT(diffProcess_->variance(t, asset_, dt));
                asset_ *= QL_EXP(next_.value.drift()[i] +
                                 next_.value.diffusion()[i]);
            }

            return next_;
        }

 

It not clear to me why asset_ is re-assigned as: asset_ *= QL_EXP(...).
We are numerically integrating a diffusion process given by:

d asset_ = drift(t, asset_)*dt + diffusion(t,asset_)*dW

so shouldn't  asset_ be re-assigned as:

asset_ += next_.value.drift()[i] + next_.value.diffusion()[i];

???






DISCLAIMER: Privileged/Confidential Information may be contained in this message and in any of its attachments (the "message"). If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply e-mail. The contents of this message shall be understood as neither given nor endorsed by Banca Profilo S.p.A., nor Profilo SGR S.p.A., nor Profilo Asset Management SGR S.p.A., nor Profilo Academy S.p.A.. Banca Profilo S.p.A., Profilo SGR S.p.A., Profilo Asset Management SGR S.p.A., Profilo Academy S.p.A. do not accept liability for corruption, interception or amendment, if any, or the consequences thereof.

Il presente messaggio e/o i suoi allegati (di seguito il "messaggio") possono contenere informazioni privilegiate e/o confidenziali. Se non siete i destinatari indicati nel messaggio (o persona incaricata di inoltrare il messaggio al/i destinatario/i), non potete copiare o inoltrare il messaggio ad altri e siete invitati a distruggerlo dandone informazione al mittente a mezzo e-mail. Il contenuto del presente messaggio non deve essere considerato come trasmesso o autorizzato nè da Banca Profilo S.p.A., nè da Profilo SGR S.p.A., nè da Profilo Asset Management SGR S.p.A., nè da Profilo Academy S.p.A.. Nè Banca Profilo S.p.A., nè Profilo SGR S.p.A., nè Profilo Asset Management SGR S.p.A., nè Profilo Academy S.p.A. si assumono alcuna responsabilità per eventuali intercettazioni, modifiche o danneggiamenti del presente messaggio e-mail e per le eventuali conseguenze.

 



DISCLAIMER: Privileged/Confidential Information may be contained in this message and in any of its attachments (the "message"). If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply e-mail. The contents of this message shall be understood as neither given nor endorsed by Banca Profilo S.p.A., nor Profilo SGR S.p.A., nor Profilo Asset Management SGR S.p.A., nor Profilo Academy S.p.A.. Banca Profilo S.p.A., Profilo SGR S.p.A., Profilo Asset Management SGR S.p.A., Profilo Academy S.p.A. do not accept liability for corruption, interception or amendment, if any, or the consequences thereof.

Il presente messaggio e/o i suoi allegati (di seguito il "messaggio") possono contenere informazioni privilegiate e/o confidenziali. Se non siete i destinatari indicati nel messaggio (o persona incaricata di inoltrare il messaggio al/i destinatario/i), non potete copiare o inoltrare il messaggio ad altri e siete invitati a distruggerlo dandone informazione al mittente a mezzo e-mail. Il contenuto del presente messaggio non deve essere considerato come trasmesso o autorizzato nè da Banca Profilo S.p.A., nè da Profilo SGR S.p.A., nè da Profilo Asset Management SGR S.p.A., nè da Profilo Academy S.p.A.. Nè Banca Profilo S.p.A., nè Profilo SGR S.p.A., nè Profilo Asset Management SGR S.p.A., nè Profilo Academy S.p.A. si assumono alcuna responsabilità per eventuali intercettazioni, modifiche o danneggiamenti del presente messaggio e-mail e per le eventuali conseguenze.