Help with generating correlated multipath

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

Help with generating correlated multipath

Apollo Wong
Help with generating correlated multipath

_____________________________________________
From: Apollo Wong
Sent: Friday, May 18, 2007 11:12 AM
To: '[hidden email]'
Subject: How to generate correlation multipath

Hi all,

 In version 0.3.4 I can use the QuantLib::MonteCarlo::MultipathGenerator(&drifts, &covariance, timelength, timestep, sggenerator) to do the job

 How do I do the same in version 0.4.0?  The interface seems to be changed significantly.  The onlything I can find about covariance in the documentation is for covariance(Time t0, const Array &x0, Time dt) which only give V(xto+dt|xto)  for StochasticProcessArray, which is not what I was looking for.

 Thanks.

 Sample code would be appricated.

Apollo


This email is being sent to you for your information pursuant to your request. This information is not warranted as to completeness or accuracy. The views expressed in the message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of George Weiss Associates, Inc. or any of its affiliated entities. This message is for the named person's use only. It may contain sensitive and private proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient.
*** eSafe scanned this email for viruses, vandals, and malicious content. ***


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with generating correlated multipath

Luigi Ballabio

On May 29, 2007, at 5:46 PM, Apollo Wong wrote:
>  In version 0.3.4 I can use the
> QuantLib::MonteCarlo::MultipathGenerator(&drifts, &covariance,
> timelength, timestep, sggenerator) to do the job
>
>  How do I do the same in version 0.4.0?

Hi Apollo,
        apologies for the delay.  In 0.4.0 and above, the covariance
information--or rather the correlation--must be included in the
StochasticProcess passed to the generator.  If you have N correlated
processes, you can create a StochasticProcessArray as

boost::shared_ptr<StochasticProcess> processArray(
     new StochasticProcessArray(processes, correlation));

and the multi-path generator as

MultiPathGenerator mpg(processArray, TimeGrid(timelength, timesteps),
gsgenerator);

after which mpg.next() will give you a correlated multipath for the
underlyings. Note that unlike in previous versions (in which the
multipath contained the variations between nodes) the multipath will
contain the actual values of the underlying at the different nodes.

Hope this helps,
        Luigi


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev