SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
Paul
Topic Author
Posts: 10789
Joined: July 20th, 2001, 3:28 pm

How can I simulate correlated random numbers?

January 12th, 2003, 6:30 pm

 
User avatar
Alan
Posts: 10215
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

How can I simulate correlated random numbers?

January 13th, 2003, 2:25 am

For standard normals, make two draws Z1 and Z2 from your favorite (random normal) generator.Then, use Z1 and Z3 = rho Z1 + Sqrt ( 1 - rho^2 ) Z2,where rho is the desired correlation.
 
User avatar
mj
Posts: 3449
Joined: December 20th, 2001, 12:32 pm

How can I simulate correlated random numbers?

January 13th, 2003, 6:53 am

If you want n random normals with correlation matrix C then find a matrix A such that C = AA^{t}.Now draw n independent normals W= (W_1,... W_n) and then putZ = AW.NB there lots of such A s. MJ
 
User avatar
danchikas
Posts: 22
Joined: January 9th, 2002, 12:33 pm

How can I simulate correlated random numbers?

February 4th, 2003, 9:36 am

most widely used being the cholesky decomposition where A is a lower triangular matrix with positive diagonal elements.someone on the forum mentioned a link which explicitly shows how to perform cholesky decomposition: http://ikpe1101.ikp.kfa-juelich.de/brie ... de33.htmld.
 
User avatar
reza
Posts: 3013
Joined: August 30th, 2001, 3:40 pm

How can I simulate correlated random numbers?

February 4th, 2003, 11:05 am

Cholesky is indeed one popular method using triangular decompositionhowever many use a spectral method using matrix Diagonalization and argue the results are betterPJ is the expert ...
 
User avatar
James
Posts: 1557
Joined: January 23rd, 2002, 2:24 pm

How can I simulate correlated random numbers?

February 4th, 2003, 2:19 pm

I was taught Cholesky in grad school, but Reza wrote "spectral method using matrix Diagonalization and argue the results are better"I have no idea what this is, PJ or Reza, please explain....please?
 
User avatar
reza
Posts: 3013
Joined: August 30th, 2001, 3:40 pm

How can I simulate correlated random numbers?

February 4th, 2003, 2:30 pm

again the expert id PJbut if you just replace the decmposition of the covariance matrix into triangular matrices withdiagonalization you could do the same thing, no?instead ofx = Xy= rX + sqrt(1-r^2) Yyou would have something likex= aX+bYy= cX+dY
 
User avatar
kr
Posts: 1885
Joined: September 27th, 2002, 1:19 pm

How can I simulate correlated random numbers?

February 4th, 2003, 7:33 pm

James -I'm guessing the spectral approach is as follows: Write M = ADA^-1. Take sqrts of the diagonal elements and call that S i.e. D = SS. Then M = ASA^-1 . ASA^-1. If A is orthonormal by construction (i.e. it is orthogonal by construction and we took the 'ovals' out by using D), then A^-1 = A^T. S=S^T also, so if C = ASA^-1 then M=CC^T as well.
 
User avatar
kr
Posts: 1885
Joined: September 27th, 2002, 1:19 pm

How can I simulate correlated random numbers?

February 4th, 2003, 7:36 pm

i am guessing that the performance is improved because the A's are orthonormal and hence behave well when multiplied by a vector of normal random variates... all the magnification / compression is inside S, which is safely diagonal.
 
User avatar
James
Posts: 1557
Joined: January 23rd, 2002, 2:24 pm

How can I simulate correlated random numbers?

February 5th, 2003, 8:21 am

Thanks Reza & kr, I am going to try this, and will be back for more advice if i screw it up (p=100%).
 
User avatar
mj
Posts: 3449
Joined: December 20th, 2001, 12:32 pm

How can I simulate correlated random numbers?

February 6th, 2003, 1:18 pm

One issue is the performance of low-discrepancy numbers.If you take low discrepancy numbers that work better in low dimensions than in high ones (this is true of all low-discrepancy numbers of which I am aware,) then you want the low dimensions to do more work. Spectral pseudo-square rooting is one way to achieve this. For ordinary pseudo-randoms it shouldn't make any difference to the convergence rate.Additionally, some people prefer the spectral method for numerical stability reasons. The method is writeC = PDP^{t}with P orthogonal and D diagonal. Let D^{1/2} be D with the elements square-rooted. Put A = PD^{1/2}.MJ
 
User avatar
WaaghBakri
Posts: 732
Joined: March 21st, 2002, 4:07 am

How can I simulate correlated random numbers?

February 8th, 2003, 5:32 am

A naive question ...... to create n correlated or independent RV's, must we worry about non-sequential drawing that results when we use the same generator? Or equivalently, if I choose every nth. sample from a single stream output from a random number generator, will I ruin the random number generators properties?
 
User avatar
sloth
Posts: 7
Joined: February 26th, 2002, 3:58 pm

How can I simulate correlated random numbers?

February 13th, 2003, 2:46 pm

The whole discussion on this topic so far has been concerned with normal distributions.More generally, you might want to simulate correlated numbers from an arbitrary collection of marginal distributions.This is the basic problem that insurance companies face all the time: estimating their total p+l distribution, when the individual parts of their business (different classes of insurance, investments, and so on) are correlated, and have weird and wonderful marginal distributions. The only 'derivatives' application I know is for modelling portfolios of weather derivatives, some of which may have very non-normal distributions (e.g. the number of days it snows in winter).Even given the correlations, there is no unique answer, unlike for the normal case.The standard method used in practice is due to Iman and Connover.My understanding of it is that it works as follows:1)calculate rank correlations2)convert them to linear correlations using a cunning formula3)simulate (using Choleski or SVD) from a multivariate normal with these correlations4)convert the normally distributed simulations to the right marginal distributions using the CDF of the normal distribution and the inverse CDF of the marginal distribution.To go further than this, you could start looking at copulas.Sloth
 
User avatar
Mano
Posts: 89
Joined: October 30th, 2001, 9:14 am

How can I simulate correlated random numbers?

February 26th, 2003, 11:18 am

I think that to generate correlated multivariate normal random variables, one would do the Cholesky or Spectral method on the CORRELATION matrix. Some people here talk about the COVARIANCE matrix.Will using the Covariance matrix (X*sqrt(t), where X is N(0,1)) be same as using the correlation matrix and then multiplying by the individual volatilities (sigma*Z*sqrt(t))
 
User avatar
mj
Posts: 3449
Joined: December 20th, 2001, 12:32 pm

How can I simulate correlated random numbers?

February 26th, 2003, 3:08 pm

why do two mults when you can get away with one.MJ
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On