From: Fay, Michael (NIH/NIAID) [E] <mfay_at_niaid.nih.gov>

Date: Wed, 27 Jan 2010 19:59:09 -0500

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

R-packages mailing list

R-packages_at_r-project.org

https://stat.ethz.ch/mailman/listinfo/r-packages Received on Sun 31 Jan 2010 - 05:43:54 EST

Date: Wed, 27 Jan 2010 19:59:09 -0500

I am announcing the release of the exactci package. It calculates exact tests and confidence intervals for binomial and Poisson tests. Here is an example to motivate the package:

Suppose you want to see if the observed rates of 2/17877 for group A are significantly different from the observed rates of 10/20000 for group B assuming Poisson counts. The poisson.test function in the stats package gives a significant test result but a confidence interval that contains the rate ratio of 1:

*> poisson.test(c(2,10),c(17877,20000))*

Comparison of Poisson rates

data: c(2, 10) time base: c(17877, 20000)
count1 = 2, expected count1 = 5.664, p-value = 0.04213
alternative hypothesis: true rate ratio is not equal to 1
95 percent confidence interval:

0.02383738 1.04995468

sample estimates:

rate ratio

0.2237512

In the exactci package, the test and confidence interval are calculated from the same p-value function so these kind of test-CI inconsistencies are avoided as much as is possible. Here are the results from the package (first using the central method to match the CI from poisson.test, then using the minlike method to match the p-value from poisson.test):

*> poisson.exact(c(2,10),c(17877,20000))*

Exact two-sided Poisson test (central method)

data: c(2, 10) time base: c(17877, 20000)
count1 = 2, expected count1 = 5.664, p-value = 0.06056
alternative hypothesis: true rate ratio is not equal to 1
95 percent confidence interval:

0.02383738 1.04995468

sample estimates:

rate ratio

0.2237512

*> poisson.exact(c(2,10),c(17877,20000),tsmethod="minlike")*

Exact two-sided Poisson test (sum of minimum likelihood method)

data: c(2, 10) time base: c(17877, 20000)
count1 = 2, expected count1 = 5.664, p-value = 0.04213
alternative hypothesis: true rate ratio is not equal to 1
95 percent confidence interval:

0.03519552 0.94194758

sample estimates:

rate ratio

0.2237512

The binom.exact function works similarly with the binomial hypothesis tests.

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 Received on Sun 31 Jan 2010 - 05:43:54 EST

*
This archive was generated by hypermail 2.2.0
: Sun 31 Jan 2010 - 05:50:03 EST
*