Login  Register

Re: Help with generating correlated multipath

Posted by Luigi Ballabio on Jun 02, 2007; 9:51pm
URL: http://quantlib.414.s1.nabble.com/Help-with-generating-correlated-multipath-tp9533p9534.html


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