http://www.mathworks.com/matlabcentral/newsreader/view_thread/317882
MATLAB Central Newsreader  Generate three correlated variables
Feed for thread: Generate three correlated variables
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Mon, 12 Mar 2012 15:30:11 +0000
Generate three correlated variables
http://www.mathworks.com/matlabcentral/newsreader/view_thread/317882#869711
Gabriela Sicilia
Hello, I need to generate three random correlated variables: corr (x1,x2 )= 0,9; corr (x1,x3)= 0.9 and corr (x2, x3) =0. In addition, x1 and x1 are uniform (a,b) distributed and x2 is a normal (mu, sigma) distributed variable. <br>
<br>
Thanks in advance, <br>
<br>
Gabriela.

Mon, 12 Mar 2012 18:26:12 +0000
Re: Generate three correlated variables
http://www.mathworks.com/matlabcentral/newsreader/view_thread/317882#869730
Roger Stafford
"Gabriela Sicilia" wrote in message <jjl4q3$pab$1@newscl01ah.mathworks.com>...<br>
> Hello, I need to generate three random correlated variables: corr (x1,x2 )= 0,9; corr (x1,x3)= 0.9 and corr (x2, x3) =0. In addition, x1 and x1 are uniform (a,b) distributed and x2 is a normal (mu, sigma) distributed variable. <br>
> ......<br>
      <br>
Knowing the separate distributions of two random variables and their correlation does not uniquely determine their joint distribution. For example, if two dice are thrown and each die separately has 1/6 probability for each face, but together they have a nonzero correlation (due, say, to hidden magnets,) there are 36 unknowns in their joint distribution which are constrained to satisfy only 12 independent equations. There remain 24 degrees of freedom in choosing their joint distribution. Or, if both random variables are normal with given mean and variance, their correlation only determines their joint distribution if they are known to be jointly normal, which is a very powerful constraint.<br>
<br>
In other words you haven't given enough information to uniquely determine the joint distribution of your three random variables, and that would be needed to generate them properly.<br>
<br>
Roger Stafford

Mon, 12 Mar 2012 19:06:55 +0000
Re: Generate three correlated variables
http://www.mathworks.com/matlabcentral/newsreader/view_thread/317882#869736
Peter Perkins
As Roger said, you haven't provided specific enough information to have <br>
a unique solution to your question, but you might find this<br>
<br>
<<a href="http://www.mathworks.com/products/statistics/demos.html?file=/products/demos/shipping/stats/copulademo.html">http://www.mathworks.com/products/statistics/demos.html?file=/products/demos/shipping/stats/copulademo.html</a>><br>
<br>
useful.<br>
<br>
<br>
On 3/12/2012 2:26 PM, Roger Stafford wrote:<br>
> "Gabriela Sicilia" wrote in message<br>
> <jjl4q3$pab$1@newscl01ah.mathworks.com>...<br>
>> Hello, I need to generate three random correlated variables: corr<br>
>> (x1,x2 )= 0,9; corr (x1,x3)= 0.9 and corr (x2, x3) =0. In addition,<br>
>> x1 and x1 are uniform (a,b) distributed and x2 is a normal (mu, sigma)<br>
>> distributed variable. ......<br>
>       <br>
> Knowing the separate distributions of two random variables and their<br>
> correlation does not uniquely determine their joint distribution. For<br>
> example, if two dice are thrown and each die separately has 1/6<br>
> probability for each face, but together they have a nonzero correlation<br>
> (due, say, to hidden magnets,) there are 36 unknowns in their joint<br>
> distribution which are constrained to satisfy only 12 independent<br>
> equations. There remain 24 degrees of freedom in choosing their joint<br>
> distribution. Or, if both random variables are normal with given mean<br>
> and variance, their correlation only determines their joint distribution<br>
> if they are known to be jointly normal, which is a very powerful<br>
> constraint.<br>
><br>
> In other words you haven't given enough information to uniquely<br>
> determine the joint distribution of your three random variables, and<br>
> that would be needed to generate them properly.<br>
><br>
> Roger Stafford

Mon, 12 Mar 2012 22:37:32 +0000
Re: Generate three correlated variables
http://www.mathworks.com/matlabcentral/newsreader/view_thread/317882#869744
ImageAnalyst
Maybe not uniquely, but maybe all she requires is "A" solution  any<br>
solution at all that satisfies the requirements.

Mon, 12 Mar 2012 23:22:21 +0000
Re: Generate three correlated variables
http://www.mathworks.com/matlabcentral/newsreader/view_thread/317882#869748
Jeff
On Tuesday, March 13, 2012 4:30:11 AM UTC+13, Gabriela Sicilia wrote:<br>
> Hello, I need to generate three random correlated variables: corr (x1,x2 )= 0,9; corr (x1,x3)= 0.9 and corr (x2, x3) =0.<br>
<br>
That pattern of correlations is impossible. With the specified x1/x2 and x1/x3 correlations, the x2/x3 correlation must be negative.<br>
<br>
>In addition, x1 and x1 are uniform (a,b) distributed and x2 is a normal (mu, sigma) distributed variable. <br>
As others have mentioned, there are various ways of producing correlations when some of the marginals are not normal. At the link below is a program that can be used to generate correlated nonnormal random variables in a few different ways (described in its documentation). Sorry this is not matlab code, but you could use it to generate the values externally and then read them into matlab.<br>
<br>
<a href="http://psy.otago.ac.nz/miller/progs/randgen.zip">http://psy.otago.ac.nz/miller/progs/randgen.zip</a><br>
<br>
Of course, first you must select a correlation matrix that is possible.

Tue, 13 Mar 2012 09:07:12 +0000
Re: Generate three correlated variables
http://www.mathworks.com/matlabcentral/newsreader/view_thread/317882#869794
Gabriela Sicilia
ImageAnalyst <imageanalyst@mailinator.com> wrote in message <a9a33dc871054f54930ed7d73b5fe17c@w5g2000yqi.googlegroups.com>...<br>
> Maybe not uniquely, but maybe all she requires is "A" solution  any<br>
> solution at all that satisfies the requirements.<br>
<br>
Thanks everyone for your help. Exactly, what I need is "one" possible solution. Basically, what I want to generate is an instrumental variable. I 'm simulating an endogenous model (where x1 is the endogenous variable and x2 is the noise, so they are correlated strongly), and I want to generate a third variable x3 (the instrument) which is significally correlated with x1 but is not with x2. It could exist a weack negative correlation between x2 and x3, but it can't be a significative correlation. <br>
<br>
Thans againg in advance, <br>
Gabriela.

Wed, 14 Mar 2012 17:24:33 +0000
Re: Generate three correlated variables
http://www.mathworks.com/matlabcentral/newsreader/view_thread/317882#869980
Peter Perkins
On 3/13/2012 5:07 AM, Gabriela Sicilia wrote:<br>
> Thanks everyone for your help. Exactly, what I need is "one" possible<br>
> solution.<br>
<br>
Did you read the link I posted?

Wed, 06 Jun 2012 16:24:07 +0000
Re: Generate three correlated variables
http://www.mathworks.com/matlabcentral/newsreader/view_thread/317882#879190
slama najla
Peter Perkins <Peter.Remove.Perkins.This@mathworks.com> wrote in message <jjqk8h$cr7$1@newscl01ah.mathworks.com>...<br>
> On 3/13/2012 5:07 AM, Gabriela Sicilia wrote:<br>
> > Thanks everyone for your help. Exactly, what I need is "one" possible<br>
> > solution.<br>
> <br>
> Did you read the link I posted?<br>
<br>
<br>
please can any one telle me how can i get a correlation between two 3d matrix(corr2 isn't applicable).Thanks