[R-sig-Epi] need help in calculating confidence intervals forsensitivity, specificity, PPV & NPV

Greg Snow Greg.Snow at imail.org
Mon Mar 3 22:07:29 CET 2008


I am not a physician, but most of the people who ask me for confidence
intervals on sensitivity and specificity are.

My prefered approach (not the only one), is to use the Bayesian interval
using a uniform prior (beta(1,1) distribution) with the binomial (it is
easier to do than it looks).

Basically find the HPD interval from a beta distribution with parameters
s+1 and f+1, where s and f are successes (correct test results) and
failures (incorrect test results).

I use the hpd function from the TeachingDemos package, but there are
others as well (I'm a bit biased towards that package).

For example, to calculate the 95% confidence interval for sensitivity
when you have 95 true positives and 5 false negatives you would just
type (after installing and loading the package):

> hpd(qbeta, shape1=96, shape2=6)

And the 2 numbers are limits of a 95% confidence interval.

I like this approach because it still gives sensible results when you
have no false negatives (or false positives for specificity).

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-sig-epi-bounces at stat.math.ethz.ch 
> [mailto:r-sig-epi-bounces at stat.math.ethz.ch] On Behalf Of 
> Smita Pakhale
> Sent: Friday, February 29, 2008 12:34 PM
> To: r-sig-epi at stat.math.ethz.ch
> Subject: [R-sig-Epi] need help in calculating confidence 
> intervals forsensitivity, specificity, PPV & NPV
> 
> Hello,
> 
> I am a physician and a novice in R.
> 
> I am trying to calculate sensitivity, specificity, positive 
> predictive and negative predictive values. I could do that 
> using the package caret. However, I need to get confidence 
> intervals around these estimates and I do not know how to do that.
> 
> Please help me find a way to calculate confidence intervals 
> for these parameters.
> 
> thank you.
> Sincerely,
> Dr. Smita Pakhale
> 
> _______________________________________________
> R-sig-Epi at stat.math.ethz.ch mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-sig-epi
> 



More information about the R-sig-Epi mailing list