<?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: Monte Carlo and Bootstrap Simulation in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421290#M22166</link>
    <description>&lt;P&gt;If you haven't already, you should review Rick Wicklin's articles about simulation, including this one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2014/04/30/simulating-from-the-inverse-gamma-distribution-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2014/04/30/simulating-from-the-inverse-gamma-distribution-in-sas.html&lt;/A&gt; (that's inverse Gamma, I know)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the whole collection of them here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/tag/simulation/" target="_blank"&gt;https://blogs.sas.com/content/tag/simulation/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Also...your code, as shared, is incorrect (syntax errors). This creates the sample you want, I think.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample (keep=x);
	sims=1000;
	size= 20;
	a=3;
	do i=1 to sims;
		do k=1 to size;
			x=RAND('GAMMA',a);
			output;
		end;
	end;
run;

proc sgplot data=sample;
 histogram x;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 14 Dec 2017 18:42:08 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2017-12-14T18:42:08Z</dc:date>
    <item>
      <title>Monte Carlo and Bootstrap Simulation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421276#M22161</link>
      <description>&lt;P&gt;I don't know the code for gamma distribution. I started off with this below, but I don't know where to go from there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data proc iml;&lt;BR /&gt;sims=1000; *this is for the outer loop that says how many times the simulation is repeated;&lt;BR /&gt;size= 20; *this is the size of each simulated sample;&lt;BR /&gt;a=3;*parameters needed;&lt;BR /&gt;do i=1 to sims;&lt;BR /&gt;free sample;&lt;BR /&gt;do k=1 to size;&lt;BR /&gt;sample=RAND('GAMMA',a);&lt;BR /&gt;end;&lt;BR /&gt;print sample;&lt;BR /&gt;end&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Monte Carlo and Boot Strap Simulation.jpg" style="width: 450px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17246i6477BB2C104EA5D5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Monte Carlo and Boot Strap Simulation.jpg" alt="Monte Carlo and Boot Strap Simulation.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 17:59:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421276#M22161</guid>
      <dc:creator>mickir1</dc:creator>
      <dc:date>2017-12-14T17:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Monte Carlo and Bootstrap Simulation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421279#M22162</link>
      <description>&lt;P&gt;We don't do your homework for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you go ahead and generate code to attempt to solve this problem, and it doesn't work and you can't figure out why, then we can help you fix your code and even suggest better approaches.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 18:05:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421279#M22162</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-12-14T18:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Monte Carlo and Bootstrap Simulation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421280#M22163</link>
      <description>I’m not asking you to do my homework, I’m asking for help figuring out the gamma distribution part.&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Dec 2017 18:10:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421280#M22163</guid>
      <dc:creator>mickir1</dc:creator>
      <dc:date>2017-12-14T18:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Monte Carlo and Bootstrap Simulation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421285#M22164</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182658"&gt;@mickir1&lt;/a&gt; wrote:&lt;BR /&gt;I’m not asking you to do my homework, I’m asking for help figuring out the gamma distribution part.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's an extremely broad question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you be much more specific about what you don't understand?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 18:28:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421285#M22164</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-12-14T18:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Monte Carlo and Bootstrap Simulation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421289#M22165</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182658"&gt;@mickir1&lt;/a&gt; wrote:&lt;BR /&gt;I’m not asking you to do my homework, I’m asking for help figuring out the gamma distribution part.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Are you getting errors? Post the code and errors from the log into a code box opened with the forum {I} menu icon. The code box is important to retain formatting of error messages that may provide hints.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 18:31:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421289#M22165</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-12-14T18:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Monte Carlo and Bootstrap Simulation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421290#M22166</link>
      <description>&lt;P&gt;If you haven't already, you should review Rick Wicklin's articles about simulation, including this one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2014/04/30/simulating-from-the-inverse-gamma-distribution-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2014/04/30/simulating-from-the-inverse-gamma-distribution-in-sas.html&lt;/A&gt; (that's inverse Gamma, I know)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the whole collection of them here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/tag/simulation/" target="_blank"&gt;https://blogs.sas.com/content/tag/simulation/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Also...your code, as shared, is incorrect (syntax errors). This creates the sample you want, I think.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample (keep=x);
	sims=1000;
	size= 20;
	a=3;
	do i=1 to sims;
		do k=1 to size;
			x=RAND('GAMMA',a);
			output;
		end;
	end;
run;

proc sgplot data=sample;
 histogram x;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Dec 2017 18:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421290#M22166</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-12-14T18:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Monte Carlo and Bootstrap Simulation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421445#M22169</link>
      <description>&lt;P&gt;3 things:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) You write "data proc IML" in the top of your code.&amp;nbsp;But from your syntax and your note "PROC IML" in your assignment, I'm guessing you want to use PROC IML. In that case, whenever you can vectorize instead of using a loop, vectorize instead of using a loop. Like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
   sims=1000;
   size=20;
   SimM=j(size, sims, 0);
   call randgen(SimM, "Gamma", 3);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This gives you a&amp;nbsp;20x1000 matrix of random variates from the Gamma distribution. This gives you a nice basis to calculate the statistics you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Udklip.PNG" style="width: 187px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17289iED4B659E4F7197AF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Udklip.PNG" alt="Udklip.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It is not due until monday, so you've got plenty of time to......&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Consult&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;' blog &lt;A href="https://blogs.sas.com/content/iml/" target="_self"&gt;The DO Loop&lt;/A&gt;. Also, his book &lt;A href="https://www.sas.com/store/books/categories/usage-and-reference/simulating-data-with-sas-/prodBK_65378_en.html" target="_self"&gt;Simulating Data With SAS&lt;/A&gt; is filled with theory and examples on the topic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2017 10:23:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421445#M22169</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-15T10:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: Monte Carlo and Bootstrap Simulation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421480#M22170</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;&amp;nbsp;has provided DATA step code that will generate 1000 samples from the Gamma(2) distribution, but please modify his code to use&lt;/P&gt;
&lt;P&gt;(KEEP=i x)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each sample is size 20. The variable 'i' in the output data can be used to index each sample. For example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample (keep=i x);
	sims=1000;
	size= 20;
	a=3;
	do i=1 to sims;
		do k=1 to size;
			x=RAND('GAMMA',a);
			output;
		end;
	end;
run;

proc sgplot data=sample;
 WHERE i=1;   /* plot first sample */
 histogram x;
run;
proc sgplot data=sample;
 WHERE i=2;   /* plot second sample */
 histogram x;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I assume your teacher taught about BY-group processing for efficiently analyzing each sample. Either that or he/she taught you to use a macro loop. Both methods are described in &lt;A href="https://blogs.sas.com/content/iml/2012/07/18/simulation-in-sas-the-slow-way-or-the-by-way.html" target="_self" data-mce-fragment="1"&gt;"Simulation in SAS: The slow way or the BY way ."&lt;/A&gt;&lt;SPAN&gt;_ Use whichever way was taught.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2017 10:47:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Monte-Carlo-and-Bootstrap-Simulation/m-p/421480#M22170</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-12-15T10:47:11Z</dc:date>
    </item>
  </channel>
</rss>

