COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Re: Fisher's exact test appropriate here?

• Email
• 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

See related articles to this posting

0 Replies
622 Views

Similar Articles

12/13/2013 1:31:31 AM
page loaded in 4990 ms. (0)

Similar Artilces:

Re: Fisher's exact test appropriate here? #2
--- On Fri, 1/8/10, Robert Feyerharm <robertf@HEALTH.OK.GOV> wrote: > From: Robert Feyerharm <robertf@HEALTH.OK.GOV> > Subject: Fisher's exact test appropriate here? > To: SAS-L@LISTSERV.UGA.EDU > Date: Friday, January 8, 2010, 12:57 PM > I'm comparing various pregnancy & delivery complication rates between the > Medicaid and Non-Medicaid populations in my State. These rates are often > quite small (for example, 17/20,833 vs 26/26,602). > > There are a number of options available to test for a statistically > significant difference between...

Re: Fisher exact test of Hardy-Weinberg #2
You would just perform an exact test on your data using proc freq with the exact and fisher statistic options: Proc freq; Exact fisher; tables var1*var2; run; Mark J. Lamias SAIC Statistical Consultant Office of Informatics National Center for Preparedness, Detection, and Control of Infectious Diseases Coordinating Center for Infectious Diseases US Centers for Disease Control and Prevention -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Lily Chen Sent: Tuesday, January 16, 2007 3:30 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Fisher exact test of...

Re: Description of Chi-Square and Fisher's Exact tests? #2
Mark, I hadn't though of Wikipedia! Thanks. -Mary ----- Original Message -----=20 From: Lamias, Mark (CDC/CCID/OD) (CTR)=20 To: Mary=20 Sent: Thursday, March 12, 2009 1:55 PM Subject: RE: Description of Chi-Square and Fisher's Exact tests? How about: http://en.wikipedia.org/wiki/Pearson's_chi-square_test And http://en.wikipedia.org/wiki/Fisher's_exact_test =20 Mark J. Lamias SAIC Statistical Consultant Office of Informatics National Center for Preparedness, Detection, and Control of Infectious Diseases Coordinating Center for Infectious...

Fisher's Exact Test
Does anyone know of a Perl implementation of Fisher's Exact Test for 2x2 contingency tables? I have written a short program that parses an output file from another program and writes a script that can be run in R, carrying out the test and outputting a P-value. However it will be much tidier if it can all be done in Perl rather than (the user) having to open up R and run the script. maybeD wrote: > Does anyone know of a Perl implementation of Fisher's Exact Test for > 2x2 contingency tables? http://search.cpan.org/~tpederse/Text-NSP-0.71/Measures/rightFisher.pm http://searc...

RE: Re: Quizzes and Tests
Hmm. I don't see why Sudoko puzzles would be applicable here. But it did cause me to finally find the link I wanted. This allows you to generate and grade random tests selected from a bank of questions. http://library.wolfram.com/infocenter/MathSource/4477/ David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ From: dimitris [mailto:dimmechan@yahoo.com] A possible useful link http://library.wolfram.com/infocenter/MathSource/5690/ ...

RE: Is unit testing different from white-box testing? #2
jrefactors@hotmail.com wrote: > I try to understand what are the differences between unit testing an white box testing. They look so similar but I think they are differen activities. I am still confused with some common areas. > > The followings are my analysis, please comment: > > unit testing > 1) Who: performed by the programmer > 2) How: write unit test cases based on the code. For example, eac method should have an associated test case. > 3) Why: make sure the module performs correctly with different input and see if it produces desired outputs. > > >...

Re: SASCommunity (was Re: tip: Writing Testing-aware Programs) #4
Peter, I will use search to try and find them. If I knew you username I could simply use: http://www.sascommunity.org/wiki/Special:Contributions/YOUR_USERNAME to see your contributions. WRT linking to other pages, that is discussed in the - Help - Using a Wiki Links under the "getting started" heading along the left hand panel. But here is the short version. There is no such thing as a folder hierarchy. Everything is done by page name. So if you want to add a link to the page I just created about EG, you would enter it as: [[Determining the filepath root in Enterprise Guide]...

RE : Re: multivariate linear regression and likelihood ratio test #2
Dear Dale, Thanks again for your help, it works well. I want now to use your approach and compare between two models, Model A with only main effects and ModelB adding interaction effects ModelA: y1 y2 y3 =x1 x2 dummy1 dummy2 dummy3 dummy1 dummy2 dummy3, binary variables x1 x2 are continuous variables ModelB: y1 y2 y3 =x1 x2 dummy1 dummy1*x1 dummy2*x1 dummy3*x1 dummy1*x2 dummy2*x2 dummy3*x2 dummyi*x1 (i=1,2,3) interaction term between dummyi and x1 dummyi*x2 (i=1,2,3) interaction term between dummyi and x2 Now 18 (degree of freedom) 6 parammetrs for each outcome...

Re: SASCommunity (was Re: tip: Writing Testing-aware Programs) #3 694911
let me summarize Don's commentary w/me this morning about Category or Article I had created this structure: Category: Writing Testing-Aware Programs which contained two items: article : Writing Testing-Aware Programs zip : Writing Testing-Aware Programs.zip Don suggested reducing the one parent (Category) with two children (article + aip) model to: sibling references: article : Writing Testing-Aware Programs url to .zip zip : Writing Testing-Aware Programs.zip url to article Don put the url to the zip into the article and then the zip header contained a note that the article po...

Re: test(void *data) vs test(void &data) #2
(*) corrections ;) =D "Skybuck Flying" wrote in message news:... Also what do you think the ++ hint at in c++ ?!? Behehehehehehehe. Your (*) response is so stupid I am not even going to respond to it because it's far below my level of what I will accept(*). Bye, Skybuck. ...

Re: Testing for squares
On 5/4/06 at 5:20 AM, julian.aguirre@ehu.es (Julian Aguirre) wrote: >2) Let MyList be a large list of integers (somewhere between 20.000 >and 50.000 elements) and MyTest a function on the integers returning >True or False (for instance, test2 above). What is an efficient way >of deciding if there is an element in MyList for which MyTest is >True? Right now I use >Select[MyList, MyTest, 1] != {} There are a variety of alternatives particularly if your function isn't simply restricted to returning True or False. For example consider trying to determine if a ...

Re: Test #3
this is just a test. this is just a test. this is just a test. this is just a test. this is just a test. this is just a test. ...

Re: t test
>>> Mohit Bhatia <mohit.b.bhatia@AEXP.COM> 12/14/2005 8:57 am >>> wrote <<< My problem design is as follows There is a data set containing a variable treated which takes value of 0 or 1 . And I have a variable spend . I want to do a t test wether the difference in spend among the two groups ( treated=0 and treated=1 group) is significant..How can this be done in sas.? >>> How about PROC TTEST; class treated; var spend; run; Of course, that's assuming you really want a t-test, and that it's not a matched t-test, and that the assumptions o...

Re: trend test
"'rique" <kique105@yahoo.com> wrote: > I have race distribution (W,B,H) by year (2000-2003) and I want to test > whether there is any trending (increasing or decreasing) WITHIN each > race group. In other words, for Hispanics, is the population > significantly increasing or decreasing by year. I know there is a CHISQ > test for trend, but I don't know how to set it up. I know there is a > significant difference in race distribution BETWEEN groups, but that's > not what I want. Can anyone help me with this? I'm sure someone on SAS-L can help...

Re: When do you stop your testing?
> Qingpei Huwrote: > Then when to stop DETECTION and when to stop CORRECTION??? > > If to stop detection first, then after correction of all the found > defects, we will release the software. But during this period, what > will the testers do???? > > If we are trying to keep on detection (testing), then when the defects > are corrected, there would be more defects found, then is there any > end for such testing? > > How do you make a reasonable decision as to stop the testing? > > (by the way, is it some similar to find a wife/husband?) - Detecti...

Re: Test Specification
With due respect, what is all this sarcasm about ? Perhaps it might be a good idea to stop people from making fun, well, I'd wish you good luck. Besides from spreading a little Political Correctness, what did you do to help Chiraq. Did you send him some helpfull documentation? Regards, Peter Posted from the Dutch software testing community at www.testforum.nl ...

Re: Testing code
There are a lot of people at SAS who spend a great deal of time doing exactly what you describe. So doing it yourself in a general way would be redundant. On the other hand, you may want to do your own testing on specific data or applications, but in that case you probably want to construct your own scripts, rather than borrow somebody else's. PROC COMPARE is the tool to use at the end of the process. On Thu, 3 Jun 2004 12:25:15 -0400, Andreea Rotaru <andreea_rotaru@YAHOO.COM> wrote: >I am looking for a code to test if the version 9.1 produces the same >results as the old SAS...

Re: Deviance Test? #3
--- Ryan <Ryan.Andrew.Black@GMAIL.COM> wrote: > Hello, > > I was recently reading an article that stated that they ran a > deviance > test to test "cohort effects." They were concerned because the > treatment was in a group setting, so each group was labeled a cohort. > The "treatment" variable had two levels (intervention and placebo, > both of which were administered in group settings). I believe they > used a Generalized Linear Modeling approach (commonly referred to as > GENMOD in SAS) to test if the treatment was effective on a cont...

Re: [9fans] test command
> > But then there is = and != for strings (for example), so this argument > > is thin :-). > > if we can easily get modified time of a file in the format of UNIX time, > where "easily" means "in the set of plan 9 commands". there are certainly better ways to do this, but this works: - erik #!/bin/rc rfork e p=' \$1 == "mtime:" { gsub("[()]", "", \$8) print \$8 }' for(i){ syscall -s fstat 0 buf 1024<\$i>[2=1] | awk \$p } > there are certainly better ways to do this, but this works: as does /bin/mt...

Re: Test Maturity Model
> Mark Fergusonwrote: What's the point > of top notch testers if the requirements are crap or the developers > develop crap code? > Mark. Hi Mark, ever seen a company with crap developers and top notch testers? Regards, Peter Belt Posted from the Dutch software testing community at www.testforum.nl ...