<?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: Binomial mixture model and gradient function in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Binomial-mixture-model-and-gradient-function/m-p/782043#M38419</link>
    <description>&lt;P&gt;I can't guarantee that this is the issue but the syntax should be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;value = pdf('BINOMIAL', number_of_successes, probability_of_success, number_of_independent_trials)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just looking at the values in the NOTEs, I would guess that you have switched the first and last values, as the line of data always has Number strictly greater than Ntarget.&amp;nbsp; Try exchanging the two variables in your call to the PDF function.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Nov 2021 18:31:06 GMT</pubDate>
    <dc:creator>SteveDenham</dc:creator>
    <dc:date>2021-11-23T18:31:06Z</dc:date>
    <item>
      <title>Binomial mixture model and gradient function</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Binomial-mixture-model-and-gradient-function/m-p/781486#M38381</link>
      <description>&lt;P&gt;I'm trying to fit finite binomial mixture with 4 components. I have problem with the plot of the gradient function which must be equal or less than 1 in the interval of possible support points but equal to one for&amp;nbsp; the identified support points of the components. Number is the size of the trial and ntarget are the cured patients. The trick here is the different size of each trial.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65952iB870E94037DFBD03/image-size/medium?v=v2&amp;amp;px=400" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This was my code for the gradient function (with support points and their weights in the mixture):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data data1; set data; do p=0 to 1 by 0.01; output; end; run;&lt;BR /&gt;data data2; set data1;&lt;BR /&gt;gradient4 = pdf('BINOM', ntarget, p,number) /&lt;BR /&gt;(0.263327842*pdf('BINOM', ntarget, 0.7978980, number) + 0.005551754*pdf('BINOM', ntarget, 0.5080765, number)+0.050572356*pdf('BINOM', ntarget, 0.5080765, number)+ 0.680548048*pdf('BINOM', ntarget, 0.6291304, number));&lt;/P&gt;&lt;P&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I get this message which I don't understand:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65953i21E7AF31571AFEEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2.png" alt="2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;and the plot for the gradient function which does not prove that the 4 components are NPML :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65954iB572E83954B5543B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="3.png" alt="3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; Could you please explain the error I got up there and if the gradient function is correctly specified.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sat, 20 Nov 2021 18:37:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Binomial-mixture-model-and-gradient-function/m-p/781486#M38381</guid>
      <dc:creator>Job04</dc:creator>
      <dc:date>2021-11-20T18:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Binomial mixture model and gradient function</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Binomial-mixture-model-and-gradient-function/m-p/782043#M38419</link>
      <description>&lt;P&gt;I can't guarantee that this is the issue but the syntax should be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;value = pdf('BINOMIAL', number_of_successes, probability_of_success, number_of_independent_trials)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just looking at the values in the NOTEs, I would guess that you have switched the first and last values, as the line of data always has Number strictly greater than Ntarget.&amp;nbsp; Try exchanging the two variables in your call to the PDF function.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 18:31:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Binomial-mixture-model-and-gradient-function/m-p/782043#M38419</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2021-11-23T18:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Binomial mixture model and gradient function</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Binomial-mixture-model-and-gradient-function/m-p/782504#M38436</link>
      <description>&lt;P&gt;I interchanged those values but I got nothing. I see the gradient function is correctly specified. I think the errors are results of zero in denominator. For certain values the probability of assigning the successes to each component is zero . I run an equivalent code in R and I got the entire output for the numerator and denominator. I can see there are several zeros for the dominators. R stops there but SAS treats errors as missing values and imput them.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Nov 2021 07:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Binomial-mixture-model-and-gradient-function/m-p/782504#M38436</guid>
      <dc:creator>Job04</dc:creator>
      <dc:date>2021-11-26T07:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Binomial mixture model and gradient function</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Binomial-mixture-model-and-gradient-function/m-p/782910#M38442</link>
      <description>&lt;P&gt;What function you are trying to compute the gradient of?&amp;nbsp; And which parameters are you using to compute the gradient?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Often we use a log-likelihood function and compute the gradient with respect to the parameters of the distribution that we are fitting, but I cannot tell what you are computing here.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2021 13:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Binomial-mixture-model-and-gradient-function/m-p/782910#M38442</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-11-29T13:49:57Z</dc:date>
    </item>
  </channel>
</rss>

