<?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: RANGAM vs. RAND(&amp;quot;Gamma&amp;quot;, ) - in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/RANGAM-vs-RAND-quot-Gamma-quot/m-p/270215#M14213</link>
    <description>&lt;P&gt;Well.....Please ignore.... I realized I needed to debug my own code! I see there is no difference when I correct my code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%let shape =0.15;&lt;BR /&gt;%let scale =0.25;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data test;&lt;BR /&gt;do i = 1 to 1000;&lt;BR /&gt;do until (xnew&amp;gt;=0.2);&lt;BR /&gt;xnew=&amp;amp;scale.*rand("Gamma", &amp;amp;shape.);&lt;BR /&gt;END;&lt;BR /&gt;OUTPUT;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test1;&lt;BR /&gt;do i = 1 to 1000;&lt;BR /&gt;do until (xold&amp;gt;=0.2);&lt;BR /&gt;xnew=&amp;amp;scale.*rand("Gamma", &amp;amp;shape.);&lt;BR /&gt;xold=&amp;amp;scale.*rangam(100,&amp;amp;shape.);&lt;BR /&gt;END;&lt;BR /&gt;OUTPUT;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc univariate data = test;&lt;BR /&gt;var xnew;&lt;BR /&gt;histogram/ gamma;&lt;BR /&gt;inset gamma/pos=ne;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc univariate data = test1;&lt;BR /&gt;var xold;&lt;BR /&gt;histogram/ gamma;&lt;BR /&gt;inset gamma/pos=ne;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 12 May 2016 21:21:39 GMT</pubDate>
    <dc:creator>jonesk48</dc:creator>
    <dc:date>2016-05-12T21:21:39Z</dc:date>
    <item>
      <title>RANGAM vs. RAND("Gamma", )</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/RANGAM-vs-RAND-quot-Gamma-quot/m-p/270211#M14212</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to simulate data from a gamma distribution. I originally used the RAND function, from my understanding this is a newer function. However, I also tried the older&amp;nbsp;function RANGAM. When using the same shape (and scale) parameters I get very different graphs&amp;nbsp;when plotting the data. &amp;nbsp;I'm obviously not understanding something correctly, could anyone advise on why one would use RAND vs. RANDGAM? I assumed there really shouldn't be any major differences.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Code I tried&lt;/P&gt;&lt;P&gt;%let shape =0.15;&lt;/P&gt;&lt;P&gt;%let scale = 0.25;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;do i = 1 to 1000;&lt;/P&gt;&lt;P&gt;do until (x&amp;gt;=0.2);&lt;/P&gt;&lt;P&gt;xnew=&amp;amp;scale.*rand("Gamma", &amp;amp;shape.);&lt;/P&gt;&lt;P&gt;xold=&amp;amp;scale.*randgam(1,&amp;amp;shape.);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc univariate data=test;&lt;/P&gt;&lt;P&gt;var xnew xold;&lt;/P&gt;&lt;P&gt;histogram/gamma;&lt;/P&gt;&lt;P&gt;inset gamma/pos=ne;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data I'm trying to simulate needs to have a lower bound no less than 0.2, which is why I have the do until loop above. I'm hoping this is appropriate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for any help you can provide!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 21:04:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/RANGAM-vs-RAND-quot-Gamma-quot/m-p/270211#M14212</guid>
      <dc:creator>jonesk48</dc:creator>
      <dc:date>2016-05-12T21:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: RANGAM vs. RAND("Gamma", ) -</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/RANGAM-vs-RAND-quot-Gamma-quot/m-p/270215#M14213</link>
      <description>&lt;P&gt;Well.....Please ignore.... I realized I needed to debug my own code! I see there is no difference when I correct my code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%let shape =0.15;&lt;BR /&gt;%let scale =0.25;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data test;&lt;BR /&gt;do i = 1 to 1000;&lt;BR /&gt;do until (xnew&amp;gt;=0.2);&lt;BR /&gt;xnew=&amp;amp;scale.*rand("Gamma", &amp;amp;shape.);&lt;BR /&gt;END;&lt;BR /&gt;OUTPUT;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test1;&lt;BR /&gt;do i = 1 to 1000;&lt;BR /&gt;do until (xold&amp;gt;=0.2);&lt;BR /&gt;xnew=&amp;amp;scale.*rand("Gamma", &amp;amp;shape.);&lt;BR /&gt;xold=&amp;amp;scale.*rangam(100,&amp;amp;shape.);&lt;BR /&gt;END;&lt;BR /&gt;OUTPUT;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc univariate data = test;&lt;BR /&gt;var xnew;&lt;BR /&gt;histogram/ gamma;&lt;BR /&gt;inset gamma/pos=ne;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc univariate data = test1;&lt;BR /&gt;var xold;&lt;BR /&gt;histogram/ gamma;&lt;BR /&gt;inset gamma/pos=ne;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 21:21:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/RANGAM-vs-RAND-quot-Gamma-quot/m-p/270215#M14213</guid>
      <dc:creator>jonesk48</dc:creator>
      <dc:date>2016-05-12T21:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: RANGAM vs. RAND("Gamma", )</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/RANGAM-vs-RAND-quot-Gamma-quot/m-p/270219#M14214</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/85329"&gt;@jonesk48﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The major difference between the RAND function (with first argument "Gamma") and the RANGAM function is the underlying&amp;nbsp;&lt;SPAN&gt;pseudo-random number generator: The RAND function uses the famous Mersenne Twister, whereas the older RANGAM and other RANxxx functions use an older generator with inferior statistical properties. So, for professional simulations the RAND function should be preferred.&amp;nbsp;Please see the &lt;A href="http://support.sas.com/documentation/cdl//en/lefunctionsref/67960/HTML/default/viewer.htm#p026ygl6toz3tgn14lt4iu6cl5bb.htm#n1nhvm9m4y798sn1rvwg8zldva5o" target="_blank"&gt;documentation&lt;/A&gt; for more details. You can use the &lt;A href="http://support.sas.com/documentation/cdl/en/syntaxidx/68719/HTML/default/index.htm#/documentation/cdl/en/lefunctionsref/67960/HTML/default/p0gw58qo85qp56n1kbpiz50ww8lv.htm" target="_blank"&gt;CALL STREAMINIT&lt;/A&gt; routine to specify a seed value (as you did in the first argument of RANGAM).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 21:44:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/RANGAM-vs-RAND-quot-Gamma-quot/m-p/270219#M14214</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-12T21:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: RANGAM vs. RAND("Gamma", )</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/RANGAM-vs-RAND-quot-Gamma-quot/m-p/270243#M14215</link>
      <description>&lt;P&gt;Check Rick's blog for the complete explanation &amp;nbsp;RANDXXX() v.s. RAND() .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2013/07/10/stop-using-ranuni.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2013/07/10/stop-using-ranuni.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2016 01:04:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/RANGAM-vs-RAND-quot-Gamma-quot/m-p/270243#M14215</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-05-13T01:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: RANGAM vs. RAND("Gamma", )</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/RANGAM-vs-RAND-quot-Gamma-quot/m-p/270246#M14216</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh﻿&lt;/a&gt;&amp;nbsp;Thank you for the explanation! I will stick with the RAND statement and will consider using the STREAMINIT option. Thanks for taking time to reply!&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2016 01:54:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/RANGAM-vs-RAND-quot-Gamma-quot/m-p/270246#M14216</guid>
      <dc:creator>jonesk48</dc:creator>
      <dc:date>2016-05-13T01:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: RANGAM vs. RAND("Gamma", )</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/RANGAM-vs-RAND-quot-Gamma-quot/m-p/270249#M14217</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp﻿&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for providing the link to Rick's article. I skimmed over it but will definitely read it thoroughly tomorrow. Appreciate you taking the time to respond to my question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Kendra&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2016 02:01:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/RANGAM-vs-RAND-quot-Gamma-quot/m-p/270249#M14217</guid>
      <dc:creator>jonesk48</dc:creator>
      <dc:date>2016-05-13T02:01:54Z</dc:date>
    </item>
  </channel>
</rss>

