<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to create two sets of random numbers with given correlation coefficient in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23485#M304</link>
    <description>To Rick only. Please, give me your SAS code that answear to my question for arbitrary mean and sigma. Everything else you talked I know how to do. I don't have randnormal in my sas EG 4. Thanks for your reply.</description>
    <pubDate>Tue, 28 Apr 2009 13:48:58 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-04-28T13:48:58Z</dc:date>
    <item>
      <title>How to create two sets of random numbers with given correlation coefficient</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23482#M301</link>
      <description>Can anybody provide a code to create two vectors with random numbers, but given correlation. Thanks in advance</description>
      <pubDate>Fri, 24 Apr 2009 14:03:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23482#M301</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-24T14:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to create two sets of random numbers with given correlation coefficient</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23483#M302</link>
      <description>Though I do not have an answer to your request, I highly recommend using the SAS support   &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website and its SEARCH facility using some of your terms and/or phrases in your SUBJECT.  Also, I did a Google advanced search (argument listed below) against the SAS.COM website and found some search-matches which you may find useful, both SAS documentation and also supplemental technical/conference papers.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
GOOGLE advanced search argument - note the use of the parameter site:  in your search argument:&lt;BR /&gt;
&lt;BR /&gt;
generate random number vector with correlation site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
Good luck.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Sat, 25 Apr 2009 16:17:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23483#M302</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-25T16:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create two sets of random numbers with given correlation coefficient</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23484#M303</link>
      <description>As stated, your problem doesn't have a unique solution. There are infinitely many pairs of numbers that yield the same correlation coefficient.  For example, if x={1, -1}, then any y of the form y={t, -t} has perfect correlation (r=1) with x.  Also, the correlation coefficient is invariant under shifts in the mean of the data, so you probably want additional assumptions on the distribution of the data.&lt;BR /&gt;
&lt;BR /&gt;
A problem that makes sense to ask is "given a correlation (or covariance), can I generate multivariate normal vectors x and y of length N from a bivariate distribution with a given set of means and the given covariance?"  The answer is yes, and you can use the RANDNORMAL module in SAS/IML to generate the data.  See the RANDNORMAL module documentation for syntax and an example.&lt;BR /&gt;
&lt;BR /&gt;
Obviously, the particular sample you generate is not guaranteed to have the given mean and covariance, even though it was generated from a distribution with those properties.</description>
      <pubDate>Mon, 27 Apr 2009 12:54:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23484#M303</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2009-04-27T12:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to create two sets of random numbers with given correlation coefficient</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23485#M304</link>
      <description>To Rick only. Please, give me your SAS code that answear to my question for arbitrary mean and sigma. Everything else you talked I know how to do. I don't have randnormal in my sas EG 4. Thanks for your reply.</description>
      <pubDate>Tue, 28 Apr 2009 13:48:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23485#M304</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-28T13:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to create two sets of random numbers with given correlation coefficient</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23486#M305</link>
      <description>To Rick only. Could you check this simple code and say if anything is wrong?&lt;BR /&gt;
Later I will create datasets with given mean and sigma with this correlation.&lt;BR /&gt;
I cannot get my given correlation factor 0.5. I am getting 0.54.&lt;BR /&gt;
Big thanks in advance.&lt;BR /&gt;
&lt;BR /&gt;
data test1;&lt;BR /&gt;
do i=1 to 100;&lt;BR /&gt;
corr=0.5;&lt;BR /&gt;
A=rand('NORMAL');&lt;BR /&gt;
B=rand('NORMAL');&lt;BR /&gt;
C=corr*A+sqrt(1.0-corr*corr)*B;&lt;BR /&gt;
output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc corr data=test1;&lt;BR /&gt;
var A; with C;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 28 Apr 2009 16:04:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23486#M305</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-28T16:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to create two sets of random numbers with given correlation coefficient</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23487#M306</link>
      <description>SAS Technical Support can give you the code for the RANDNORM module.</description>
      <pubDate>Tue, 28 Apr 2009 18:09:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23487#M306</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2009-04-28T18:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create two sets of random numbers with given correlation coefficient</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23488#M307</link>
      <description>Your formula will work if A and B are uncorrelated.&lt;BR /&gt;
The random samples you are generating are never perfectly &lt;BR /&gt;
uncorrelated, but corr(A,C) should asymptotically approach your target as N --&amp;gt; infinity.</description>
      <pubDate>Tue, 28 Apr 2009 18:19:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23488#M307</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2009-04-28T18:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create two sets of random numbers with given correlation coefficient</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23489#M308</link>
      <description>To Rick only. Thanks, that is what I wanted to hear</description>
      <pubDate>Tue, 28 Apr 2009 18:39:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-create-two-sets-of-random-numbers-with-given-correlation/m-p/23489#M308</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-28T18:39:56Z</dc:date>
    </item>
  </channel>
</rss>

