Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Generation of correlated random numbers Date: Tue, 24 Feb 2009 19:20:04 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 29 Message-ID: <go1h94$g43$1@fred.mathworks.com> References: <30956643.1233931196387.JavaMail.jakarta@nitrogen.mathforum.org> <go11u8$1kdh$1@gwdu112.gwdg.de> Reply-To: <HIDDEN> NNTP-Posting-Host: webapp-05-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1235503204 16515 172.30.248.35 (24 Feb 2009 19:20:04 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Tue, 24 Feb 2009 19:20:04 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:520542 Jan <janila@web.de> wrote in message <go11u8$1kdh$1@gwdu112.gwdg.de>... > Elena wrote: > > Hi! > > I wanna do a very simple thing but I don't know how yo do it... > > I want to generate some values for 2 random variables (with known distribution, mean values and standard deviations) but the random variables are not independent. If for example the correlation of these variables is ρ=0.7 , how can I define this correlation?? > > > > Thank u! > > Hmm, maybe do something like draw pairs of random numbers from your two > random variables and throw some of them away, so that the correlation > gets a specific value. This way, the distribution of the single random > variables should remain unchanged (??) while you can get a correlation. > > For example: Throw all pairs away, where the first random number is > smaller than the mean of its underlying distribution and the second > random number is larger than its mean... and vice versa. Try to find a > parameter in this throwing away business. Then try different parameter > values and measure, which correlation is the outcome in each case. > > This is a rahter low sophisticated approach... > > Greetings > Jan Jan, you have asserted "the distribution of the single random variables should remain unchanged" with the selective rejection you described. I would be very surprised if that statement were true. Any such selection as this would almost inevitably alter both random variables' individual distributions. What is it you find objectionable about using 'mvnrnd' or the method I showed you? Do you want something other than jointly normal random variables? Perhaps you should describe your problem more fully. Roger Stafford