Comparison of the accuracy of two tests using relative sensitivity and specificity
Source:R/sesp.rel.R
sesp.rel.Rd
Calculates two-sided Wald confidence intervals and performs a Wald test for the relative sensitivity and specificity of two binary diagnostic tests in a paired study design.
Value
A list containing:
- sensitivity
a named vector containing
test1
(the sensitivity for test 1),test2
(the sensitivity for test 2),rel.sens
(the relative difference between the two sensitivities, computed astest2/test1
),se.log.rel.sens
(the standard error for log(rel.sens
)),lcl.rel.sens
(the lower confidence limit forrel.sens
),ucl.rel.sens
(the upper confidence limit forrel.sens
), andpval.rel.sens
(the p-value from the test for the null hypothesis: relative sensitivity=1).- specificity
a named vector containing
test1
(the specificity for test 1),test2
(the specificity for test 2),rel.spec
(the relative difference between the two specificities, computed astest2/test1
),se.log.rel.spec
(the standard error for log(rel.spec
)),lcl.rel.spec
(the lower confidence limit forrel.spec
),ucl.rel.spec
(the upper confidence limit forrel.spec
), andpval.rel.spec
(the p-value from the test for the null hypothesis: relative specificity=1).- alpha
significance level alpha for 100(1-alpha)%-confidence intervals for
rel.sens
andrel.spec
.
Details
If relative sensitivity>1, the percentage increase in sensitivity for test2
relative to test1
is computed as 100(relative sensitivity-1)%. If
relative sensitivity<1 the percentage decrease in sensitivity for test2
relative to test1
is computed as 100(1-relative sensitivity)%.
Percentage increase/decrease in specificity is computed in an analogous fashion.
Given the independence of relative sensitivity and relative specificity, a possible joint 100(1-alpha)% confidence region for {relative sensitivity, relative specificity}
is formed by the rectangle {lcl.rel.sens
, ucl.rel.sens
} x {lcl.rel.spec
, ucl.rel.spec
}, where {lcl.rel.sens
, ucl.rel.sens
} and
{lcl.rel.spec
, ucl.rel.spec
} are 100(1-alpha*)% confidence intervals for relative sensitivity and relative specificity, respectively, and alpha*=1-sqrt(1-alpha).
The McNemar's test implemented in sesp.mcnemar
is asymptotically equivalent to the Wald test implemented here.
References
Alonzo, T. A., Pepe, M. S., & Moskowitz, C. S. (2002). Sample size calculations for comparative studies of medical tests for detecting presence of disease. Statistics in medicine, 21(6), 835-852.
Examples
data(Paired1) # Hypothetical study data
ftable(Paired1)
#> y2 0 1
#> d y1
#> 0 0 155 22
#> 1 53 31
#> 1 0 32 22
#> 1 78 319
paired.layout <- tab.paired(d=d, y1=y1, y2=y2, data=Paired1)
paired.layout
#> Two binary diagnostic tests (paired design)
#>
#> Test1: 'y1'
#> Test2: 'y2'
#>
#> Diseased:
#> Test1 pos. Test1 neg. Total
#> Test2 pos. 319 22 341
#> Test2 neg. 78 32 110
#> Total 397 54 451
#>
#> Non-diseased:
#> Test1 pos. Test1 neg. Total
#> Test2 pos. 31 22 53
#> Test2 neg. 53 155 208
#> Total 84 177 261
#>
sesp.rel.results <- sesp.rel(paired.layout)
str(sesp.rel.results)
#> List of 3
#> $ sensitivity: Named num [1:7] 0.8803 0.7561 0.8589 0.0272 0.8144 ...
#> ..- attr(*, "names")= chr [1:7] "test1" "test2" "rel.sens" "se.log.rel.sens" ...
#> $ specificity: Named num [1:7] 0.6782 0.7969 1.1751 0.0451 1.0757 ...
#> ..- attr(*, "names")= chr [1:7] "test1" "test2" "rel.spec" "se.log.rel.spec" ...
#> $ alpha : num 0.05
sesp.rel.results
#> $sensitivity
#> test1 test2 rel.sens se.log.rel.sens lcl.rel.sens
#> 8.802661e-01 7.560976e-01 8.589421e-01 2.717863e-02 8.143843e-01
#> ucl.rel.sens pval.rel.sens
#> 9.059378e-01 2.211197e-08
#>
#> $specificity
#> test1 test2 rel.spec se.log.rel.spec lcl.rel.spec
#> 0.6781609195 0.7969348659 1.1751412429 0.0451348840 1.0756505055
#> ucl.rel.spec pval.rel.spec
#> 1.2838342322 0.0003493056
#>
#> $alpha
#> [1] 0.05
#>