<?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: Fischer's exact test: Difference between table probability and two-sided PR in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928497#M46259</link>
    <description>&lt;P&gt;For more information about why this situation uses the PDF of a hypergeometric distribution, see&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2015/10/14/sim-2x2-model.html" target="_blank"&gt;Models and simulation for 2x2 contingency tables - The DO Loop (sas.com)&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 15 May 2024 15:21:47 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2024-05-15T15:21:47Z</dc:date>
    <item>
      <title>Fischer's exact test: Difference between table probability and two-sided PR</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928479#M46251</link>
      <description>&lt;P&gt;Could someone please clarify for me the difference between&amp;nbsp;table probability and two-sided PR in a Fischer's exact test?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which result should be consider as a p-value indicating the probability that the distribution in the table is random?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Zachi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 13:25:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928479#M46251</guid>
      <dc:creator>zachi_dv</dc:creator>
      <dc:date>2024-05-15T13:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Fischer's exact test: Difference between table probability and two-sided PR</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928482#M46252</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/463502"&gt;@zachi_dv&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The relevant p-value is the "Two-sided Pr &amp;lt;= P", not the "Table Probability (P)".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the explanation let's look at "&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/procstat/procstat_freq_examples05.htm" target="_blank" rel="noopener"&gt;Example 3.5 Analysis of a 2x2 Contingency Table&lt;/A&gt;" from the PROC FREQ documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the 2x2 contingency table:&lt;/P&gt;
&lt;PRE&gt;Table of Exposure by Response

Exposure          Response(Heart Disease)

Frequency        |No      |Yes     |  Total
-----------------+--------+--------+
Low Cholesterol  |      6 |      2 |      8
Diet             |        |        |
-----------------+--------+--------+
High Cholesterol |      4 |     11 |     15
 Diet            |        |        |
-----------------+--------+--------+
Total                  10       13       23
&lt;/PRE&gt;
&lt;P&gt;You are asking about Fisher's exact test results:&lt;/P&gt;
&lt;PRE&gt;       Fisher's Exact Test
----------------------------------
Table Probability (P)       0.0334
Two-sided Pr &amp;lt;= P           0.0393
&lt;/PRE&gt;
&lt;P&gt;The null hypothesis is&amp;nbsp;&lt;SPAN&gt;no association between the row variable and the column variable. Assuming this &lt;EM&gt;and&lt;/EM&gt; that the row and column totals (8, 15, 10 and 13 in the example) are fixed, we can compute the (conditional) probabilities of all possible tables with the same marginal frequencies from the hypergeometric distribution. (These are nine tables: The upper left frequency can take the values 0, 1, ..., 8.) The observed table is one of these and it's probability is the "Table Probability (P)" from the output. In our example it is&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;pdf('hyper',6,23,8,10)=comb(8,6)*comb(15,4)/comb(23,10)=0.033407...&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;The sum of all table probabilities that are less than or equal to this particular probability is the two-sided p-value of Fisher's exact test. In the example it is the sum of four table probabilities, as shown in the DATA step below:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fisher;
array pt[0:8];
do k=0 to dim(pt)-1;
  pt[k]=pdf('hyper',k,23,8,10);
  put k= 'pt[' k +(-1) ']=' pt[k];
end;
put / 'Two-sided p-value: pt[6]' @;
pv=pt[6];
do k=0 to dim(pt)-1;
  if k=6 then continue;
  if pt[k]&amp;lt;=pt[6] then do;
    put '+pt[' k +(-1) ']' @;
    pv+pt[k];
  end;
end;
put '=' pv;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Result:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;k=0 pt[0]=0.0026248486
k=1 pt[1]=0.0349979809
k=2 pt[2]=0.157490914
k=3 pt[3]=0.314981828
k=4 pt[4]=0.3062323328
k=5 pt[5]=0.1469915197
k=6 pt[6]=0.0334071636
k=7 pt[7]=0.0031816346
k=8 pt[8]=0.0000917779

Two-sided p-value: pt[6]+pt[0]+pt[7]+pt[8]=0.0393054247&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 14:37:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928482#M46252</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-05-15T14:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Fischer's exact test: Difference between table probability and two-sided PR</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928486#M46253</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The two-sided PR is the p-value. The&amp;nbsp;table entry that says "Table Probability (P)" is the probability of getting your table from&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;among&amp;nbsp; all the possible tables that have the same marginal row and column totals as the observed table.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think FreelanceReinh made a nice summary of Fisher's exact test at&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Interpreting-statistical-test-output-with-Fisher-s-exact-p-value/td-p/616024" target="_blank"&gt;Interpreting statistical test output with Fisher's exact p-value of 1.... - SAS Support Communities&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Also, see&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2015/10/28/simulation-exact-tables.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2015/10/28/simulation-exact-tables.html&lt;/A&gt;&amp;nbsp;although the example in that article is an exact Chi-Square test, which is a different test.&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 14:41:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928486#M46253</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2024-05-15T14:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Fischer's exact test: Difference between table probability and two-sided PR</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928487#M46254</link>
      <description>&lt;P&gt;Wow,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;is super fast today!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 14:42:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928487#M46254</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2024-05-15T14:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Fischer's exact test: Difference between table probability and two-sided PR</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928488#M46255</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Wow,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;is super fast today!&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Thanks. I knew I &lt;EM&gt;had to be&lt;/EM&gt; fast to be first. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 14:46:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928488#M46255</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-05-15T14:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Fischer's exact test: Difference between table probability and two-sided PR</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928492#M46256</link>
      <description>&lt;P&gt;thanks for the quick response. I still don't understand what is the significance of table probability? what does it indicate?&lt;/P&gt;&lt;P&gt;see this example below for instance. Is 0.42 is the probability of getting this table from all possible tables with the same marginal sums?&lt;/P&gt;&lt;P&gt;also, what does P-value of 1 mean? it surely doesn't mean that this is the only possibility of the distribution of the frequencies.&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="zachi_dv_1-1715785370520.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96548iFDB784D72898E07C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="zachi_dv_1-1715785370520.png" alt="zachi_dv_1-1715785370520.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Fisher's Exact Test&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Cell (1,1) Frequency (F)&lt;/TD&gt;&lt;TD&gt;45&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Left-sided Pr &amp;lt;= F&lt;/TD&gt;&lt;TD&gt;0.4232&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Right-sided Pr &amp;gt;= F&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Table Probability (P)&lt;/TD&gt;&lt;TD&gt;0.4232&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Two-sided Pr &amp;lt;= P&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 15 May 2024 15:03:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928492#M46256</guid>
      <dc:creator>zachi_dv</dc:creator>
      <dc:date>2024-05-15T15:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Fischer's exact test: Difference between table probability and two-sided PR</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928493#M46257</link>
      <description>thanks for your adding to FreelanceReinh reply. So now I understand how it is computed, but what is the significance of this number?</description>
      <pubDate>Wed, 15 May 2024 15:08:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928493#M46257</guid>
      <dc:creator>zachi_dv</dc:creator>
      <dc:date>2024-05-15T15:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: Fischer's exact test: Difference between table probability and two-sided PR</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928495#M46258</link>
      <description>&lt;P&gt;Here is the DATA step from my previous post, adapted to your data, together with the results in the log:&lt;/P&gt;
&lt;PRE&gt;753   data fisher;
754   array pt[0:5];
755   do k=0 to dim(pt)-1;
756     pt[k]=pdf('hyper',k,59,5,9);
757     put k= 'pt[' k +(-1) ']=' pt[k];
758   end;
759   put / 'Two-sided p-value: pt[0]' @;
760   pv=pt[0];
761   do k=0 to dim(pt)-1;
762     if k=0 then continue;
763     if pt[k]&amp;lt;=pt[0] then do;
764       put '+pt[' k +(-1) ']' @;
765       pv+pt[k];
766     end;
767   end;
768   put '=' pv;
769   run;

k=0 pt[0]=&lt;STRONG&gt;0.4232&lt;/STRONG&gt;114743
k=1 pt[1]=0.4140112249
k=2 pt[2]=0.1409399914
k=3 pt[3]=0.0205537488
k=4 pt[4]=0.0012583928
k=5 pt[5]=0.0000251679

Two-sided p-value: pt[0]+pt[1]+pt[2]+pt[3]+pt[4]+pt[5]=&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/PRE&gt;
&lt;P&gt;So, in your example the observed table is that with the &lt;EM&gt;largest&lt;/EM&gt; (conditional) probability among the six possible tables, given the marginal totals. Hence, the two-sided p-value must be 1 because now, by definition, it is the sum of the&amp;nbsp;(conditional) probabilities of &lt;EM&gt;all&lt;/EM&gt;&amp;nbsp;those six tables. This is the same situation as in the &lt;A href="https://communities.sas.com/t5/SAS-Programming/Interpreting-statistical-test-output-with-Fisher-s-exact-p-value/td-p/616024" target="_blank" rel="noopener"&gt;2020 thread&lt;/A&gt; that Rick linked to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The fact that the "Table Probability (P)" &lt;FONT face="courier new,courier"&gt;pt[0]&lt;/FONT&gt; in your example is only slightly larger than &lt;FONT face="courier new,courier"&gt;pt[1]&lt;/FONT&gt; indicates that your dataset is close to a situation where &lt;FONT face="courier new,courier"&gt;pt[1]&lt;/FONT&gt;&amp;nbsp;and not &lt;FONT face="courier new,courier"&gt;pt[0]&lt;/FONT&gt; is the largest probability (and hence, the two-sided p-value might be considerably smaller). Indeed, by changing the upper left cell frequency from 45 to 43 we get there:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input Type $ Site $ Count;
cards;
JT1 TM &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;43&lt;/STRONG&gt;&lt;/FONT&gt;
JT1 JS  9
JT2 TM  5
JT2 JS  0
;

proc freq data=test order=data;
tables Type*Site / chisq norow nocol nopercent;
weight Count;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;       Fisher's Exact Test
----------------------------------
Table Probability (P)       0.4089
Two-sided Pr &amp;lt;= P           0.5818&lt;/PRE&gt;
&lt;P&gt;Calculation:&lt;/P&gt;
&lt;PRE&gt;k=0 pt[0]=&lt;STRONG&gt;0.4089&lt;/STRONG&gt;468955
k=1 pt[1]=0.4182411432
k=2 pt[2]=0.148707962
k=3 pt[3]=0.0226294725
k=4 pt[4]=0.0014444344
k=5 pt[5]=0.0000300924

Two-sided p-value: pt[0]+pt[2]+pt[3]+pt[4]+pt[5]=&lt;STRONG&gt;0.58175&lt;/STRONG&gt;88568&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 May 2024 15:39:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928495#M46258</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-05-15T15:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Fischer's exact test: Difference between table probability and two-sided PR</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928497#M46259</link>
      <description>&lt;P&gt;For more information about why this situation uses the PDF of a hypergeometric distribution, see&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2015/10/14/sim-2x2-model.html" target="_blank"&gt;Models and simulation for 2x2 contingency tables - The DO Loop (sas.com)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 15:21:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928497#M46259</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2024-05-15T15:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Fischer's exact test: Difference between table probability and two-sided PR</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928502#M46260</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/463502"&gt;@zachi_dv&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;So now I understand how it is computed, but what is the significance of this number?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You could say, for example, if the observed table probability is greater than the significance level you had decided upon (e.g., &lt;FONT face="symbol"&gt;a&lt;/FONT&gt;=0.05), then you don't need to look any further at the p-values (two-sided, left-sided, right-sided) as they are all necessarily greater than or equal to the table probability, i.e., the result of Fisher's exact test is definitely not significant at level &lt;FONT face="symbol"&gt;a&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Technically, the table probability is the&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;test statistic&lt;/EM&gt; of&amp;nbsp;Fisher's exact test. So it corresponds, e.g., to the chi-square value of Pearson's chi-square test.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 16:33:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Fischer-s-exact-test-Difference-between-table-probability-and/m-p/928502#M46260</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-05-15T16:33:46Z</dc:date>
    </item>
  </channel>
</rss>

