<?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: Code to generate random numbers from a Fretchet Distribution in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Code-to-generate-random-numbers-from-a-Fretchet-Distribution/m-p/945288#M370374</link>
    <description>Calling &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;</description>
    <pubDate>Thu, 26 Sep 2024 01:38:41 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2024-09-26T01:38:41Z</dc:date>
    <item>
      <title>Code to generate random numbers from a Fretchet Distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-generate-random-numbers-from-a-Fretchet-Distribution/m-p/945179#M370313</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking for SAS code to generate random numbers from a&amp;nbsp;Fretchet Distribution (I have the shape and scale parameters), similar to the below using a Weibull distribution. Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;rand('WEIB',x,y);&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 11:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-generate-random-numbers-from-a-Fretchet-Distribution/m-p/945179#M370313</guid>
      <dc:creator>karu05</dc:creator>
      <dc:date>2024-09-25T11:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Code to generate random numbers from a Fretchet Distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-generate-random-numbers-from-a-Fretchet-Distribution/m-p/945190#M370315</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/469941"&gt;@karu05&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the parameterization from the &lt;A href="https://en.wikipedia.org/wiki/Fr%C3%A9chet_distribution" target="_blank" rel="noopener"&gt;Wikipedia article "Fréchet distribution"&lt;/A&gt; -- with shape parameter &lt;FONT face="courier new,courier"&gt;a&lt;/FONT&gt;, scale parameter &lt;FONT face="courier new,courier"&gt;s&lt;/FONT&gt;&amp;nbsp;and location parameter &lt;FONT face="courier new,courier"&gt;m=0&lt;/FONT&gt; -- you can use:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;rand('extrvalue',s,s/a,1/a)&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;if the parameter values meet the criteria stated in the RAND function documentation &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0fpeei0opypg8n1b06qe4r040lv.htm#n1a2snf5papr9fn1we2ghk8zmvol" target="_blank" rel="noopener"&gt;Extreme Value Distribution&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 13:10:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-generate-random-numbers-from-a-Fretchet-Distribution/m-p/945190#M370315</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-09-25T13:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Code to generate random numbers from a Fretchet Distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-generate-random-numbers-from-a-Fretchet-Distribution/m-p/945288#M370374</link>
      <description>Calling &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;</description>
      <pubDate>Thu, 26 Sep 2024 01:38:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-generate-random-numbers-from-a-Fretchet-Distribution/m-p/945288#M370374</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-09-26T01:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Code to generate random numbers from a Fretchet Distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-generate-random-numbers-from-a-Fretchet-Distribution/m-p/945335#M370386</link>
      <description>&lt;P&gt;Thank you for your answer&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;. Sorry but could you kindly elaborate the parameters in your solution [&lt;FONT size="4"&gt;rand('extrvalue',s,s/a,1/a)]&amp;nbsp;&lt;/FONT&gt;as to why s/a (scale/shape), 1/a (1/shape).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would it be incorrect to just directly use the location, scale and shape parameters in the formula for example:&lt;/P&gt;&lt;P&gt;rand&amp;nbsp;&lt;FONT size="4"&gt;('extrvalue', location- 75000', Scale - 300000, shape- 1.3);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 14:45:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-generate-random-numbers-from-a-Fretchet-Distribution/m-p/945335#M370386</guid>
      <dc:creator>karu05</dc:creator>
      <dc:date>2024-09-26T14:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: Code to generate random numbers from a Fretchet Distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-generate-random-numbers-from-a-Fretchet-Distribution/m-p/945343#M370388</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/469941"&gt;@karu05&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;(...) could you kindly elaborate the parameters in your solution [&lt;FONT size="4"&gt;rand('extrvalue',s,s/a,1/a)] ...&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Put &lt;FONT face="symbol"&gt;m&lt;/FONT&gt;=s, &lt;FONT face="symbol"&gt;s&lt;/FONT&gt;=s/&lt;FONT face="symbol"&gt;a&lt;/FONT&gt; and &lt;FONT face="symbol"&gt;x&lt;/FONT&gt;=1/&lt;FONT face="symbol"&gt;a&lt;/FONT&gt; into the formula of the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0fpeei0opypg8n1b06qe4r040lv.htm#n1a2snf5papr9fn1we2ghk8zmvol" target="_blank" rel="noopener"&gt;RAND 'EXTRVALUE' function documentation&lt;/A&gt;, simplify the result (which is easy) and you'll get&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;EM&gt;F&lt;/EM&gt;(&lt;EM&gt;x&lt;/EM&gt;) = exp(−(&lt;EM&gt;x&lt;/EM&gt;/s)&lt;SUP&gt;−&lt;FONT face="symbol"&gt;a&lt;/FONT&gt;&lt;/SUP&gt;)&amp;nbsp; &amp;nbsp;for &lt;EM&gt;x&amp;nbsp;&lt;/EM&gt;&amp;gt; 0&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;as the cumulative distribution function (CDF). This matches exactly the formula from &lt;A href="https://en.wikipedia.org/wiki/Fr%C3%A9chet_distribution" target="_blank" rel="noopener"&gt;Wikipedia&lt;/A&gt;&amp;nbsp;for &lt;EM&gt;m&lt;/EM&gt; = 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(Also, I had checked the results of a simulation of ten million random numbers using my suggested code [with &lt;FONT face="courier new,courier"&gt;a=3&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;s=2&lt;/FONT&gt;] before posting it: computed three probabilities, the mean and standard deviation and created a histogram. Everything was in agreement with the results computed from the Wikipedia formulas and the density curve shown there, respectively.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/469941"&gt;@karu05&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Would it be incorrect to just directly use the location, scale and shape parameters in the formula ...&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note that the SAS documentation and the Wikipedia article use &lt;EM&gt;different parameterizations&lt;/EM&gt; of that CDF: Each of the three parameters -- location, scale and shape -- is defined differently in the two sources and there might be even more variants of the formula in the literature. So, before using "the"&amp;nbsp;location, scale and shape parameters 75000, 300000 and 1.3 in either formula, you must check very carefully what parameterization is appropriate for these numbers. Otherwise, you could obtain totally wrong results.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 16:05:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-generate-random-numbers-from-a-Fretchet-Distribution/m-p/945343#M370388</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-09-26T16:05:58Z</dc:date>
    </item>
  </channel>
</rss>

