Function for analyzing combined results of two concurrent diagnostic tests. Calculates post-test probabilities based on various scenarios (either test positive, both positive, both negative).
Usage
cotest(
test1_sens = 0.8,
test1_spec = 0.9,
test2_sens = 0.75,
test2_spec = 0.95,
indep = TRUE,
cond_dep_pos = 0.05,
cond_dep_neg = 0.05,
prevalence = 0.1,
fnote = FALSE,
fagan = FALSE,
preset = "custom"
)Arguments
- test1_sens
Sensitivity (true positive rate) of Test 1.
- test1_spec
Specificity (true negative rate) of Test 1.
- test2_sens
Sensitivity (true positive rate) of Test 2.
- test2_spec
Specificity (true negative rate) of Test 2.
- indep
Assume tests are conditionally independent (default is true).
- cond_dep_pos
Conditional dependence between tests for subjects with disease. Value between 0 (independence) and 1 (complete dependence).
- cond_dep_neg
Conditional dependence between tests for subjects without disease. Value between 0 (independence) and 1 (complete dependence).
- prevalence
Prior probability (disease prevalence in the population). Requires a value between 0.001 and 0.999.
- fnote
.
- fagan
.
- preset
Select a clinical preset or use custom values. Presets load evidence-based sensitivity and specificity values from medical literature with appropriate dependence parameters and prevalence estimates.
Value
A results object containing:
results$testParamsTable | a table | ||||
results$cotestResultsTable | a table | ||||
results$dependenceInfo | a html | ||||
results$dependenceExplanation | a html | ||||
results$explanation | a html | ||||
results$plot1 | an image |
Tables can be converted to data frames with asDF or as.data.frame. For example:
results$testParamsTable$asDF
as.data.frame(results$testParamsTable)
Examples
# Basic co-testing analysis with independent tests
cotest(
test1_sens = 0.80,
test1_spec = 0.90,
test2_sens = 0.75,
test2_spec = 0.95,
prevalence = 0.10,
indep = TRUE,
fagan = TRUE
)
# Co-testing with dependent tests
cotest(
test1_sens = 0.85,
test1_spec = 0.88,
test2_sens = 0.82,
test2_spec = 0.92,
prevalence = 0.05,
indep = FALSE,
cond_dep_pos = 0.15,
cond_dep_neg = 0.10,
fnote = TRUE
)
# High-stakes screening scenario
cotest(
test1_sens = 0.95,
test1_spec = 0.85,
test2_sens = 0.90,
test2_spec = 0.90,
prevalence = 0.02,
indep = TRUE,
fagan = TRUE,
fnote = TRUE
)