I need to generate two random variables – lognormal and beta distributed – while ensuring that the correlation between the two variables is -0.3.
I generated two normal random variables with -0.3 correlation as follows;
matrix C = (1, -0.3 -0.3, 1) drawnorm x y, mean(0.921, 0) sds(0.174,1) corr(C) // Here x is normal rv with mean 0.921 and sd 0.174 while y is a standard normal rv.
Converting x to lognormal is simple. I do this
gen price = exp(x) // price is now the lognormal(0.921, 0.174)
Problem is in converting y~$N(0,1)$ to $beta(alpha,beta)$. Is there a way to do it?