Skip to contents

Calculates confidence intervals for differences in sensitivity and specificity of two binary diagnostic tests in a paired study design.

Usage

sesp.diff.ci(tab, ci.method, alpha, cont.corr)

Arguments

tab

An object of class tab.paired.

ci.method

The available methods are “wald” (Altman, 1991), “agresti-min” (Agresti and Min, 2005), “bonett-price” (Bonett and Price, 2011), and “tango” (Tango, 1998), the default is “wald”.

alpha

Significance level alpha for 100(1-alpha)%-confidence intervals for the difference in sensitivity and specificity, the default is 0.05.

cont.corr

A logical value indicating whether the continuity correction should be used (only available for ci.method="wald"), the default is FALSE.

Details

For details and recommendations see Newcombe (2012) and Wenzel and Zapf (2013).

Value

A list containing:

sensitivity

A vector containing test1 (the sensitivity of test 1), test2 (the specificity of test 2), diff (the difference between the two sensitivities, computed as test2 - test1), diff.se (the standard error of diff), diff.lcl (the lower confidence limit of diff) and diff.ucl (the upper confidence limit of diff).

specificity

A vector containing test1 (specificity of test 1), test2 (specificity of test 2), diff (the difference between the two specificities, computed as test2 - test1), diff.se (the standard error of diff), diff.lcl (the lower confidence limit of diff) and diff.ucl (the upper confidence limit of diff).

ci.method

The name of the method used to calculate confidence intervals.

alpha

The level alpha used to compute 100(1-alpha)%-confidence intervals.

cont.corr

A logical value indicating whether the continuity correction was applied.

References

Altman, D.G. (1991). Practical statistics for medical research. Chapman & Hall, London.

Agresti, A. and Min, Y. (2005). Simple improved confidence intervals for comparing matched proportions. Stat Med, 24(5): 729-40.

Bonett, D.G., and Price, R.M. (2011). Adjusted Wald confidence intervals for a difference of binomial proportions based on paired data. J Educ Behav Stat, 37(4): 479-488.

Newcombe R.G. (2012). Confidence intervals for proportions and related measures of effect size. Chapman and Hall/CRC Biostatistics Series.

Tango, T. (1998). Equivalence test and confidence interval for the difference in proportions for the paired-sample design. Stat Med, 17(8): 891-908.

Wenzel, D., and Zapf, A. (2013). Difference of two dependent sensitivities and specificities: comparison of various approaches. Biom J, 55(5): 705-718.

Examples

library(DTComPair)
t1 <- read.tab.paired(18, 14, 0, 18,
                      18, 12, 2, 18)
t1
#> Two binary diagnostic tests (paired design)
#> 
#> Test1: 'Noname 1'
#> Test2: 'Noname 2'
#> 
#> Diseased:
#>            Test1 pos. Test1 neg. Total
#> Test2 pos.         18         14    32
#> Test2 neg.          0         18    18
#> Total              18         32    50
#> 
#> Non-diseased:
#>            Test1 pos. Test1 neg. Total
#> Test2 pos.         18         12    30
#> Test2 neg.          2         18    20
#> Total              20         30    50
#> 
sesp.diff.ci(t1, ci.method="wald", cont.corr=FALSE)
#> $sensitivity
#>      test1      test2       diff    diff.se   diff.lcl   diff.ucl 
#> 0.36000000 0.64000000 0.28000000 0.06349803 0.15554615 0.40445385 
#> 
#> $specificity
#>       test1       test2        diff     diff.se    diff.lcl    diff.ucl 
#>  0.60000000  0.40000000 -0.20000000  0.06928203 -0.33579029 -0.06420971 
#> 
#> $ci.method
#> [1] "wald"
#> 
#> $alpha
#> [1] 0.05
#> 
#> $cont.corr
#> [1] FALSE
#> 
sesp.diff.ci(t1, ci.method="wald", cont.corr=TRUE)
#> $sensitivity
#>      test1      test2       diff    diff.se   diff.lcl   diff.ucl 
#> 0.36000000 0.64000000 0.28000000 0.08349803 0.11634687 0.44365313 
#> 
#> $specificity
#>       test1       test2        diff     diff.se    diff.lcl    diff.ucl 
#>  0.60000000  0.40000000 -0.20000000  0.08928203 -0.37498957 -0.02501043 
#> 
#> $ci.method
#> [1] "wald"
#> 
#> $alpha
#> [1] 0.05
#> 
#> $cont.corr
#> [1] TRUE
#> 
sesp.diff.ci(t1, ci.method="agresti-min")
#> $sensitivity
#>      test1      test2       diff    diff.se   diff.lcl   diff.ucl 
#> 0.36000000 0.64000000 0.28000000 0.06444681 0.15368658 0.40631342 
#> 
#> $specificity
#>       test1       test2        diff     diff.se    diff.lcl    diff.ucl 
#>  0.60000000  0.40000000 -0.20000000  0.06954236 -0.33630053 -0.06369947 
#> 
#> $ci.method
#> [1] "agresti-min"
#> 
#> $alpha
#> [1] 0.05
#> 
#> $cont.corr
#> [1] FALSE
#> 
sesp.diff.ci(t1, ci.method="tango")
#> $sensitivity
#>     test1     test2      diff   diff.se  diff.lcl  diff.ucl 
#> 0.3600000 0.6400000 0.2800000        NA 0.1747417 0.4166512 
#> 
#> $specificity
#>       test1       test2        diff     diff.se    diff.lcl    diff.ucl 
#>  0.60000000  0.40000000 -0.20000000          NA -0.34470882 -0.06111243 
#> 
#> $ci.method
#> [1] "tango"
#> 
#> $alpha
#> [1] 0.05
#> 
#> $cont.corr
#> [1] FALSE
#>