Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Fisher's exact P and -csi-


From   jlinhart@stata.com (Jean Marie Linhart, StataCorp LP)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Fisher's exact P and -csi-
Date   Wed, 17 Mar 2004 11:57:36 -0600

Garry Anderson <g.anderson@unimelb.edu.au> found the following bug:
>
> I am enquiring why the value of Fisher's exact P for a 2 x 2 table should 
> decrease when there is a smaller sample size for each of the two samples 
> and the two proportions remain at 100% and 0%?
> 
> For example
> -csi 6 0 0 6,e-
>                                 1-sided Fisher's exact P = 0.0011
>                                2-sided Fisher's exact P = 0.0022
>
> -csi 5 0 0 5,e-
>                                 1-sided Fisher's exact P = 0.0000
>                                 2-sided Fisher's exact P = 0.0000
<stuff deleted>
>
> Any suggestions would be appreciated.
> 
> (SPSS gives P=0.1 for the 3 0 0 3 combination)
> 
> I am using Stata 8.2, 30 Jan 2004, ado 11 Mar 2004.

Al Feiveson also noted this was also a problem with -tabi-.

I have fixed this bug, and the fix will be out in the next executable
update.  It was restricted to the Windows version of Stata.

The problem (if anyone cares) was a subtle one and restricted to
these extreme cases -- numbers can be held in a computer at higher
precision than they are stored at.  Some compilers treated two numbers
differently, holding one at a higher precision than the other, when
the two numbers should have been exactly the same.  Disaster 
occurred when these were subtracted and a value of zero was not 
obtained.

Some results:

. csi 5 0 0 5, e
<stuff deleted>
                                1-sided Fisher's exact P = 0.0040
                                2-sided Fisher's exact P = 0.0079

. csi 3 0 0 3, e
<stuff deleted>
                                1-sided Fisher's exact P = 0.0500
                                2-sided Fisher's exact P = 0.1000

. tabi 5 0 \ 0 5, exact
<stuff deleted>
           Fisher's exact =                 0.008
   1-sided Fisher's exact =                 0.004


Hope that helps!

--Jean Marie
jlinhart@stata.com
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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