<?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: simulating data from gamma and pareto distribution in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/simulating-data-from-gamma-and-pareto-distribution/m-p/377499#M65465</link>
    <description>&lt;P&gt;Yes, your Pareto simulation is identical to the one on p. 113 of &lt;A href="http://support.sas.com/publishing/authors/wicklin.html" target="_self"&gt;&lt;EM&gt;Simulating Data with SAS&lt;/EM&gt;&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;If you look at pp. 109-111, there is a section on "Adding Location and Scale Parameters."&lt;/P&gt;
&lt;P&gt;Just add the Theta value:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;X = Theta_Pareto + k / U**(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;/a);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similarly for the gamma simulation, use&lt;/P&gt;
&lt;P&gt;G = Theta_gamma + rand("gamma", &amp;lt;scale param here&amp;gt;);&lt;/P&gt;
&lt;P&gt;You can simulate it in the same DATA step that simulates the Pareto variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jul 2017 18:24:20 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2017-07-19T18:24:20Z</dc:date>
    <item>
      <title>simulating data from gamma and pareto distribution</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/simulating-data-from-gamma-and-pareto-distribution/m-p/377163#M65438</link>
      <description>&lt;P&gt;I am working on modeling data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;By using "Proc univariate" to fit data, distribution&amp;nbsp;that I get is Gamma with theta=60500&amp;nbsp;and Pareto with theta=300000.&lt;/P&gt;&lt;P&gt;then,&amp;nbsp;I simulate data from these distributions by&amp;nbsp;using code as follow:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; N=3500;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; NumSamples = 120;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; simu.pareto1(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;keep&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=ID X);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ID = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;NumSamples;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;a = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0.383045&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;k = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;222548.1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; streaminit(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1234&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; i = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;N;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;U = rand(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Uniform"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;X = k / U**(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;/a);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;output&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the output seems&amp;nbsp;deviate from&amp;nbsp;the fitted data quite much.&amp;nbsp; I'm not sure&amp;nbsp;if it's relevant with the unspecify theta on my code or not?&lt;/P&gt;&lt;P&gt;If yes, please let me know the code for simulation with specify theta (for both Gamma and Pareto).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 02:37:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/simulating-data-from-gamma-and-pareto-distribution/m-p/377163#M65438</guid>
      <dc:creator>Peaw</dc:creator>
      <dc:date>2017-07-19T02:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: simulating data from gamma and pareto distribution</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/simulating-data-from-gamma-and-pareto-distribution/m-p/377207#M65441</link>
      <description>&lt;P&gt;You can simulate some random variate Y with threshold parameter theta (and possibly a scale parameter sigma, by using the RAND function as you do to create the standard variate X and then create Y = theta + sigma * X.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your way of simulating a standard Pareto looks good if you want to do this in a datastep, since the RAND function does not support the Pareto distribution. The RANDGEN function in SAS/IML &lt;EM&gt;does &lt;/EM&gt;however support it, so you can do it directly there. The&amp;nbsp;RAND function also supports the Gamma distribution, so simply simulate a Gamma random variate and apply the transformation above.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 08:50:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/simulating-data-from-gamma-and-pareto-distribution/m-p/377207#M65441</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-07-19T08:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: simulating data from gamma and pareto distribution</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/simulating-data-from-gamma-and-pareto-distribution/m-p/377499#M65465</link>
      <description>&lt;P&gt;Yes, your Pareto simulation is identical to the one on p. 113 of &lt;A href="http://support.sas.com/publishing/authors/wicklin.html" target="_self"&gt;&lt;EM&gt;Simulating Data with SAS&lt;/EM&gt;&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;If you look at pp. 109-111, there is a section on "Adding Location and Scale Parameters."&lt;/P&gt;
&lt;P&gt;Just add the Theta value:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;X = Theta_Pareto + k / U**(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;/a);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similarly for the gamma simulation, use&lt;/P&gt;
&lt;P&gt;G = Theta_gamma + rand("gamma", &amp;lt;scale param here&amp;gt;);&lt;/P&gt;
&lt;P&gt;You can simulate it in the same DATA step that simulates the Pareto variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 18:24:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/simulating-data-from-gamma-and-pareto-distribution/m-p/377499#M65465</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-07-19T18:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: simulating data from gamma and pareto distribution</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/simulating-data-from-gamma-and-pareto-distribution/m-p/378910#M65552</link>
      <description>&lt;P&gt;Thank you very much for your kind suggestion above.&lt;/P&gt;&lt;P&gt;However, after I did as per your suggestion, I found out many issues as following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;First of all, please let me clarify you that the data range of this fitted Pareto distribution is 300,000-800,000 (with theta =300,000). And then I simulated Pareto distribution without identifying theta.&lt;/LI&gt;&lt;LI&gt;After I used the coding to add theta as per your suggestion, I think that the output statistic seems worse. Kindly find the compared statistic as below details:&lt;P&gt;Fitting Pareto distribution -&amp;gt; output1&lt;/P&gt;&lt;P&gt;Simulation without theta -&amp;gt; output2 (after cut off data, so the data range of is 300,000-800,000)&lt;/P&gt;&lt;P&gt;Simulation with theta -&amp;gt; output3 (after cut off data, so the data range of is 300,000-800,000)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;As you can see that, the statistic of simulation with theta are different from the fitted Pareto quite much. I am not sure if these output are acceptable or not? If not, please let have your further suggestion.&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/14135iE7B226E204190BFF/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="output2.JPG" title="output2.JPG" /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/14136i39A08552907584F7/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="output1.jpg" title="output1.jpg" /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/14137iCA7C93A23A223DDE/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="output3.JPG" title="output3.JPG" /&gt;</description>
      <pubDate>Tue, 25 Jul 2017 08:55:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/simulating-data-from-gamma-and-pareto-distribution/m-p/378910#M65552</guid>
      <dc:creator>Peaw</dc:creator>
      <dc:date>2017-07-25T08:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: simulating data from gamma and pareto distribution</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/simulating-data-from-gamma-and-pareto-distribution/m-p/379015#M65554</link>
      <description>&lt;P&gt;1. If you want us to match data, you need to supply some sample data in the form of a SAS DATA step. &amp;nbsp;It is difficult to guess what difficulties you might be having without a common set of data&amp;nbsp;that everyone can run.&lt;/P&gt;
&lt;P&gt;2. Numerically speaking, I would suggest measuring units in thousands, so that your data are&amp;nbsp;&lt;SPAN&gt;300-800 (with theta =300). This is likely to be more robust.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 14:14:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/simulating-data-from-gamma-and-pareto-distribution/m-p/379015#M65554</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-07-25T14:14:27Z</dc:date>
    </item>
  </channel>
</rss>

