# Correlation preserving transformation conundrum

I have a problem where I need to generate $n$ random variables $\in$ [0,1] (you can think of them as some sort of probabilities) and the variables have a known correlation structure given by a variance-covariance matrix, which is known.

The first thing I tried was generating multivariate normal random draws based on the correlation structure (which is standard textbook fare!), but it would give random variables in the range ($-\infty$,$\infty$).

So, I thought of transforming these random variables to map them to [0,1] and I tried the normal CDF for transformation (i.e. probability integral transform). Finally, I do get random variables in [0,1] but since the transformation by normal CDF is non-linear, it doesn't preserve the correlation structure.

The reason I chose to generate multivariate normal random variables in the first place was due to the fact that there is a standard well-known way of generating random variables with a given correlation structure.

It will be great if any one has thoughts on:

1). Transformation to [0,1] that will preserve correlations

2). Or, maybe an alternate take on the problem which does not involve generating multivariate normal random draws in the beginning and can generate correlated random variables on [0,1] directly

• If it's okay that the marginal distributions be uniform$(0, 1)$ then you should be able to simulate these variables directly using a copula. I haven't used it, but there's an R package copula which I believe allows you to do this (among other things). Commented Jul 26, 2015 at 5:13
• Yes, uniform margins are fine. Can you be a bit more clear how you would use copulas for this. Commented Jul 26, 2015 at 14:24
• @dsaxton but copulas won't in general allow you to specify the Pearson correlation, which is what the question is seeking to do; in some cases you can specify a Spearman or a Kendall correlation but they usually won't correspond closely to a Pearson correlation. Commented Jul 26, 2015 at 14:47
• @Glen_b: Isn't there a direct mapping between Spearman's rho and Pearson which can be used i.e. first construct the corresponding Spearman for the Pearson that you'd like; then generate the r.v.s, then shouldn't they have the original (desired) pearson? Also, my r.v.s are continuous and not ordinal, so if I were to stick to Spearman's all through, is that fine? That was the main reason I wanted to specify Pearson and not Spearman. If Spearman can be justified, I am fine with it. Commented Jul 26, 2015 at 15:05
• I was kind of assuming (or hoping) that there was a way of going analytically from the copula to the correlation matrix for $(U_1, \ldots, U_n)$ but maybe that isn't the case. Commented Jul 26, 2015 at 15:16

You need the idea of a copula, see for instance Introductory reading on Copulas. the trick used with copulas to estimate/describe correlation structure is to use rank correlations, they are preserved under (increasing) monotone transformations. You could use that with your originally proposed procedure, or follow the copula methodology.

But copulas won't in general allow you to specify the Pearson correlation, which is what the question is seeking to do; in some cases you can specify a Spearman or a Kendall correlation but they usually won't correspond closely to a Pearson correlation. – Glen_b

In general there is way (at least in principle) to find the Pearson correlation(s) for a copula - just as you could for any multivariate distribution. However it's not usually simple. For common nonparametric correlations the value is often available as a direct function of the parameter(s) on common copulas (people have put the work into finding those because they survive monotonic transformation of the margins). With Pearson correlations, you're generally on your own. Careful choice of copula might get something doable, of course. – Glen_b

for a specific copula, yes, but the relationship is different for each copula. Unless you have a case where it's already known, working out that relationship between correlations is in most cases not likely to be easier than computing the Pearson directly from the copula itself. It might be possible to choose a sufficiently nice copula which has whatever properties you need and is still tractable enough to compute the Pearson correlations on. – Glen_b