<?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: Proc MCMC: dirichlet random variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-MCMC-dirichlet-random-variable/m-p/604547#M175287</link>
    <description>&lt;P&gt;Did you try BY group processing?&lt;/P&gt;
&lt;P&gt;BY ID;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;would be my first approach if I needed output for each level of ID.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Nov 2019 17:06:47 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-11-15T17:06:47Z</dc:date>
    <item>
      <title>Proc MCMC: dirichlet random variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-MCMC-dirichlet-random-variable/m-p/604389#M175226</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems dirichlet distributions are not allowed for the random statement in Proc MCMC, so I used gamma distributions instead.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc MCMC Data=mydata;

   array delta[3] delta1 delta2 delta3;
   array p[3] p1 p2 p3;

   model  .........

   random delta1 ~ gamma(0.1, iscale=0.1) subject = ID ;
   random delta2 ~ gamma(0.1, iscale=0.1) subject = ID ;
   random delta3 ~ gamma(0.1, iscale=0.1) subject = ID ;

   p1 = delta1/sum(delta1, delta2, delta3); 
   p2 = delta2/sum(delta1, delta2, delta3);
   p3 = 1 - p1 - p2;

Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I expected that &lt;STRONG&gt;every ID&lt;/STRONG&gt; should have its own post-distribution/summary of &lt;STRONG&gt;p&lt;/STRONG&gt;, but SAS just generated a summary of p for the whole group.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could compute the &lt;STRONG&gt;p&lt;/STRONG&gt; from the results of &lt;STRONG&gt;delta&lt;/STRONG&gt;&amp;nbsp;for each ID afterward. But is it possible to obtain &lt;STRONG&gt;p&lt;/STRONG&gt; directly from Proc MCMC?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 04:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-MCMC-dirichlet-random-variable/m-p/604389#M175226</guid>
      <dc:creator>csfcgua1</dc:creator>
      <dc:date>2019-11-15T04:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc MCMC: dirichlet random variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-MCMC-dirichlet-random-variable/m-p/604547#M175287</link>
      <description>&lt;P&gt;Did you try BY group processing?&lt;/P&gt;
&lt;P&gt;BY ID;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;would be my first approach if I needed output for each level of ID.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 17:06:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-MCMC-dirichlet-random-variable/m-p/604547#M175287</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-15T17:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: Proc MCMC: dirichlet random variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-MCMC-dirichlet-random-variable/m-p/604858#M175411</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Yes. I thought about using BY at first, but I immediately realized that ALL of the &amp;nbsp;parameters would be estimated by ID, which is not necessary.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 00:16:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-MCMC-dirichlet-random-variable/m-p/604858#M175411</guid>
      <dc:creator>csfcgua1</dc:creator>
      <dc:date>2019-11-18T00:16:45Z</dc:date>
    </item>
  </channel>
</rss>

