|
From: Luigi B. <lui...@gm...> - 2007-06-02 20:51:49
|
On May 29, 2007, at 5:46 PM, Apollo Wong wrote:
> =A0In version 0.3.4 I can use the=20
> QuantLib::MonteCarlo::MultipathGenerator(&drifts, &covariance,=20
> timelength, timestep, sggenerator) to do the job
>
> =A0How do I do the same in version 0.4.0?
Hi Apollo,
apologies for the delay. In 0.4.0 and above, the covariance=20
information--or rather the correlation--must be included in the=20
StochasticProcess passed to the generator. If you have N correlated=20
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),=20
gsgenerator);
after which mpg.next() will give you a correlated multipath for the=20
underlyings. Note that unlike in previous versions (in which the=20
multipath contained the variations between nodes) the multipath will=20
contain the actual values of the underlying at the different nodes.
Hope this helps,
Luigi
|