[R] [R-pkgs] new package: exact2x2

Fay, Michael (NIH/NIAID) [E] mfay at niaid.nih.gov
Mon Jul 20 16:55:54 CEST 2009


Hi all,

I have just uploaded a new package to the ftp site called exact2x2. The package does exact conditional tests for 2x2 tables. Specifically, it does Fisher's exact test and Blaker's exact test (see Blaker, 2000, Canadian Journal of Statistics, 783-798). The motivation for the package is to have inferences from p-values and confidence intervals match as much as is possible for the tests, so that when p<0.05 the 95 percent confidence interval on the odds ratio does not contain 1.


Here is an example which shows the problem  with fisher.test in this regard:

> fisher.test(matrix(c(6,12,12,5),2,2))

        Fisher's Exact Test for Count Data

data:  matrix(c(6, 12, 12, 5), 2, 2)
p-value = 0.04371
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 0.03888003 1.05649145
sample estimates:
odds ratio
 0.2189021

Using the  exact2x2 function, there are two options for two-sided Fisher's exact test: "minlike" (default) is the usual one that defines extreme in terms of values smaller than the observed probability, and "central" is the one that defines the two-sided p-value as twice the minimum of the one-sided ones. The problem with fisher.test is that it gives confidence intervals which are an inversion of the later but p-values from the former.   Here is that example from exact2x2:

> exact2x2(matrix(c(6,12,12,5),2,2))

        Two-sided Fisher's Exact Test (usual method using minimum likelihood)

data:  matrix(c(6, 12, 12, 5), 2, 2)
p-value = 0.04371
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 0.0435 0.9170
sample estimates:
odds ratio
 0.2189021

>
> exact2x2(matrix(c(6,12,12,5),2,2),tsmethod="central")

        Central Fisher's Exact Test

data:  matrix(c(6, 12, 12, 5), 2, 2)
p-value = 0.06059
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 0.03888003 1.05649145
sample estimates:
odds ratio
 0.2189021

>


Let me know if there are comments or problems,

Mike
******************************************************************
Michael P. Fay, PhD
Mathematical Statistician
National Institute of Allergy and Infectious Diseases
Tel: 301-451-5124               Fax:301-480-0912
(U.S. postal mail address)
6700B Rockledge Drive MSC 7609
Bethesda, MD 20892-7609
(Overnight mail address)
6700-A Rockledge Drive, Room 5133
Bethesda, MD 20817

http://www3.niaid.nih.gov/about/organization/dcr/BRB/staff/michael.htm
**********************************************************************



	[[alternative HTML version deleted]]

_______________________________________________
R-packages mailing list
R-packages at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages




More information about the R-help mailing list