
Pool diagnostic accuracy for two paired tests
mars_dta_paired.RdFit a Gaussian or multinomial random-effects model for the sensitivity and specificity of two tests applied to the same participants in each study.
Usage
mars_dta_paired(
data,
studyID = "study_id",
stratum = "stratum",
pp = "pp",
pn = "pn",
np = "np",
nn = "nn",
tests = c("test1", "test2"),
zero_cell = c("none", "add_half"),
estimation_method = c("REML", "MLE"),
structure = c("UN", "DIAG1"),
control = list(),
family = c("gaussian", "multinomial"),
quadrature = 11L
)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,pncounts 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.- estimation_method
Restricted maximum likelihood (
"REML", the Gaussian default) or maximum likelihood ("MLE", required for multinomial).- structure
Between-study covariance structure. Use
"UN"(default) for an unstructured matrix or"DIAG1"for separate variances with zero covariances. The matrix is 4-by-4 for Gaussian fits and 2-by-2 for multinomial fits.- control
Named optimizer controls passed to
mars()or tostats::optim()for multinomial fits.- family
Sampling model, either
"gaussian"(default) or"multinomial".- quadrature
Number of adaptive Gauss–Hermite nodes per dimension for multinomial fits, an integer from 3 to 35.
Value
A mars_dta_paired object containing the underlying Gaussian
mars fit (fit), the prepared effects, joint_counts and
sampling_covariance, the correction policy (zero_cell), test labels
(tests), and the labeled between-study covariance (tau).
Multinomial fits contain the optimizer result in fit, raw
joint_counts, stratum-specific association odds ratios
(association), and the between-study covariance of the two common
shifts (tau).
Details
The Gaussian model uses dta_paired_effects() to construct four study-level
logits and their sampling covariance. Both tests must be represented in
every study. At least two studies are required. Both heterogeneity
structures use the full paired sampling covariance. The Gaussian
engine needs invertible sampling blocks. Singular or numerically
singular blocks, such as those from perfectly concordant tests within a
stratum, raise an error identifying the affected studies.
The multinomial model uses the raw four-cell tables and requires
zero_cell = "none". Within each stratum, the log-linear model has
one main effect per test and a fixed interaction. A common normal
study effect shifts both test main effects in that stratum. The study
effects can covary across strata. The interaction is the log odds
ratio of association between the two test results, shared across
studies within that stratum. Empty cells are valid within individual
studies, with each joint outcome observed somewhere in each stratum.
References
Nikoloulopoulos, A. K. (2024). Joint meta-analysis of two diagnostic tests accounting for within and between studies dependence. Statistical Methods in Medical Research, 33(10), 1800–1817. doi:10.1177/09622802241269645 .
Examples
i <- seq_len(24)
make_stratum <- function(stratum, p_a, p_b) {
# Mix independent and concordant positive results in these fictional data.
both <- .7 * p_a * p_b + .3 * pmin(p_a, p_b)
pp <- round(200 * both)
pn <- round(200 * (p_a - both))
np <- round(200 * (p_b - both))
data.frame(study_id = sprintf("s%02d", i), stratum, pp, pn, np,
nn = 200 - pp - pn - np)
}
paired_studies <- rbind(
make_stratum("diseased", plogis(1 + .8 * sin(i)),
plogis(1.4 + .5 * sin(i) + .7 * cos(2 * i))),
make_stratum("non_diseased", plogis(-1.1 + .65 * cos(i)),
plogis(-.8 + .45 * cos(i) + .65 * sin(2 * i)))
)
paired_fit <- mars_dta_paired(paired_studies, tests = c("A", "B"))
summary(paired_fit)$contrasts
#> endpoint test reference difference difference_lower difference_upper
#> 1 sensitivity B A 0.06592716 0.02756036 0.10429397
#> 2 specificity B A -0.06109458 -0.10218769 -0.02000147
#> odds_ratio odds_ratio_lower odds_ratio_upper
#> 1 1.4393821 1.164742 1.7787809
#> 2 0.7366104 0.604432 0.8976939