Re: Fisher's exact test appropriate here?

  • Follow


--- 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:













7/23/2012 10:17:21 PM


Reply: