Skip to contents

Compute logit sensitivity and specificity for two tests applied to the same participants, with one threshold per test.

Usage

dta_paired_effects(
  data,
  studyID = "study_id",
  stratum = "stratum",
  pp = "pp",
  pn = "pn",
  np = "np",
  nn = "nn",
  tests = c("test1", "test2"),
  zero_cell = c("none", "add_half")
)

Arguments

data

Data frame with two rows per study, one for each reference-standard stratum.

studyID, stratum

Names of the study identifier and stratum columns. Strata must be labeled "diseased" and "non_diseased".

pp, pn, np, nn

Names of the joint count columns. The letters indicate positive (p) or negative (n) results in the order test 1, test 2. For example, pn counts participants positive on test 1 and negative on test 2. Counts must be finite nonnegative integers, and both strata must have positive totals.

tests

Two distinct test labels, in the order used by the count columns.

zero_cell

Use "none" (the default) to require finite logits. With "add_half", add 0.5 to all four joint cells in a stratum when either test has a zero marginal success or failure count. Empty joint cells alone do not trigger a correction.

Value

A list with effects, a data frame with four rows per study containing test and endpoint labels, raw marginal counts, correction flags, logits (yi), and variances (vi); sampling_covariance, a named list of 4-by-4 matrices with dimensions labeled by effect_id; joint_counts, the raw joint tables with the amount added per cell (added); and zero_cell, the selected correction policy. The effects and covariance matrices use the order sensitivity then specificity for test 1, followed by sensitivity then specificity for test 2. Study order follows first appearance in data. Use study_id and effect_id together to identify an effect across studies.

Details

Both tests and the reference standard must be observed for the participants represented in the counts. Sensitivity uses positive results in the diseased stratum. Specificity uses negative results in the non-diseased stratum.

The covariance uses a multinomial delta approximation within each stratum. For each test, the logit is the log success count minus the log failure count. Its derivative with respect to a joint cell count is the reciprocal success count for a success cell and the negative reciprocal failure count for a failure cell. The cross-stratum sampling covariances are zero, conditional on the stratum totals. Exact singularities, for example when the tests always agree in a stratum, are retained.

References

Nikoloulopoulos, A. K. (2024). Joint meta-analysis of two diagnostic tests accounting for within and between studies dependence. Statistical Methods in Medical Research. doi:10.1177/09622802241269645

Examples

joint <- data.frame(study_id = "s1", stratum = c("diseased", "non_diseased"),
                    pp = c(20, 4), pn = c(8, 6), np = c(7, 9), nn = c(5, 31))
dta_paired_effects(joint)$sampling_covariance
#> $s1
#>                   test1:sensitivity test1:specificity test2:sensitivity
#> test1:sensitivity        0.11904762        0.00000000        0.01492335
#> test1:specificity        0.00000000        0.12500000        0.00000000
#> test2:sensitivity        0.01492335        0.00000000        0.11396011
#> test2:specificity        0.00000000        0.01819127        0.00000000
#>                   test2:specificity
#> test1:sensitivity        0.00000000
#> test1:specificity        0.01819127
#> test2:sensitivity        0.00000000
#> test2:specificity        0.10395010
#>