Hi. I have two variables, x and y, that are each normally distributed with mean 0 and have known standard deviations. The variables also have a known correlation, so I can represent their correlations in a matrix like so: a <- array(c(0.3,0.1,0.1,0.2),c(2,2)) a Is there an R function that generates random values for my two variables given the correlation? I'd like to do this for up to 5 variables and I'm running version 2.7.2 on a windows platform. Thanks. eric
how to generate multiple random variables that are correlated
3 messages · eric lee, Ben Bolker, Jorge Ivan Velez
eric lee <ericlee100 <at> gmail.com> writes: [snip]
Is there an R function that generates random values for my two variables given the correlation? I'd like to do this for up to 5 variables and I'm running version 2.7.2 on a windows platform. Thanks.
?MASS::mvrnrom
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090202/66904190/attachment-0001.pl>