Skip to contents

Fit a Gaussian or multinomial random-effects model for the sensitivity and specificity of one test evaluated at multiple cutoffs.

Usage

mars_dta_thresholds(
  data,
  studyID = "study_id",
  threshold = "threshold",
  tp = "TP",
  fn = "FN",
  fp = "FP",
  tn = "TN",
  positive = c("higher", "lower"),
  zero_cell = c("none", "add_half"),
  estimation_method = c("REML", "MLE"),
  structure = c("DIAG1", "UN"),
  control = list(),
  family = c("gaussian", "multinomial"),
  quadrature = 11L
)

Arguments

data

Data frame with one row per study and reported cutoff. Both reference-standard strata must be represented at each cutoff.

studyID, threshold

Names of the study identifier and numeric cutoff columns. Use comparable cutoffs on the same scale across studies.

tp, fn, fp, tn

Names of the true-positive, false-negative, false-positive, and true-negative count columns. Counts must be finite nonnegative integers, with constant positive stratum totals across cutoffs within each study.

positive

Use "higher" for a positive result at or above the cutoff, or "lower" for a positive result at or below it.

zero_cell

Use "none" (default) to require finite logits. With "add_half", if a stratum has a zero marginal count at any cutoff, add 0.5 to each reconstructed score bin in that stratum.

estimation_method

Restricted maximum likelihood ("REML", default) or maximum likelihood ("MLE"). Multinomial fits use ML.

structure

Between-study covariance. The default "DIAG1" fits separate variances for each endpoint and cutoff. "UN" also estimates their covariances. Both use the full within-study sampling blocks for Gaussian fits. For multinomial fits, "UN" (the default) allows correlated study-level score locations across the two strata and "DIAG1" estimates independent location effects.

control

Named optimizer controls passed to mars() for Gaussian fits or to stats::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_thresholds object containing the underlying mars fit (fit), labeled between-study covariance (tau), and all components returned by dta_threshold_effects() for Gaussian fits. Multinomial fits contain the optimizer result in fit, the raw score_bins, cutoffs, and a parameters table with fitted locations and scales. The multinomial tau measures between-study location covariance in squared score units.

Details

Supply at least two distinct cutoffs overall. Studies may report different subsets. Gaussian fits require at least two studies per cutoff. For Gaussian "UN", each pair of cutoffs must be reported together in at least one study. Each study's sampling block must be invertible. The fitting function identifies affected studies when a block is singular or nearly singular.

Gaussian fits estimate separate means at each observed cutoff. Their ordering is unconstrained, so the estimates can be nonmonotone.

Multinomial fits use the raw score bins, with one logistic distribution per reference-standard stratum. Each stratum has its own mean location and scale, with normally distributed study-level location effects. The within-study likelihood integrates the product of the two multinomial probabilities over these effects. Empty bins are valid and zero_cell must be "none". The scales are shared across studies within each stratum. For numerical optimization, log scales in standardized cutoff units are bounded between -12 and 12.

References

Hamza, T. H., et al. (2009). Multivariate random effects meta-analysis of diagnostic tests with multiple thresholds. BMC Medical Research Methodology, 9, 73. doi:10.1186/1471-2288-9-73

Jones, H. E., Gatsonis, C. A., Trikalinos, T. A., Welton, N. J., and Ades, A. E. (2019). Quantifying how diagnostic test accuracy depends on threshold in a meta-analysis. Statistics in Medicine, 38(24), 4789–4803. doi:10.1002/sim.8301 .

Examples

i <- seq_len(24)
threshold_studies <- do.call(rbind, lapply(0:2, function(cutoff) {
  TP <- round(200 * plogis(1.6 - .9 * cutoff + .65 * sin(i) + .15 * cutoff * cos(2 * i)))
  FP <- round(200 * plogis(.2 - 1.05 * cutoff + .55 * cos(i) + .15 * cutoff * sin(2 * i)))
  data.frame(study_id = sprintf("s%02d", i), threshold = cutoff,
             TP = TP, FN = 200 - TP, FP = FP, TN = 200 - FP)
}))
fit <- mars_dta_thresholds(threshold_studies)
summary(fit)$pooled
#>   threshold    endpoint     effect_id studies  estimate     lower     upper
#> 1         0 sensitivity 0:sensitivity      24 0.8264547 0.8015392 0.8488321
#> 2         0 specificity 0:specificity      24 0.4557537 0.4251023 0.4867439
#> 3         1 sensitivity 1:sensitivity      24 0.6631136 0.6248844 0.6993215
#> 4         1 specificity 1:specificity      24 0.7001950 0.6749023 0.7243237
#> 5         2 sensitivity 2:sensitivity      24 0.4477836 0.4028334 0.4936037
#> 6         2 specificity 2:specificity      24 0.8650150 0.8482488 0.8801904