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$>
References: <> <go11u8$1kdh$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1235503204 16515 (24 Feb 2009 19:20:04 GMT)
NNTP-Posting-Date: Tue, 24 Feb 2009 19:20:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:520542

Jan <> wrote in message <go11u8$1kdh$>...
> 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 &#961;=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