<?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: beta-binomial in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/beta-binomial/m-p/415467#M21797</link>
    <description>&lt;P&gt;I have recently written a blog post that shows how to compute essential&amp;nbsp;parts of the beta-binomial distribution.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/11/20/simulate-beta-binomial-sas.html" target="_self"&gt;Simulate beta-binomial data and compute the PDF&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/11/22/cdf-quantiles-discrete-distribution.html" target="_self"&gt;How to compute the CDF and quantile of a discrete distribution such as the beta-binomial&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Wed, 22 Nov 2017 11:08:46 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2017-11-22T11:08:46Z</dc:date>
    <item>
      <title>beta-binomial</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/beta-binomial/m-p/409671#M21381</link>
      <description>I am interested in beta binomial distribution. It is not included in SAS call functions and also CDF and inverse CDF. I have the following concerns about these functions: 1.How CDF of beta binomial distribution can be calculated in SAS (the steps or module are needed to have this function) such that when substitute n, x, eta1, and eta2, it gives the CDF value (“p”)? 2.How the inverse CDF of beta binomial distribution can be calculated in SAS (the steps are needed to have this function) such that when substitute n, eta1, eta2, and “p” it gives the inverse CDF value the (quantile)? Thank you</description>
      <pubDate>Wed, 01 Nov 2017 22:43:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/beta-binomial/m-p/409671#M21381</guid>
      <dc:creator>Abdelkarim</dc:creator>
      <dc:date>2017-11-01T22:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: beta-binomial</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/beta-binomial/m-p/409818#M21387</link>
      <description>&lt;P&gt;You are correct that there is not a built-in function for the CDF and quantile of the beta-binomial distribution. If you have SAS/IML, use that to implement the PDF, CDF, and quantile functions.&amp;nbsp;You could compute the CDF with the DATA step, but it will be easier in SAS/IML. The quantile computation is unwieldy in&amp;nbsp;Base SAS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a non-trivial task, so I assume you are proficient in both statistics and programming. The basic approach is this:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Review the concepts behind &lt;A href="https://blogs.sas.com/content/iml/2011/10/19/four-essential-functions-for-statistical-programmers.html" target="_self"&gt;the four essential functions for probability distributions&lt;/A&gt;. For a worked out example of a continuous distribution, see &lt;A href="https://blogs.sas.com/content/iml/2011/10/26/implement-the-folded-normal-distribution-in-sas.html" target="_self"&gt;the article on the folded normal distribution.&lt;/A&gt;&amp;nbsp; However, the beta-binomial is a DISCRETE probability distribution, so the integrals are replaced by sums.&lt;/LI&gt;
&lt;LI&gt;Use the formulas on &lt;A href="https://en.wikipedia.org/wiki/Beta-binomial_distribution" target="_self"&gt;the Wikipedia page on the beta-binomial distribution&lt;/A&gt;&amp;nbsp;to implement the PDF function. (Actually, computing the logPDF and then exponentiating is more stable numerically.)&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2015/03/04/approximate-cdf.html" target="_self"&gt;The CDF function is the cumulative sum of the PDF&lt;/A&gt;. That is, CDF(x) = sum( PDF(0:x) ).&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2012/03/07/quantiles-of-discrete-distributions.html" target="_self"&gt;The quantile function for a discrete distribution is not one to one&lt;/A&gt;. Thus the "inverse CDF" is not well defined. Instead, recall that "for discrete distributions, the quantile is the smallest value for which the CDF is greater than or equal to the given probability."&amp;nbsp; Therefore you can compute the&amp;nbsp;CDF function and then for any p &lt;A href="https://blogs.sas.com/content/iml/2011/05/16/finding-data-that-satisfy-a-criterion.html" target="_self"&gt;use the LOC function&lt;/A&gt; to find the smallest value of x for which p &amp;lt;= CDF(x).&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Study the articles that I have linked to and give it a try. If you get stuck, write back and include the code you&amp;nbsp;have written.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 13:43:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/beta-binomial/m-p/409818#M21387</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-11-02T13:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: beta-binomial</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/beta-binomial/m-p/415467#M21797</link>
      <description>&lt;P&gt;I have recently written a blog post that shows how to compute essential&amp;nbsp;parts of the beta-binomial distribution.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/11/20/simulate-beta-binomial-sas.html" target="_self"&gt;Simulate beta-binomial data and compute the PDF&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/11/22/cdf-quantiles-discrete-distribution.html" target="_self"&gt;How to compute the CDF and quantile of a discrete distribution such as the beta-binomial&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Wed, 22 Nov 2017 11:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/beta-binomial/m-p/415467#M21797</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-11-22T11:08:46Z</dc:date>
    </item>
  </channel>
</rss>

