|
|
Re: Fisher's exact test appropriate here?
--- On Sat, 1/9/10, xlr82sas <xlr82sas@AOL.COM> wrote:
> From: xlr82sas <xlr82sas@AOL.COM>
> Subject: Re: Fisher's exact test appropriate here?
> To: SAS-L@LISTSERV.UGA.EDU
> Date: Saturday, January 9, 2010, 6:27 PM
> On Jan 9, 4:25 pm, stringplaye...@YAHOO.COM
> (Dale McLerran) wrote:
> > --- On Sat, 1/9/10, Ryan <ryan.andrew.bl...@GMAIL.COM>
> wrote:
>
> Hi Dale,
>
> see
> http://en.wikipedia.org/wiki/Fisher%27s_exact_test
>
> If I use your formula I get a p-value
>
> 0.0026221258207619
>
> If I use proc freq for the two tailed p-value of the
> Fishers Exact
> Test I get
>
> 0.0026221258207619
>
> I think the Exact P-value for a 2x2 table is just a statistic of the
> hypergeometric distribution. Your P is just a result of evaluating the
> hypergeometric distribution.
>
> Consider 2x2 table
>
> a b
> c d
>
> p=(a + b)!(c+d)!(a + c)!(b + d)! / n!a!b!c!d!
>
> The lgamma makes it easy to evaluate the factorials. Since a! = gamma(a
> +1) we have all the plus ones.
>
Just to be clear, the value 0.0026... is the probability of
the observed table under the hypergeometric distribution.
However, the (two-tailed) p-value for Fisher's exact test
for the data which were given as
8 14
75 32
is p=0.0060...
The following code uses PROC FREQ to evaluate table probabilities
for all 2x2 tables which have the following structure:
f11 f12 22
f21 f22 107
83 46 129
If we add the table probabilities for all tables which have
f11<=8, then we get the "Left-sided Pr <= F" value which is
presented for the table with f11=8. Adding up the table
probabilities which are at least as extreme as the observed
table probability, we obtain the value shown in the row
"Two-sided Pr <= P".
data test;
do i=0 to 22;
f11 = i; f12=22-i; f21=83-i; f22=129-f11-f12-f21;
x=0; y=0; freq=f11; output;
x=0; y=1; freq=f12; output;
x=1; y=0; freq=f21; output;
x=1; y=1; freq=f22; output;
end;
keep i x y freq;
run;
proc freq data=test(where=(i=8));
weight freq;
tables x*y / chisq;
run;
ods listing close;
ods output FishersExact=Fisher(where=(name1="P_TABLE"));
proc freq data=test;
by i;
weight freq;
tables x*y / chisq;
run;
data _null_;
set Fisher(where=(i=8) rename=(nvalue1=P_observed));
do j=0 to 22;
pointer=j+1;
set Fisher point=pointer;
if j<=8 then left+nvalue1;
if nvalue1<=P_observed then pval_2tailed+nvalue1;
end;
put left= pval_2tailed=;
run;
Dale
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: dmclerra@NO_SPAMfhcrc.org
Ph: (206) 667-2926
Fax: (206) 667-5977
---------------------------------------
|
|
0
|
|
|
|
Reply
|
stringplayer_2 (1472)
|
1/11/2010 6:37:13 AM |
|
|
0 Replies
535 Views
(page loaded in 0.02 seconds)
Similiar Articles: Re: Fisher's exact test appropriate here? - comp.soft-sys.sas ...--- On Sat, 1/9/10, xlr82sas wrote: > From: xlr82sas > Subject: Re: Fisher's exact test appropriate here? > To: SAS-L@LISTSERV.UGA.EDU > Date:... How do I do a one-tailed ranksum test? - comp.soft-sys.matlab ...Re: Fisher's exact test appropriate here? - comp.soft-sys.sas ... How do I do a one-tailed ranksum test? - comp.soft-sys.matlab ... Test if value is numerical - comp.lang ... Re: proc power question for McNemar test - comp.soft-sys.sas ...Here's my code: proc power; pairedfreq ... her control doesn't), is corr=0 appropriate ... Exact binomial test - comp.soft-sys.sas Re: %sysfunc question - comp.soft-sys ... proc power question for McNemar test - comp.soft-sys.sas ...Re: Fisher's exact test appropriate here? - comp.soft-sys.sas ... Re: proc power question for McNemar test - comp.soft-sys.sas ... Re: Fisher's exact test appropriate here ... SAS-L and this newsgroup are not linked - comp.soft-sys.sas ...Re: Fisher's exact test appropriate here? - comp.soft-sys.sas ... > To: SAS-L@LISTSERV.UGA.EDU > Date: Saturday, January 9, 2010, 6:27 PM > On Jan 9, 4 ... Chi-square independence test with clustered data - comp.soft-sys ...Re: Fisher's exact test appropriate here? - comp.soft-sys.sas ... data test; do i=0 to 22; f11 = i; f12=22 ... significance test ... where the chi-squared test is ... of ... Re: Import delimited (.txt) file -- URGENT PLEASE - comp.soft-sys ...Re: Fisher's exact test appropriate here? - comp.soft-sys.sas ... Re: Import delimited (.txt) file -- URGENT PLEASE - comp.soft-sys ..... that you are attempting to import ... p value from F statistic and n - comp.soft-sys.matlab> > But if you have the Statistics Toolbox, the fcdf function computes the lower > tail probability Prob(F<t) as a function of t. Depending on your test, you > may be ... SPEED TEST: DirectX9 vs openGL - comp.graphics.api.opengl ...Re: Fisher's exact test appropriate here? - comp.soft-sys.sas ... SPEED TEST: DirectX9 vs openGL - comp.graphics.api.opengl ... (By letting me re-compile the test on my ... PROC Freq - Output - comp.soft-sys.sasRe: Fisher's exact test appropriate here? - comp.soft-sys.sas ..... freq=f11; output; x=0; y=1; freq=f12; output; x=1; y=0; freq=f21; output; x=1; y=1; freq=f22; output ... Re: Fisher's exact test appropriate here? - comp.soft-sys.sas ...--- On Sat, 1/9/10, xlr82sas wrote: > From: xlr82sas > Subject: Re: Fisher's exact test appropriate here? > To: SAS-L@LISTSERV.UGA.EDU > Date:... Fisher's exact test appropriate here?> Subject: Re: Fisher's exact test appropriate here? [quoted text clipped - 33 lines] > The lgamma makes it easy to evaluate the factorials. Since a! = gamma(a 7/23/2012 10:17:21 PM
|
|
|
|
|
|
|
|
|