Simulating multiple correlated stochastic processes

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

Simulating multiple correlated stochastic processes

Max-118
Hi,

I am trying to simulate the price dynamics of 4 different assets given the correlation among them (assuming all asset returns follow geometric Brownian motion).

I have implemented the monte-carlo simulation using Quantlib classes, such as StochasticProcessArray, MultiPathGenerator, etc.

However, I am not so sure how the StochasticProcessArray implementation ensures the correlation among the 4 assets is guaranteed, given the input 4x4 correlation matrix is positive defintie. Could someone help explain this from a theoretical perspective? or point me to the related reference?

Thanks!

Best regards,
Max


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Simulating multiple correlated stochastic processes

Max-118
Hi,

I studied the code further. And I realized that in StochasticProcessArray class, the correlation matrix L is decomposed into a lower triangular using SalvagingAlgorithm::Spectral. Then the new triangular matrix is applied to the array of independent normal random variables.

I am not familiar with the "Spectral" analysis. However, I want to ask:
Given correlation matrix is symmetric and positive semidefinite, can I use SalvagingAlgorithm::none method (which is essentially a Cholesky decomposition) instead? And in this case, would the final results be equivelant for SalvagingAlgorithm::Spectral and SalvagingAlgorithm::none methods?


On Thu, Jun 26, 2008 at 12:08 AM, Max <[hidden email]> wrote:
Hi,

I am trying to simulate the price dynamics of 4 different assets given the correlation among them (assuming all asset returns follow geometric Brownian motion).

I have implemented the monte-carlo simulation using Quantlib classes, such as StochasticProcessArray, MultiPathGenerator, etc.

However, I am not so sure how the StochasticProcessArray implementation ensures the correlation among the 4 assets is guaranteed, given the input 4x4 correlation matrix is positive defintie. Could someone help explain this from a theoretical perspective? or point me to the related reference?

Thanks!

Best regards,
Max



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Simulating multiple correlated stochastic processes

xionghan
Hi Max,
 
The Spectral method is just an eigenvalue decomposition. It is also called Principle Component Analysis.
 
Best,
Han



Date: Thu, 26 Jun 2008 01:28:30 +0800
From: [hidden email]
To: [hidden email]; [hidden email]
Subject: Re: [Quantlib-users] Simulating multiple correlated stochastic processes

Hi,

I studied the code further. And I realized that in StochasticProcessArray class, the correlation matrix L is decomposed into a lower triangular using SalvagingAlgorithm::Spectral. Then the new triangular matrix is applied to the array of independent normal random variables.

I am not familiar with the "Spectral" analysis. However, I want to ask:
Given correlation matrix is symmetric and positive semidefinite, can I use SalvagingAlgorithm::none method (which is essentially a Cholesky decomposition) instead? And in this case, would the final results be equivelant for SalvagingAlgorithm::Spectral and SalvagingAlgorithm::none methods?


On Thu, Jun 26, 2008 at 12:08 AM, Max <max.zou@...> wrote:
Hi,

I am trying to simulate the price dynamics of 4 different assets given the correlation among them (assuming all asset returns follow geometric Brownian motion).

I have implemented the monte-carlo simulation using Quantlib classes, such as StochasticProcessArray, MultiPathGenerator, etc.

However, I am not so sure how the StochasticProcessArray implementation ensures the correlation among the 4 assets is guaranteed, given the input 4x4 correlation matrix is positive defintie. Could someone help explain this from a theoretical perspective? or point me to the related reference?

Thanks!

Best regards,
Max




轻松把Hotmail下载到本地,试试 Windows Live Mail。 立即尝试!
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Simulating multiple correlated stochastic processes

Luigi Ballabio
In reply to this post by Max-118
On Thu, 2008-06-26 at 01:28 +0800, Max wrote:
> Given correlation matrix is symmetric and positive semidefinite, can I
> use SalvagingAlgorithm::none method (which is essentially a Cholesky
> decomposition) instead?

Yes, you can.

> And in this case, would the final results be equivelant for
> SalvagingAlgorithm::Spectral and SalvagingAlgorithm::none methods?

It should be. It would be nice if you made the experiment and reported
back here...

Luigi


--

Ninety percent of everything is crap.
--- Theodore Sturgeon



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Simulating multiple correlated stochastic processes

yong cai-2
In reply to this post by Max-118

 

 Great to learn the Quantlib. I would like to start with building a USD term structure with Euro Dollar Futures and Swap contracts as most IB shops do:

 

 Short end:  ED upto 4 years

 Rest:         Swap contract upto 40 years

 

 I saw examples using fixed-rate-bond and flat TS, but not sure how to build with the mix.

 

 Thanks for the help.

 

 Yong



--- On Tue, 7/1/08, Luigi Ballabio <[hidden email]> wrote:

From: Luigi Ballabio <[hidden email]>
Subject: Re: [Quantlib-users] Simulating multiple correlated stochastic processes
To: [hidden email]
Date: Tuesday, July 1, 2008, 9:05 AM

Yong,
	please post the question to the mailing list. It is useful for
everybody.

Luigi


-- 

Do the right thing. It will gratify some people and astonish the rest. 
-- Mark Twain


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Simulating multiple correlated stochastic processes

Max-118
In reply to this post by Luigi Ballabio
Hi Luigi,

I have just done some basic test on a basket call option on the average return of 4 assets (using Sobol Quasi-random number generator). And the correlation matrix given is positive semi-definite. The following compares the fair values produced by Cholesky and Spectral decompositions for different number of iterations. (see attached chart).

no. of trails    Cholesky       Spectral         relative difference
500               0.14439479    0.14822383    2.6518%
1000             0.14844382    0.15099720    1.7201%
3000             0.15228533    0.15291014    0.4103%
5000             0.15295908    0.15328304    0.2118%
7000             0.15288972    0.15356331    0.4406%
10000           0.15333001    0.15370840    0.2468%
15000           0.15339209    0.15373016    0.2204%
30000           0.15374863    0.15387913    0.0849%
60000           0.15390326    0.15396157    0.0379%
90000           0.15393888    0.15402227    0.0542%
120000         0.15395743    0.15402453    0.0436%
150000         0.15396883    0.15405399    0.0553%
200000         0.15399083    0.15405433    0.0412%
300000         0.15400569    0.15404896    0.0281%
600000         0.15403359    0.15405266    0.0124%


As you can see, the two methods converge at higher number iterations; and Spectral decomposition seems to have higher rate of convergence rate. Is this behavior expected? and any existing literature explains the difference between them?

Best regards,
Max

On Tue, Jul 1, 2008 at 6:46 PM, Luigi Ballabio <[hidden email]> wrote:
On Thu, 2008-06-26 at 01:28 +0800, Max wrote:
> Given correlation matrix is symmetric and positive semidefinite, can I
> use SalvagingAlgorithm::none method (which is essentially a Cholesky
> decomposition) instead?

Yes, you can.

> And in this case, would the final results be equivelant for
> SalvagingAlgorithm::Spectral and SalvagingAlgorithm::none methods?

It should be. It would be nice if you made the experiment and reported
back here...

Luigi


--

Ninety percent of everything is crap.
--- Theodore Sturgeon




-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

cholesky_vs_spectral.pdf (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Simulating multiple correlated stochastic processes

Luigi Ballabio
In reply to this post by yong cai-2
Yong,
        apologies for the delay. I have been on vacation and I have lost track
of old posts.

On Tue, 2008-07-01 at 06:30 -0700, yong cai wrote:
>  Great to learn the Quantlib. I would like to start with building a
> USD term structure with Euro Dollar Futures and Swap contracts as most
> IB shops do:
>
>  I saw examples using fixed-rate-bond and flat TS, but not sure how to
> build with the mix.


You can have a look at the Swap example--it builds a term structure
based on deposits, futures, and swaps.

Luigi


--

If you can't convince them, confuse them.
-- Harry S. Truman



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users