Two correlated random variables
15 views (last 30 days)
I want a formula to generate two random variables X and Y that are correlated with a certain rho and distributed (0, 1). The formula provided by all the sources I saw is (a few are provided below) is:
rho = 0.9; %for example
x = rand(); X = x;
y = rand();
Y = rho*X + sqrt(1-rho^2)*y;
However, the Y values generated are not distributed between 0 and 1 (however, the corelation is correct). Please see the attahced image. Does anyone have a better formula? Thanks.