I would like to generate a set of artificial data using another input set from which correlations between variables can be extracted. Not all variables are binary, but the data can easily be extended to be so, at the cost of increased dimensionality.

I was only able to find a method for the generation of correlated artificial binary data on a working paper by Friedrich Leisch, Andreas Weingessel and Kurt Hornik.

Are there other recommended methods, especially ones that don't require the data to be binary?

  • $\begingroup$ Are you asking how to generate non-independent correlated binary data? Or, are you asking how to simulate data from an arbitrary multivariate distribution that is possibly a mix of discrete and continuous data, with pre-specified correlation? I don't think the latter is, in general, possible $\endgroup$ – Macro Jun 15 '12 at 12:51
  • $\begingroup$ A distribution on $n$ binary variates is equivalent to a distribution on their $2^n$ possible joint values, so why not just simulate from that (discrete) distribution? It's fast and easy to do so. (One simple algorithm requires only about $H$ uniform variates where $H$ is the entropy of the distribution in bits; faster algorithms exist.) The existence of that working paper suggests I'm overlooking an important issue here... This approach to binary simulation generalizes easily to any discrete multivariate distribution. $\endgroup$ – whuber Jun 15 '12 at 13:06
  • $\begingroup$ @whuber, re: "A distribution on n binary variates is equivalent to a distribution on their $2^n$ possible joint values, so why not just simulate from that (discrete) distribution?" you make that sound so simple. If you knew the joint probabilities then, yes, that is trivial. But, the OP appears to describe a situation where you know the marginal probabilities and the correlations. In general, for binary data, that's not enough information (as discussed in a thread that we both participated in a couple weeks ago). $\endgroup$ – Macro Jun 15 '12 at 13:21
  • $\begingroup$ Thanks, @Macro: that may be the point I am missing. But what do you make of the beginning of this question, which indicates there is an "input set" of data? In other words, the correlations are not the only information available and indeed, it appears an estimate of the full distribution might readily be obtained. I am wondering whether using only the correlations for simulation is an unnecessary restriction imposed by the OP. $\endgroup$ – whuber Jun 15 '12 at 13:25
  • 1
    $\begingroup$ The non-binary data is discrete. It is being converted to binary classes using dummy coding. $\endgroup$ – Joao Azevedo Jun 15 '12 at 15:29

One approach to generating multivariate random data with correlations is to use a copula. Basically you generate n-dimensional data with uniform margins and a correlation structure, then transform the data to the marginal distribution of interest (binary variables can be generated by simply seeing if the value is greater than a cut-off). This does not guarentee an exact correlation with the transformed variables, but does give a general correlation structure and can be used with any distribution with an inverse CDF.

This could be used to generate a dataset with a mixture of binary variables and continuous variables from other distributions (or other discrete variables as well). You can simulate several datasets and check the level of correlation and if it is not close to what you were hoping for, go back and adjust the copula accordingly and try again.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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