Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have seen multiple instances where people try to explain the diversification effects of having assets with a certain level of correlation, especially in the "most diversified portfolio" literature. A nice example is in the NewEdge's "Superstars vs. Teamwork":

enter image description here

How can I simulate multiple random walk series that have a calibrated level of correlation to each other in order to demonstrate this? My thought is to have a random walk series $x$ and to add varied different levels of noise $n$.

$$r_i = \lambda x + (1 - \lambda) n_i$$

where $$0 \le \lambda \le 1$$

So less noise (large values of $\lambda$) will generate series with high correlation vs. more noise. But is there are more theoretical way to calibrate a certain level of correlation? I'm simulating this in R, so any R functions would be additionally helpful!

share|improve this question
up vote 8 down vote accepted

Your formula looks like cointegration (between the price time series) rather than correlation (between the returns).

To simulate "correlated random walks", i.e., random walks built from correlated innovations, you can just build the desired covariance matrix (for instance, put ones on the diagonal and $\rho$ everywhere else), take multivariate gaussian samples with this covariance matrix (in R, you can use the mvtnorm package, or take independent gaussian variables and multiply them by the Choleski matrix), and take the cumulated sum to have an arithmetic random walk.

k <- 10
rho <- .9
sigma <- matrix(rho, nc=k, nr=k)
diag(sigma) <- 1
n <- 100
x <- rmvnorm(n, rep(0,k), sigma)
x <- apply(x, 2, cumsum) 
matplot(x, type="l", lty=1)
share|improve this answer
This is perfect, thanks! I will accept this shortly. – Belmont Feb 3 '12 at 4:12
Also check out the sample code on this similar question: quant.stackexchange.com/questions/2453/… – Ram Ahluwalia Feb 3 '12 at 5:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.