Co-Testing Analysis: Combining Diagnostic Tests for Better Clinical Decision Making
ClinicoPath
2025-07-13
Source:vignettes/meddecide-34-cotest-analysis.Rmd
meddecide-34-cotest-analysis.Rmd
Introduction to Co-Testing Analysis
In clinical practice, physicians often use multiple diagnostic tests to improve diagnostic accuracy. The co-testing analysis function in ClinicoPath helps clinicians understand how combining two diagnostic tests affects post-test probabilities and clinical decision-making.
What is Co-Testing?
Co-testing refers to the simultaneous use of two diagnostic tests to improve diagnostic performance. This approach is common in:
- Cancer screening (e.g., mammography + ultrasound)
- Infectious disease diagnosis (e.g., antigen test + PCR)
- Cardiac evaluation (e.g., troponin + ECG)
- Neurological assessment (e.g., MRI + clinical examination)
Understanding Test Independence vs. Dependence
Independent Tests
Tests are conditionally independent when the result of one test doesn’t affect the probability of the other test result, given the disease status.
Mathematical formulation for independent tests: - P(Test1+ and Test2+ | Disease+) = Sensitivity₁ × Sensitivity₂ - P(Test1+ and Test2+ | Disease-) = (1-Specificity₁) × (1-Specificity₂)
Dependent Tests
Tests are conditionally dependent when knowing one test result changes the probability of the other test result, even when disease status is known.
When tests are likely dependent: - Both tests measure similar biological phenomena - Tests use the same specimen or mechanism - Tests are affected by the same confounding factors
Clinical Examples
Example 1: COVID-19 Screening with Independent Tests
Let’s analyze a scenario where we use an antigen test and PCR test for COVID-19 screening, assuming they are independent.
# COVID-19 screening with antigen + PCR (independent)
covid_independent <- cotest(
test1_sens = 0.68, # Antigen test sensitivity
test1_spec = 0.99, # Antigen test specificity
test2_sens = 0.95, # PCR test sensitivity
test2_spec = 0.99, # PCR test specificity
prevalence = 0.05, # Community prevalence (5%)
indep = TRUE, # Assume independence
fagan = TRUE, # Show Fagan nomogram
fnote = TRUE # Show explanatory footnotes
)
print(covid_independent)
Example 2: COVID-19 Screening with Dependent Tests
Now let’s consider the same tests but account for potential dependence (e.g., both tests may be affected by viral load).
# COVID-19 screening with antigen + PCR (dependent)
covid_dependent <- cotest(
test1_sens = 0.68, # Antigen test sensitivity
test1_spec = 0.99, # Antigen test specificity
test2_sens = 0.95, # PCR test sensitivity
test2_spec = 0.99, # PCR test specificity
prevalence = 0.05, # Community prevalence (5%)
indep = FALSE, # Account for dependence
cond_dep_pos = 0.15, # Dependence in COVID+ patients
cond_dep_neg = 0.05, # Dependence in COVID- patients
fagan = TRUE, # Show Fagan nomogram
fnote = TRUE # Show explanatory footnotes
)
print(covid_dependent)
Example 3: Cancer Screening Scenario
Breast cancer screening using mammography and ultrasound in a high-risk population.
# Breast cancer screening in high-risk women
cancer_screening <- cotest(
test1_sens = 0.88, # Mammography sensitivity
test1_spec = 0.92, # Mammography specificity
test2_sens = 0.95, # Ultrasound sensitivity
test2_spec = 0.85, # Ultrasound specificity
prevalence = 0.08, # High-risk population (8% prevalence)
indep = FALSE, # Tests likely dependent
cond_dep_pos = 0.25, # High dependence in cancer patients
cond_dep_neg = 0.15, # Moderate dependence in non-cancer patients
fagan = TRUE,
fnote = TRUE
)
print(cancer_screening)
Example 4: Cardiac Biomarkers in Emergency Department
Evaluating chest pain patients using troponin and CK-MB.
# Cardiac biomarkers for myocardial infarction
cardiac_biomarkers <- cotest(
test1_sens = 0.92, # Troponin sensitivity
test1_spec = 0.89, # Troponin specificity
test2_sens = 0.85, # CK-MB sensitivity
test2_spec = 0.94, # CK-MB specificity
prevalence = 0.25, # ED chest pain patients (25% MI rate)
indep = FALSE, # Biomarkers likely correlated
cond_dep_pos = 0.30, # High correlation in MI patients
cond_dep_neg = 0.20, # Moderate correlation in non-MI patients
fagan = TRUE,
fnote = TRUE
)
print(cardiac_biomarkers)
Practical Guidelines for Co-Testing Analysis
When to Use Independent vs. Dependent Models
Estimating Dependence Parameters
When dependence parameters are unknown:
- Literature Review: Look for studies with paired testing data
- Expert Opinion: Consult specialists familiar with the tests
- Sensitivity Analysis: Test range of plausible values (0.05, 0.1, 0.2, 0.3)
- Conservative Approach: Use moderate dependence (0.1-0.2) when uncertain
# Sensitivity analysis with different dependence levels
scenarios <- list(
"Low Dependence" = 0.05,
"Moderate Dependence" = 0.15,
"High Dependence" = 0.30
)
sensitivity_results <- lapply(names(scenarios), function(scenario_name) {
dep_value <- scenarios[[scenario_name]]
result <- cotest(
test1_sens = 0.85,
test1_spec = 0.90,
test2_sens = 0.80,
test2_spec = 0.95,
prevalence = 0.10,
indep = FALSE,
cond_dep_pos = dep_value,
cond_dep_neg = dep_value
)
cat("\n", scenario_name, "(ρ =", dep_value, "):\n")
print(result)
return(result)
})
Advanced Applications
Sequential vs. Simultaneous Testing
While this function models simultaneous testing, it can inform sequential testing strategies:
# First test: High sensitivity screening test
first_test <- cotest(
test1_sens = 0.95, # High sensitivity screening
test1_spec = 0.80, # Lower specificity acceptable
test2_sens = 0.95, # Dummy second test (same values)
test2_spec = 0.80,
prevalence = 0.05,
indep = TRUE
)
# If first test positive, use confirmatory test
confirmatory_test <- cotest(
test1_sens = 0.95, # Original screening test
test1_spec = 0.80,
test2_sens = 0.85, # Confirmatory test (different characteristics)
test2_spec = 0.98, # Higher specificity
prevalence = 0.25, # Higher prevalence after positive screen
indep = FALSE,
cond_dep_pos = 0.20,
cond_dep_neg = 0.10
)
cat("Sequential Testing Strategy:\n")
cat("Step 1 - Screening Test Results:\n")
print(first_test)
cat("\nStep 2 - Confirmatory Testing (if screen positive):\n")
print(confirmatory_test)
Cost-Effectiveness Considerations
Co-testing analysis can inform cost-effectiveness decisions:
# High-cost, high-accuracy test combination
high_cost_scenario <- cotest(
test1_sens = 0.98, # Expensive, highly accurate test 1
test1_spec = 0.99,
test2_sens = 0.96, # Expensive, highly accurate test 2
test2_spec = 0.99,
prevalence = 0.02, # Low prevalence setting
indep = TRUE,
fagan = TRUE
)
# Moderate-cost, good-accuracy test combination
moderate_cost_scenario <- cotest(
test1_sens = 0.85, # Moderate cost, good accuracy test 1
test1_spec = 0.90,
test2_sens = 0.88, # Moderate cost, good accuracy test 2
test2_spec = 0.92,
prevalence = 0.02, # Same prevalence
indep = TRUE,
fagan = TRUE
)
cat("High-Cost Scenario:\n")
print(high_cost_scenario)
cat("\nModerate-Cost Scenario:\n")
print(moderate_cost_scenario)
Clinical Decision Thresholds
Understanding when co-testing changes clinical decisions:
Treatment Threshold Analysis
# Define clinical scenarios with different action thresholds
scenarios <- data.frame(
Clinical_Setting = c("Screening", "Symptomatic", "High_Risk"),
Prevalence = c(0.01, 0.15, 0.40),
Treatment_Threshold = c(0.05, 0.20, 0.60),
Test_Threshold = c(0.02, 0.08, 0.30)
)
for (i in 1:nrow(scenarios)) {
setting <- scenarios[i, ]
cat("\n", setting$Clinical_Setting, "Setting:\n")
cat("Prevalence:", setting$Prevalence * 100, "%\n")
cat("Treatment threshold:", setting$Treatment_Threshold * 100, "%\n")
result <- cotest(
test1_sens = 0.85,
test1_spec = 0.90,
test2_sens = 0.80,
test2_spec = 0.95,
prevalence = setting$Prevalence,
indep = TRUE
)
print(result)
}
Summary and Best Practices
Key Takeaways
- Co-testing can significantly improve diagnostic accuracy when used appropriately
- Test dependence matters - ignoring it can lead to overoptimistic results
- Clinical context is crucial - consider prevalence, thresholds, and consequences
- Sensitivity analysis helps understand uncertainty in dependence parameters
Best Practices
Before Analysis
- Understand the biological basis for potential test dependence
- Gather accurate sensitivity and specificity data
- Estimate realistic prevalence for your population
- Define clinical decision thresholds
Limitations
- Assumes binary test results (positive/negative)
- Requires known test characteristics
- Dependence parameters may be difficult to estimate
- Does not account for test timing or sequence effects
Conclusion
Co-testing analysis provides a quantitative framework for understanding how multiple diagnostic tests interact to influence clinical decision-making. By properly accounting for test dependence and clinical context, this analysis can guide more informed use of diagnostic testing in clinical practice.
The cotest
function in ClinicoPath makes these complex
calculations accessible to clinicians, providing both numerical results
and visual tools (Fagan nomograms) to support evidence-based medical
decision-making.
This vignette demonstrates the use of the cotest
function for analyzing combined diagnostic tests. For more information
about ClinicoPath, visit our documentation or contact the development
team.