Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: st: RE: Fisher´s exact test for rxc [2X2] tables: one-tailed or two-tailed[iso-8859-1] ?


From   [email protected]
To   [email protected]
Subject   st: Re: st: RE: Fisher´s exact test for rxc [2X2] tables: one-tailed or two-tailed[iso-8859-1] ?
Date   Fri, 1 May 2009 20:15:48 -0400

--
I don't think so Alan. Stata would need to return the probability of
the observed table to make that computation, and it doesn't.  The
large single tail provided by SAS is useful only if  the hypothesis
was for association in that direction.  Personally, I don't  like
either the Stata or SAS implementation.  Notice that the sum of the 2
1-tail probabilities in SAS is >1, because the observed table is
counted in each tail. Much better, in my opinion would be to compute
the 1-tail probabilities by allocating only 1/2 the probability of the
observed table to each tail: a "mid p" approach.  You could "roll your
own" p-values in a program by contracting the data set and entering
the cell counts into  hypergeometric functions, as you've done by
hand.

-Steve

On 5/1/09, Allen Buxton <[email protected]> wrote:
> 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/
>

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index