# Picking from two correlated distributions

Can anyone provide a simple example of picking from two distributions, such that the two generated time series give a specified value of Pearson's correlation coefficient? I would like to do this in a simple monte-carlo risk assessment. Ideally, the method should take two arbitrary CDFs and a correlation coefficient as input.

I asked a similar question on picking from correlated distributions on stats.stackexchange.com and learned that that mathematical machinery required is a called a copula. However I found quite a steep learning curve waiting after consulting the references... some simple examples would be extremely helpful.

Thanks!

You have two distributions $P_1$ and $P_2$. Let me begin by pointing out that this problem is not actually solvable in the general case. That's because either $P_1$ or $P_2$ can in principle be a point distribution with 100% of its density at a single value. In that case, of course, all correlations will be zero.
More generally, the shapes of $P_1$ and $P_2$ will put a ceiling $\rho_{\text{max}}$ on the size of correlation $\rho$ that is achievable even in principle. That ceiling may be 100% but it is difficult to compute in the general case.
Your best bet would be to use a copula with 100% correlation $r$, to get a lower bound estimate for the maximum possible correlation. Compute the Pearson correlation $\rho$ of your actual distribution from your $r=$100% copula and you have an estimate for $\rho_{\text{max}}$. If your target correlation is smaller than that, you can use a root-finder with copula correlation $r$ as input and resulting correlation $\rho$ as an output. You'll have to keep recomputing $\rho$ of course, which may in principle involve a nasty integral.