Does Stata have both 1-sided Fisher's exact tests available? SAS displays both 'left' and 'right' sided results. As an exception, this issue came up recently where the greater one-sided probability was of interest. For 2X2 tables his can be done with Stata's hypergeometric() function.
Thanks,
-Allen Buxton
Example from table 2.8 exact analysis of a fourfold table, Joseph L. Fleiss 2nd ed. stat. meth. for rates & proportions 1981.
| b
a | b1 b2 | Total
-----------+----------------------+----------
a1 | 2 3 | 5
| 40.00 60.00 | 100.00
| 33.33 60.00 | 45.45
| 18.18 27.27 | 45.45
-----------+----------------------+----------
a2 | 4 2 | 6
| 66.67 33.33 | 100.00
| 66.67 40.00 | 54.55
| 36.36 18.18 | 54.55
-----------+----------------------+----------
Total | 6 5 | 11
| 54.55 45.45 | 100.00
| 100.00 100.00 | 100.00
| 54.55 45.45 | 100.00
Pearson chi2(1) = 0.7822 Pr = 0.376
...omitted output...
Fisher's exact = 0.567
1-sided Fisher's exact = 0.392
. di string(`=hypergeometric(11,5,6,2)', "%5.4f") /* Left-sided */
0.3918
. di string(`=1-hypergeometric(11,5,6,1)', "%5.4f") /* Right-sided */
0.9329
. di string(`=hypergeometricp(11,5,6,2)', "%5.4f") /*Table Probability*/
0.3247
Here is SAS on the two one-sided exact tests.
...omitted output...
Fisher's Exact Test
----------------------------------
Cell (1,1) Frequency (F) 2
Left-sided Pr <= F 0.3918
Right-sided Pr >= F 0.9329
Table Probability (P) 0.3247
Two-sided Pr <= P 0.5671
Sample Size = 11
/*begin Stata code*/
clear all
input str2 a str2 b byte w
a1 b1 2
a1 b2 3
a2 b1 4
a2 b2 2
end
ta a b [fw=w],row col cell all exact
/*end Stata code*/
/*begin SAS code*/
data wk00;
length a b $2.;
input a b w;
datalines;
a1 b1 2
a1 b2 3
a2 b1 4
a2 b2 2
;
run;
proc freq data=wk00;
tables a*b /fisher;
weight w;
run;
/*end SAS code*/
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Tiago V. Pereira
Sent: Friday, May 01, 2009 5:39 AM
To: [email protected]
Subject: st: [iso-8859-1] Fisher´s exact test for rxc tables: one-tailed or two-ta iled[iso-8859-1] ?
Just would like to thank David, Richard and Steve for their comments on
my last query. The two-sided option seems more plausible, indeed.
Cheers!
Tiago
----------------------------------------------
Dear statalisters,
I was reading some old post regarding exact tests in Stata and have found
the following message:
http://www.stata.com/statalist/archive/2005-06/msg00029.html
The author of this note comments on the possibility of the Fisher´s exact
test for rxc tables available in Stata to be one-tailed. Hence, is it two-
or one-tailed?
Thanks in advance.
All the best,
Tiago
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/