Generating skewed correlated data in R I am interested in generating correlated, skewed data in order to evaluate the application of a statistical approach to a data set I am analyzing. Specifically, I have two correlated variables, and I can determine the correlation coefficient ($R^2$) between the two, as well as the shape, scale and location of each skewed distribution using the sn.em command within the sn package for R.
I can generate a skewed distribution using the rsnorm function within the VGAM package. However, I cannot tell it to generate a second vector that is correlated to the first, also skewed, and has its own specific set of shape, scale and location parameters as calculated from the data.
Any advice on how to do this would be greatly appreciated, and thank you in advance!
 A: You can get the marginal distributions you want easily enough, but you may not also be able to get the populations to be linearly correlated as you wish - the two desires are not generally compatible.
However, one thing you can do is specify a monotonic measure of correlation (like Spearman's rho or Kendall's tau); these survive monotonic transformation intact. As such, you can use copulas to generate two uniform marginals with the desire amount of association, and then transform the margins to exactly what you desire.
By judicious choice of copula family you may be able to get the linear correlation close to the desired one.
A: An approach that I've had surprising success with (in Mathematica -- I don't know R) takes any set of pairs $(x_1,y_1),\ldots,(x_n,y_n)$ and tries to create a specified correlation by re-pairing the data. That is, iterating over all $n(n-1)/2$ pairs $(i,j)$, swap $y_i$ and $y_j$ if it will bring the correlation closer to the specified value. In general, it seems to work best when the $n(n-1)/2$ absolute differences among $x_1,\ldots,x_n$ contain few ties, and similarly for $y_1,\ldots,y_n$. (And, of course, when the specified correlation is not ruled out by the marginal distributions.)
A: Let r be the correlation value you want   
r=.3     

Simulate two random variables from the same density, they should be independent. If not you should insure their correlation is 0 (maybe a cholesky decomposition?) 
x=rsnorm(1000,0,2,4)
y=rsnorm(1000,0,2,4)

cor(x,y)
[1] 0.007983692

Use this formula to get the correlated second variable y1
y1=x*r+y*sqrt(1-r^2)


cor(x,y1)
[1] 0.3006946

This will only work for you if (1) the two input random variables' have the same distribution and (2) you only care about one of the output random variables' distribution. 
