<?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: Conver R function qpoisbinom into SAS in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/684174#M32949</link>
    <description>&lt;P&gt;The OP says he doesn't have SAS/IML and only wants a solution that uses Base SAS and SAS/STAT. I do not know how to solve this problem without using IML.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Sep 2020 12:01:27 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2020-09-16T12:01:27Z</dc:date>
    <item>
      <title>Conver R function qpoisbinom into SAS</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/683716#M32922</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;I'm recoding some R code into SAS and I'm struggling with the R function&amp;nbsp;qpoisbinom (&lt;A href="https://cran.r-project.org/web/packages/poisbinom/poisbinom.pdf" target="_self"&gt;ref here&lt;/A&gt;). This function simply takes in input a vector of quantiles and a distribution of values. This is how it is called:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;p_values = qpoisbinom(p = c(0.025, 0.975), pp = Estimated_Values)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;The outputs are 2 values (that should be the p_values). My Estimated_Values is a column with all my estimated values of a probability (i.e. belonging to [0,1])&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually i cant find in SAS a way to replicate this code. I tried&amp;nbsp;CDF function, squantile and&amp;nbsp;quantile functions,&amp;nbsp;PROBT and so on.&lt;/P&gt;&lt;P&gt;I think a good way to proceed could be to fit my values with a Poisson model and then, accordingly with quantiles 0.025 and 0.975, calculate the p-value.&lt;/P&gt;&lt;P&gt;I don't have the SAS IML licence so only SAS Base/STAT programming is admitted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached the estimated values.&lt;/P&gt;&lt;P&gt;Thanks a lot for your help,&lt;/P&gt;&lt;P&gt;Gabriele&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 16:58:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/683716#M32922</guid>
      <dc:creator>KingRoger19</dc:creator>
      <dc:date>2020-09-14T16:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Conver R function qpoisbinom into SAS</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/683941#M32936</link>
      <description>&lt;P&gt;If I was right .&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp; wrote a blog about it before .&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 12:32:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/683941#M32936</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-09-15T12:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: Conver R function qpoisbinom into SAS</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/683999#M32942</link>
      <description>Hi Ksharp, thanks for your time. Yes I found something like this &lt;A href="https://blogs.sas.com/content/iml/2012/04/04/fitting-a-poisson-distribution-to-data-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2012/04/04/fitting-a-poisson-distribution-to-data-in-sas.html&lt;/A&gt; but when he computes the fitted density I stuck myself 'cause my list of values are in [0,1].</description>
      <pubDate>Tue, 15 Sep 2020 16:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/683999#M32942</guid>
      <dc:creator>KingRoger19</dc:creator>
      <dc:date>2020-09-15T16:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Conver R function qpoisbinom into SAS</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/684168#M32948</link>
      <description>Sorry. My memory is not right . It should be Possion-Gamma distribution.&lt;BR /&gt;And the blog you refer to has nothing to do with your question.&lt;BR /&gt;Maybe &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt; would answer your question.</description>
      <pubDate>Wed, 16 Sep 2020 11:23:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/684168#M32948</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-09-16T11:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Conver R function qpoisbinom into SAS</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/684174#M32949</link>
      <description>&lt;P&gt;The OP says he doesn't have SAS/IML and only wants a solution that uses Base SAS and SAS/STAT. I do not know how to solve this problem without using IML.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 12:01:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/684174#M32949</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-09-16T12:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Conver R function qpoisbinom into SAS</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/684228#M32955</link>
      <description>&lt;P&gt;First of all, thanks for your reply Rick. This is not a good spot... Do you think it is not feasible at all or there could be a difficult way to do that? Actually I still don't want to say to the client this is &lt;SPAN&gt;undoable&amp;nbsp;&lt;/SPAN&gt;so I'd like to find a way. The problem is that I can not even identify the starting point...&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 14:16:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/684228#M32955</guid>
      <dc:creator>KingRoger19</dc:creator>
      <dc:date>2020-09-16T14:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Conver R function qpoisbinom into SAS</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/684242#M32956</link>
      <description>&lt;P&gt;Would the "refined normal approximation" method outlined in this paper&amp;nbsp;&lt;A title="A Note on the Poisson's Binomial Distribution in Item Response Theory" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5978503/" target="_blank" rel="noopener"&gt;https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5978503/&lt;/A&gt;&amp;nbsp; be applicable to your situation?&amp;nbsp; The algorithm appears relatively uncomplicated and depends on the CDF of the normal.distribution.&amp;nbsp; It would take some programming, but all of the tools are available in Base SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 14:39:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/684242#M32956</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2020-09-16T14:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: Conver R function qpoisbinom into SAS</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/684248#M32957</link>
      <description>&lt;P&gt;I had never heard of the Poisson-binomial distribution before today and I have only skimmed the Hong (2013) paper. But I have worked with other not-so-well-known distributions such as the beta-binomial distribution. &lt;A href="https://blogs.sas.com/content/iml/2017/11/22/cdf-quantiles-discrete-distribution.html" target="_self"&gt;The computations for the CDF and quantiles&lt;/A&gt; are easier when you have access to the right set of tools.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it is feasible to solve without IML? I suppose that depends on how much you know, how good a programmer you are, and how much time you are willing to invest. You can build beautiful furniture by using hand tools, but power tools will make the job go a lot faster and easier. PROC IML provides power tools.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As to a starting point, I would start from Hong's paper. He mentions several approximate methods that are feasible in SAS/STAT and the RF1 method (Eqn 9) looks tractable in the DATA step. Since your n is large, you could also use the refined normal approximation, which looks easy to implement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2020 15:47:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/684248#M32957</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-09-26T15:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Conver R function qpoisbinom into SAS</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/689489#M33241</link>
      <description>&lt;P&gt;This might not help the OP, but to future SAS programmers who are searching for the Poisson-binomial distribution in SAS, I have written a few articles about it, based on the paper that the OP posted:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2020/09/28/poisson-binomial-distribution.html" target="_self"&gt;An introduction to the Poisson-binomial distribution&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2020/09/30/pdf-cdf-quantiles-poisson-binomial.html" target="_self"&gt;Density, CDF, and quantiles for the Poisson-binomial distribution (exact method)&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2020/10/07/poisson-binomial-hundreds-of-parameters.html" target="_self"&gt;The Poisson-binomial distribution for hundreds of parameters (approximate method)&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;All the articles use PROC IML. As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15363"&gt;@SteveDenham&lt;/a&gt;&amp;nbsp;mentions, the RNA (discussed in the third article) is your best bet for an approximation in Base SAS. You can use PROC MEANS to get the mean, std dev, and skewness of the parameters, save those values in macro variables, and then use a DATA step to compute the CDF and PDF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to get the quantile function in Base SAS is less clear. Maybe the simplest (and easiest) way is to throw out the paper and use Monte Carlo: Simulate 100,000 observations from the P-b distrib and use the empirical quantiles.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2020 09:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Conver-R-function-qpoisbinom-into-SAS/m-p/689489#M33241</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-10-07T09:44:51Z</dc:date>
    </item>
  </channel>
</rss>

