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

Re: st: _tabi, exact_ gives obviously wrong P-value


From   [email protected] (Richard Gates)
To   [email protected]
Subject   Re: st: _tabi, exact_ gives obviously wrong P-value
Date   Wed, 22 Dec 2004 14:37:32 -0600

In regard to Dr. Trikalinos' recent -tabi, exact- inquiry:

> Perhaps I miss something, but
> 
> . tabi 27879 35177 29377 17201 \ 118 187 183 65, e chi2
>   yields Fisher's exact = 1.000
> Pearson's Chi2(3) =17.7, Pr =0.001
> 
> StatXact calculates the P-value as 0.0005
> The command seems to work properly for smaller numbers or different 
> table geometries.
> 

He has indeed stumbled on a bug in the computations.  For this problem the
results should be

. set rmsg on
r; t=0.00 13:47:01

. tabi 27879 35177 29377 17201 \ 118 187 183 65, e chi2

           |                     col
       row |         1          2          3          4 |     Total
-----------+--------------------------------------------+----------
         1 |    27,879     35,177     29,377     17,201 |   109,634 
         2 |       118        187        183         65 |       553 
-----------+--------------------------------------------+----------
     Total |    27,997     35,364     29,560     17,266 |   110,187 

          Pearson chi2(3) =  17.7073   Pr = 0.001
           Fisher's exact =                 0.001
r; t=0.93 13:47:04

. set rmsg off

. return list

scalars:
           r(p_exact) =  .000507590683298
                 r(p) =  .0005054103814925
              r(chi2) =  17.70731546856195
                 r(c) =  4
                 r(r) =  2
                 r(N) =  110187


I have been informed that a new executable update will be available by the
second week of January.

Thank you for bringing this problem to my attention.  

-Rich
[email protected]
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index