<?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 Proc Freq Exact binomial Test p-value in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893703#M44280</link>
    <description>&lt;P&gt;when i do the Exact Binomial Test with PROC FREQ (H0: P&amp;lt;=P0, H1: P&amp;gt;P0), i can obtain the p-value as:&lt;/P&gt;&lt;P&gt;One-sided Pr &amp;lt;= P&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;One-sided Pr &amp;gt;= P&amp;nbsp;&lt;/P&gt;&lt;P&gt;depending on the Z statistics value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;having doing some checks with other softwares, i need to use&amp;nbsp;One-sided Pr &amp;gt;= P but&amp;nbsp;One-sided Pr &amp;gt;= P&amp;nbsp; is not equal to 1 -&amp;nbsp;One-sided Pr &amp;lt;= P because the part of the "=" is included in both p-values.&lt;/P&gt;&lt;P&gt;1) So is there a way to force SAS to always present the p-value in the same way (i.e. always&amp;nbsp;One-sided Pr &amp;gt;= P for example)?&lt;/P&gt;&lt;P&gt;2) if you are interested by "One-sided Pr &amp;gt;= P", how do you manage to have the correct p-value because when i have the p-value "One-sided Pr &amp;lt;= P", i cannot simply do "1-One-sided Pr &amp;lt;= P".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2023 06:27:30 GMT</pubDate>
    <dc:creator>AudreyM</dc:creator>
    <dc:date>2023-09-12T06:27:30Z</dc:date>
    <item>
      <title>Proc Freq Exact binomial Test p-value</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893703#M44280</link>
      <description>&lt;P&gt;when i do the Exact Binomial Test with PROC FREQ (H0: P&amp;lt;=P0, H1: P&amp;gt;P0), i can obtain the p-value as:&lt;/P&gt;&lt;P&gt;One-sided Pr &amp;lt;= P&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;One-sided Pr &amp;gt;= P&amp;nbsp;&lt;/P&gt;&lt;P&gt;depending on the Z statistics value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;having doing some checks with other softwares, i need to use&amp;nbsp;One-sided Pr &amp;gt;= P but&amp;nbsp;One-sided Pr &amp;gt;= P&amp;nbsp; is not equal to 1 -&amp;nbsp;One-sided Pr &amp;lt;= P because the part of the "=" is included in both p-values.&lt;/P&gt;&lt;P&gt;1) So is there a way to force SAS to always present the p-value in the same way (i.e. always&amp;nbsp;One-sided Pr &amp;gt;= P for example)?&lt;/P&gt;&lt;P&gt;2) if you are interested by "One-sided Pr &amp;gt;= P", how do you manage to have the correct p-value because when i have the p-value "One-sided Pr &amp;lt;= P", i cannot simply do "1-One-sided Pr &amp;lt;= P".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 06:27:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893703#M44280</guid>
      <dc:creator>AudreyM</dc:creator>
      <dc:date>2023-09-12T06:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Exact binomial Test p-value</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893733#M44281</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/437804"&gt;@AudreyM&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could do a trick and actually perform a non-inferiority test with margin zero. PROC FREQ doesn't allow margin zero, so use an extremely small positive margin, e.g., 1E-99.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;* Create sample data for demonstration */

data have;
do i=1 to 20;
  x=(i&amp;gt;9);
  output;
end;
run;

/* Compute exact p-value for H0: P&amp;lt;=0.6 vs. H1: P&amp;gt;0.6 */

proc freq data=have;
tables x / binomial(level='1' p=0.6 &lt;FONT size="3" color="#3366FF"&gt;&lt;STRONG&gt;noninf margin=1e-99&lt;/STRONG&gt;&lt;/FONT&gt;);
exact binomial;
run;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;                Noninferiority Analysis

     H0: P - p0 &amp;lt;= -Margin    Ha: P - p0 &amp;gt; -Margin

               p0 = 0.6   Margin = 1E-99

Proportion         ASE                        &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;   Exact&lt;/STRONG&gt;&lt;/FONT&gt;
       (P)    (Sample)          Z    Pr &amp;gt; Z   &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt; Pr &amp;gt;= P&lt;/STRONG&gt;&lt;/FONT&gt;

    0.5500      0.1112    -0.4495    0.6735     &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;0.7553&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just to confirm the result:&lt;/P&gt;
&lt;PRE&gt;data _null_;
p=sdf('binom',10,0.6,20);
put p= best16.;
run;&lt;/PRE&gt;
&lt;PRE&gt;p=0.75533720331639&lt;/PRE&gt;
&lt;P&gt;To extend the check beyond the fourth decimal, add&lt;/P&gt;
&lt;PRE&gt;ods output binomialnoninf=bt;&lt;/PRE&gt;
&lt;P&gt;before the PROC FREQ step. Then check variable XPVALUE in dataset BT:&lt;/P&gt;
&lt;PRE&gt;proc print data=bt;
format xpvalue best16.;
run;&lt;/PRE&gt;
&lt;P&gt;Again:&lt;/P&gt;
&lt;PRE&gt;         XPValue

0.75533720331639&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Sep 2023 10:21:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893733#M44281</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2023-09-12T10:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Exact binomial Test p-value</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893735#M44282</link>
      <description>&lt;P&gt;If I understand your question, you are running code something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
call streaminit(1);
do i = 1 to 100;
   x = rand("Bern", 0.6);
   output;
end;
run;

proc freq data=Have;
   tables x / binomial(level='1' p=0.6);
   exact binomial;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Perhaps you can refer to the output of this program (or a modified version of it) to explain what problem you are trying to resolve.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The documentation for PROC FREQ includes &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/procstat/procstat_freq_details37.htm" target="_self"&gt;a section on "Binomial Test" and "Equality Test".&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I don't understand your question about "forcing SAS to always present the p-values in the same way." The definition of p-values are standard. For a discrete distribution (such as the binomial distribution), they include the probability of the bar that includes the null value of the hypothesis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want some probabilities to sum to 1, then make sure they are disjoint. You can subtract the probability density for the null value to get&amp;nbsp;&lt;BR /&gt;P(X &amp;lt; value) + P(X = value) + P(X &amp;gt; value) = 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 10:23:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893735#M44282</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2023-09-12T10:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Exact binomial Test p-value</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893744#M44283</link>
      <description>&lt;P&gt;I think &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;nailed it .&lt;/P&gt;
&lt;P&gt;If you want test your hypothesis&amp;nbsp;&lt;SPAN&gt;(H0: P&amp;lt;=P0, H1: P&amp;gt;P0)&lt;/SPAN&gt;&amp;nbsp;you need&amp;nbsp;&lt;SPAN&gt;perform a non-inferiority test which is one-side test .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
Can you post your code and output ?
And I don't understand your question.
I think your hypothesis should be
(H0: P=P0, H1: P&amp;gt;P0)     &amp;lt;-- for one side
(H0: P=P0, H1: P not equal P0)  &amp;lt;-- for two side

Therefore, Two-sided = 2 * One-sided

 "One-sided Pr &amp;lt;= P"  should be equal  "One-sided Pr &amp;gt;= P" ,since distribution of P is symmetry .
*/
proc freq data=sashelp.heart;
table status/binomial(level='Alive' p=0.6);
exact binomial;
run;&lt;/CODE&gt;&lt;/PRE&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="Ksharp_0-1694518982870.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87800i45092E18CD5C0880/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1694518982870.png" alt="Ksharp_0-1694518982870.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 11:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893744#M44283</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-09-12T11:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Exact binomial Test p-value</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893753#M44284</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1694519487402.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87802i35343E9994E77512/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1694519487402.png" alt="Ksharp_0-1694519487402.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 11:51:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893753#M44284</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-09-12T11:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Exact binomial Test p-value</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893756#M44285</link>
      <description>&lt;P&gt;A superiority test works as well:&lt;/P&gt;
&lt;PRE&gt;... binomial(level='1' p=0.6 &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;margin=1e-99 sup&lt;/FONT&gt;&lt;/STRONG&gt;);&lt;/PRE&gt;
&lt;P&gt;For the other direction you could use an equivalence test&lt;/P&gt;
&lt;PRE&gt;... binomial(level='1' p=0.6 &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;margin=1e-99 equiv&lt;/STRONG&gt;&lt;/FONT&gt;);&lt;/PRE&gt;
&lt;P&gt;as this would always yield two p-values:&lt;/P&gt;
&lt;PRE&gt;                  Two One-Sided Tests (TOST)

Test                   Z        P-Value         &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;Exact P-Value&lt;/STRONG&gt;&lt;/FONT&gt;

Lower Margin     -0.4495    Pr &amp;gt; Z   0.6735    &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;Pr &amp;gt;= P   0.7553&lt;/STRONG&gt;&lt;/FONT&gt;
Upper Margin     -0.4495    Pr &amp;lt; Z   0.3265    &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;Pr &amp;lt;= P   0.4044&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/PRE&gt;
&lt;P&gt;(using the sample data from my previous post).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Equality of these two p-values would occur for the symmetric binomial distribution, i.e., p=0.5, if, in addition, the observed frequency is the expected value np, which requires an even n. For example, n=20, p=0.5, 10 "successes" observed:&lt;/P&gt;
&lt;PRE&gt;  Exact P-Value

 Pr &amp;gt;= P   0.5881
 Pr &amp;lt;= P   0.5881&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Sep 2023 12:10:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893756#M44285</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2023-09-12T12:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Exact binomial Test p-value</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893757#M44286</link>
      <description>"A superiority test works as well:"&lt;BR /&gt;Yes. since margin is so small (near zero), and would expect they have similar result.</description>
      <pubDate>Tue, 12 Sep 2023 12:13:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893757#M44286</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-09-12T12:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Exact binomial Test p-value</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893779#M44287</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Equality of these two p-values would occur for the symmetric binomial distribution, i.e., p=0.5, if, in addition, the observed frequency is the expected value np, which requires an even n.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;These conditions are sufficient, but not necessary for the equality. There are many other examples, e.g., n=5, 1 success observed, p such that (1-p)**5=1-(1-p)**5-5*p*(1-p)**4 -- this equation has the unique solution p=0.216105706313... in [0, 1]. Both one-sided p-values are then 0.7040028597...&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 13:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-Exact-binomial-Test-p-value/m-p/893779#M44287</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2023-09-12T13:31:33Z</dc:date>
    </item>
  </channel>
</rss>

