# How to simulate correlated assets for illustrating portfolio diversification?

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":

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!

-

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
library(mvtnorm)
x <- rmvnorm(n, rep(0,k), sigma)
x <- apply(x, 2, cumsum)
matplot(x, type="l", lty=1)

-
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/… –  Quant Guy Feb 3 '12 at 5:15