# Generating a matrix so that correlations amongst columns are close to pre-defined values

I want to generate a matrix of values such that the correlations (e.g., Pearsons correlations) are close to a pre-defined set of values (e.g., corrs = [0.5, 0.7, -0.3, 0.9, 0.2]). For simplicity, we can assume we're only concerned with the correlation of pairs of columns.

For example, I may want a matrix with 4 columns and 100 rows, and the correlations between columns should be close to the following:

CORR(c1, c2) = corrs[0]
CORR(c1, c3) = corrs[1]
CORR(c1, c4) = corrs[2]
CORR(c2, c3) = corrs[3]
CORR(c2, c4) = corrs[4]
CORR(c3, c4) = corrs[5]


Depending on the parameters specified (matrix size, correlations), a solution may not exist, but for reasonable parameters, it seems like some algorithm should be able to come up with a solution.

Is there any areas of research that can help me accomplish this? It seems like something related to graphs and/or some iterative algorithm might be what I need, but I'm struggling with how to represent the problem mathematically or in a graph, and my knowledge of these areas is pretty limited.

• It seems like a multivariate normal distribution (or multivariate Student's $t$ distribution, if you like) checks these boxes. Are there any additional requirements? – Sycorax Jul 19 '17 at 15:48
• Thanks @Sycorax, that makes sense. I just adjust my covariance matrix accordingly. I'll try playing with this – Dolan Antenucci Jul 19 '17 at 15:52
• This might be what you're looking for econometricsbysimulation.com/2014/02/… – user5292 Jul 19 '17 at 18:55

I set the means and variances for my columns to 0 and 1 respectively, thus the covariance matrix is populated with just the desired Pearson correlations (since cov(X,Y) = corr(X, Y) * std_dev_X * std_dev_Y).