I have a dataset of numbers, which I know to be correlated with a covariance matrix that I can reasonably estimate. This correlation has no (known) structure connected to time, space, clusters, or siimlar. Moreover, the values are not normally distributed.

For a sanity check (surrogate, resampling, or whatever you wish to call it), I want to generate artificial datasets with the following properties:

  • The data is correlated as per the given covariance matrix.
  • The values have the same distribution as the original data.

It probably suffices if those properties are only approximately preserved. You might call this a parametric bootstrap of correlated data.

What I found so far

  • Resampling correlated data using bootstrap asks for the case of data with a known correlation structure. The books recommended in the answer only seem to address the case of correlations that originate from temporal or spacial sampling or from clusters.

  • There are procedures for generating normally distributed data with a known correlation matrix, as addressed, e.g., in: Generating data with a given sample covariance matrix.

  • My best ad-hoc approach so far would be: Generate normally distributed data adhering to the correlation matrix, and then rank-transform it to the target distribution, hoping that the correlation structure will not be affected too strongly.

  • $\begingroup$ Check out elliptical distributions. If you're happy to take one of those the problem is not too bad ( and that you talk about ranks suggests you would like an elliptical distribution...) $\endgroup$ Mar 30, 2019 at 10:06
  • $\begingroup$ @user1587692: I am aware of those (or rather, it is not surprising to me that I can generate data from them), but how are they going to help me beyond what I elaborated in the last point? Can you elaborate in an answer? $\endgroup$
    – Wrzlprmft
    Mar 31, 2019 at 6:35
  • 2
    $\begingroup$ I think this is along the lines of what I described here: stats.stackexchange.com/a/423189/247274. You specify the correlations in the copula; then you give the marginal distributions parameters to turn those correlations into the covariances you want. $\endgroup$
    – Dave
    Sep 28, 2019 at 3:56

2 Answers 2


The question is very broad, with little specific information. The general answer is to use a copula. Since you specifically want to control the covariance matrix, a gaussian copula would be indicated, or more generally, an elliptical copula. The answer bt @DavidF is a link to a walk-through of such a solution. But if such a copula is a good fit to the data is another question entirely.

After simulating data from the copula model, transform the margins one by one. If you want a better answer, tell us some more, like number of variables, and what is your ultimate goal?


I think what you need is explained here, and without the use of copulas: https://www.r-bloggers.com/easily-generate-correlated-variables-from-any-distribution-without-copulas/

In the words of the author of the linked article (Francis Smart), the proposed method is:

  1. Draw any number of variables from a joint normal distribution.

  2. Apply the univariate normal CDF of variables to derive probabilities for each variable.

  3. Finally, apply the inverse CDF of any distribution to simulate draws from that distribution.

The result is that the final variables are correlated in a similar manner to that of the original variables. This is because the rank order of the variables is maintained and thus correlations are approximately the same though not exact.

Hope it helps.

  • 1
    $\begingroup$ Welcome to Stats.SE. Can you please edit you answer to expand it, in order to include the main points of the link you provide? It will be more helpful both for people searching in this site and in case the link breaks. By the way, take the opportunity to take the Tour, if you haven't done it already. See also some tips on How to Ask, on formatting help and on writing down equations using LaTeX / MathJax. $\endgroup$ Sep 30, 2019 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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