<?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 generate random numbers? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814615#M40204</link>
    <description>&lt;P&gt;Do you have a closed form expression for the inverse of the CDF for your distribution?&amp;nbsp; &amp;nbsp;If so, generate a uniform random number for [0,1], and apply the inverse CDF to it.&lt;/P&gt;</description>
    <pubDate>Sun, 22 May 2022 15:50:19 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2022-05-22T15:50:19Z</dc:date>
    <item>
      <title>How generate random numbers?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814614#M40203</link>
      <description>&lt;P&gt;Hi!&amp;nbsp;I want to use a statistical frequency distribution, that is not fully supported by SAS.&lt;/P&gt;
&lt;P&gt;I know the exact functional expression.&lt;/P&gt;
&lt;P&gt;I can generate&amp;nbsp; random numbers, that are uniformly distributed, using RAND('UNIFORM',0,1).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My question: How can I generate random numbers with this frequency distribution?&lt;/P&gt;
&lt;P&gt;/Br Anders&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Anders Sköllermo&amp;nbsp; Ph.D.,&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;A href="mailto:anders.skollermo@one.se" target="_blank"&gt;anders.skollermo@one.se&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 22 May 2022 15:39:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814614#M40203</guid>
      <dc:creator>AndersS</dc:creator>
      <dc:date>2022-05-22T15:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: How generate random numbers?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814615#M40204</link>
      <description>&lt;P&gt;Do you have a closed form expression for the inverse of the CDF for your distribution?&amp;nbsp; &amp;nbsp;If so, generate a uniform random number for [0,1], and apply the inverse CDF to it.&lt;/P&gt;</description>
      <pubDate>Sun, 22 May 2022 15:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814615#M40204</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-05-22T15:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: How generate random numbers?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814618#M40205</link>
      <description>&lt;P&gt;Can you tell us what distribution or provide a link that defines the distribution?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hard to provide any significant suggestions without details.&lt;/P&gt;</description>
      <pubDate>Sun, 22 May 2022 18:02:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814618#M40205</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-05-22T18:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: How generate random numbers?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814620#M40206</link>
      <description>&lt;P&gt;Hi!&amp;nbsp; Many thanks!&amp;nbsp; &amp;nbsp; Yes I will sit down now and try it.&amp;nbsp; /Br Anders&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 May 2022 19:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814620#M40206</guid>
      <dc:creator>AndersS</dc:creator>
      <dc:date>2022-05-22T19:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: How generate random numbers?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814624#M40207</link>
      <description>&lt;P&gt;Hi!&amp;nbsp; &amp;nbsp;I tested the GUMBEL distribution. It worked nicely. Below is my SAS-proghram. I think that it is quite OK.&amp;nbsp;&lt;BR /&gt;The value of DIFF is zero. Many thanks. /Br Anders&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;*************************************************************;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;*** GUMBEL(0,1) - Quite OK ;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;*** GUMBEL(1,2) - Quite OK ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;*************************************************************;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;Data work.GUMBEL;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;CALL STREAMINIT(2);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;do I= 1 to 10;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;rvalue = RAND('GUMBEL',1,2);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;output;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;end;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Data work.MYGUMBEL;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;CALL STREAMINIT(2);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;do I= 1 to 10;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;myunif = RAND('UNIFORM',0,1);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;mygumbel = 1 - 2*LOG( -LOG(myunif) );&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;output;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;end;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;data work.diff;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;merge work.GUMBEL work.MYGUMBEL; by i;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;data work.diff;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;set work.diff;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;diff = rvalue - mygumbel;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;output;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 22 May 2022 20:24:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814624#M40207</guid>
      <dc:creator>AndersS</dc:creator>
      <dc:date>2022-05-22T20:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: How generate random numbers?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814692#M40209</link>
      <description>&lt;P&gt;This is called the "inverse CDF method" for simulating samples from a formula for the CDF. You can &lt;A href="https://blogs.sas.com/content/iml/2013/07/22/the-inverse-cdf-method.html" target="_self"&gt;read more about the inverse CDF method and how to implement it in SAS&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you do not have the formula, you can generate samples from the&amp;nbsp;empirical CDF. If you have the sull ECDF, this is called &lt;A href="https://blogs.sas.com/content/iml/2018/12/12/essential-guide-bootstrapping-sas.html" target="_self"&gt;bootstrapping&lt;/A&gt;. If you only have a summary of the CDF (such as published quantiles), you can &lt;A href="https://blogs.sas.com/content/iml/2014/06/18/distribution-from-quantiles.html" target="_self"&gt;approximate the ECDF from the quantiles.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 11:00:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814692#M40209</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-05-23T11:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: How generate random numbers?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814714#M40212</link>
      <description>&lt;P&gt;VERY GOOD reply by Rick!&amp;nbsp; Many Thanks!&amp;nbsp; / AndersS&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 13:58:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-generate-random-numbers/m-p/814714#M40212</guid>
      <dc:creator>AndersS</dc:creator>
      <dc:date>2022-05-23T13:58:11Z</dc:date>
    </item>
  </channel>
</rss>

