Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Elizabeth Allred" <lizard@hsph.harvard.edu> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: increase digits after decimal point in p value |
Date | Wed, 13 Jul 2011 07:32:10 -0400 |
Elegant. Thanks, Austin! Liz On 7/12/2011 at 4:49 PM, in message <CAGkAVYL+8JkNusxUU0o4TssVwuwbP2Z4hG-U5uC=e1-U9U1Qqg@mail.gmail.com>, Austin Nichols <austinnichols@gmail.com> wrote: > Elizabeth Allred <lizard@hsph.harvard.edu>: > > With that many, you probably want -capture- rather than quietly, and > you need to decide what to do with errors. Better to write out a file > with e.g. -post- that allows subsequent analysis, rather than looking > at reams of output. You might also want to analyze power... > > set seed 1 > mat c=(1,.1\ .1,1) > drawnorm y x, n(3600) clear corr(c) > replace y=y>0 > replace x=x>0 > tempname o > postfile `o' number pexact c11 c12 c21 c22 using pexact, replace > forv i=1/3500 { > cap ta y x in `i'/`=`i'+100', exact matcell(C) > if _rc==0 &rowsof(C)==2&colsof(C)==2 { > if r(p_exact)<.05/3500 { > mat li C > di "Fisher's exact p=" r(p_exact) > } > post `o' (`i' ) (`r(p_exact)') (`=C[1,1]') (`=C[1,2]') (`=C[2,1]') > (`=C[2,2]') > } > } > postclose `o' > use pexact, clear > tw kdensity pexact > > Under the null: > > drawnorm y x, n(3600) clear seed(1) > replace y=y>0 > replace x=x>0 > tempname o > postfile `o' number pexact c11 c12 c21 c22 using pexact, replace > forv i=1/3500 { > cap ta y x in `i'/`=`i'+100', exact matcell(C) > if _rc==0 &rowsof(C)==2&colsof(C)==2 { > if r(p_exact)<.05/3500 { > mat li C > di "Fisher's exact p=" r(p_exact) > } > post `o' (`i' ) (`r(p_exact)') (`=C[1,1]') (`=C[1,2]') (`=C[2,1]') > (`=C[2,2]') > } > } > postclose `o' > use pexact, clear > tw kdensity pexact > > > On Tue, Jul 12, 2011 at 3:37 PM, Elizabeth Allred > <lizard@hsph.harvard.edu> wrote: >> Thanks Austin, >> >> For the table I showed, I get: >> >> scalars: >> r(N) = 861 >> r(r) = 2 >> r(c) = 2 >> r(p_exact) = 4.79750510923e-07 >> r(p1_exact) = 2.92991198169e-07 >> >> I'm interested in the two sided p so I did: >> >> ret li p_exact >> >> scalar r(p_exact) = 4.79750510923e-07 >> >> Unfortunately what I'm actually doing is around 3500 tables and I'd really > like to scan the output and see: >> >> Fisher's exact = 0.00000 >> >> so I can quickly pick out tables with p < .00001. I really do want to change > the display format! >> >> Liz >> >> On 7/12/2011 at 3:14 PM, in message >> <CAGkAVYKJM9AKAmObHFpa7Y1TajS+655otdAsUGhRvKSr6T3_+Q@mail.gmail.com>, Austin >> Nichols <austinnichols@gmail.com> wrote: >>> Elizabeth Allred <lizard@hsph.harvard.edu> : >>> >>> sysuse auto, clear >>> ta rep78 for, exact >>> ret li >>> >>> >>> >>> On Tue, Jul 12, 2011 at 3:08 PM, Elizabeth Allred >>> <lizard@hsph.harvard.edu> wrote: >>>> I need to see 5 digits after the decimal point for the Fisher's exact test >>> in a tabulate request. It only shows digits. >>>> >>>> tab x y, exact >>>> >>>> y >>>> x | 0 1 | Total >>>> -----------+----------------------+---------- >>>> 0 | 512 133 | 645 >>>> 1 | 133 83 | 216 >>>> -----------+----------------------+---------- >>>> Total | 645 216 | 861 >>>> >>>> Fisher's exact = 0.000 >>>> 1-sided Fisher's exact = 0.000 >>>> >>>> Tabulate is a "built-in" command so I can't go in and change the display >>> format. >>>> >>>> How can I get what I need?? > > * > * 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/