Skip to content

Confidence interval for the difference between proportions - method used in prop.test()

2 messages · Stefanie Von Felten, Joshua Wiley

#
Hi Stefanie,

Just to be clear, we are talking about differences in the third or
lower decimal place (at least with R version 2.13.0 alpha (2011-03-17
r54849), Epi_1.1.20).  This strikes me as small enough that both
functions may be implementing the same method, but maybe slightly
different ways of going about it?

If you are really concerned and need to know *exactly*, look at the
source code for both functions.  In case you did not know, if you type
the function name at the console with parentheses or any arguments,
just like:
it will show the actual function code.  It looks to me like both of
them are implemented purely in R, and without even calling any other
complex functions (at least based on a quick glance through).  This
means if you have the Newscomb text, you should be able to sit down
and go through the code step by step comparing it.

Cheers,

Josh

FYI, you can use a matrix with prop.test, and then its transpose for ci.pd.
##
mymat <- cbind(Successes = c(21, 41), Failures = c(345, 345) - c(21, 41))
require(Epi)
results <- list(prop.test(mymat, correct=FALSE), ci.pd(t(mymat)))
results[[1]][["conf.int"]] - results[[2]][6:7]
On Tue, Apr 5, 2011 at 3:38 AM, Stefanie Von Felten <SVonfelten at uhbs.ch> wrote: