[R] exact 95% confidence intervals

Frank E Harrell Jr f.harrell at vanderbilt.edu
Wed Sep 27 14:30:10 CEST 2006


Peter Dalgaard wrote:
> "XinMeng" <xmeng at capitalbio.com> writes:
> 
>> Hello sir:
> 
>> As to the 2*2 table format for reporting results comparing a new
>> test to true diagnosis,when I got the sensitivity and
>> specificity,how can I calculate the exact 95% confidence intervals
>> (based on the binomial distribution) for sensitivity and specificity
>> via R?
> 
> Just run binom.test on the data from each column (or row, depending on
> which way you turn the tables).
> 

But beware of exact binomial intervals - they are often not very 
accurate.  Wilson and other intervals are generally better.  For example 
see the binconf function in the Hmisc package.

-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University



More information about the R-help mailing list