# Random generation of n-dimensional data with possibly correlated variables

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?

• 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 – Macro Jun 15 '12 at 12:51
• 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. – whuber Jun 15 '12 at 13:06
• @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). – Macro Jun 15 '12 at 13:21
• 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. – whuber Jun 15 '12 at 13:25
• The non-binary data is discrete. It is being converted to binary classes using dummy coding. – Joao Azevedo Jun 15 '12 at 15:29