Type: Package
Title: Network Meta-Analysis of Multiple Diagnostic Tests
Version: 0.1.1
Maintainer: Xing Xing <xxing8@jh.edu>
Depends: R (≥ 4.0.0)
Imports: rjags (≥ 4-6), coda, ggplot2, ks, reshape2, MCMCpack, MASS, plotrix, graphics, stats, grDevices, Rdpack
SystemRequirements: JAGS 4.x.y (http://mcmc-jags.sourceforge.net)
Description: Provides statistical methods for network meta-analysis of 1–5 diagnostic tests to simultaneously compare multiple tests within a missing data framework, including: - Bayesian hierarchical model for network meta-analysis of multiple diagnostic tests (Ma, Lian, Chu, Ibrahim, and Chen (2018) <doi:10.1093/biostatistics/kxx025>) - Bayesian Hierarchical Summary Receiver Operating Characteristic Model for Network Meta-Analysis of Diagnostic Tests (Lian, Hodges, and Chu (2019) <doi:10.1080/01621459.2018.1476239>).
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
RdMacros: Rdpack
Encoding: UTF-8
RoxygenNote: 7.3.3
Suggests: testthat
NeedsCompilation: no
LazyData: true
Packaged: 2025-10-29 14:30:21 UTC; kevinxing
Author: Xing Xing ORCID iD [aut, cre], Boyang Lu [aut], Lifeng Lin [aut], Qinshu Lian [aut], James S. Hodges [aut], Yong Chen [aut], Haitao Chu ORCID iD [aut]
Repository: CRAN
Date/Publication: 2025-10-29 14:50:02 UTC

Study-level results on the multiple diagnostic tests for colorectal cancer detection

Description

dat.kang provides an example dataset for hierarchical network meta-analysis of diagnostic test accuracy under the missing not at random (MNAR) assumption. The dataset is extracted from (Kang et al. 2013) and contains study-level results from multiple diagnostic tests for colorectal cancer detection. Each record corresponds to a study arm with test outcomes and missingness indicators.

Usage

data(dat.kang)

Format

A data frame with 48 observations and 8 variables:

sid

Study identifier (integer)

delta0

Missing indicator for test 0 (1 = observed, 0 = missing)

delta1

Missing indicator for test 1 (1 = observed, 0 = missing)

delta2

Missing indicator for test 2 (1 = observed, 0 = missing)

T0

Test 0 result (1 = positive, 0 = negative, 999 = not applicable)

T1

Test 1 result (1 = positive, 0 = negative, 999 = not applicable)

T2

Test 2 result (1 = positive, 0 = negative, 999 = not applicable)

n

Sample size for the corresponding cell

Source

Kang J, Brant R, Ghali WA (2013). “Statistical Methods for the Meta-Analysis of Diagnostic Tests Must Take into Account the Use of Surrogate Standards.” Journal of Clinical Epidemiology, 66(5), 566–574. doi:10.1016/j.jclinepi.2012.12.008.

Examples

data(dat.kang)
head(dat.kang)

Hierarchical Model for Network Meta-Analysis of Diagnostic Accuracy Studies

Description

nmadt.hierarchical performs meta-analysis using the hierarchical model (Ma et al. 2018) and outputs CIs for accuracy measurements.

Usage

nmadt.hierarchical(
  nstu,
  K,
  data,
  testname,
  directory = NULL,
  diag = 5,
  off_diag = 0.05,
  digits = 4,
  mu_alpha = 0,
  mu_beta = 0,
  mu_eta = -0,
  preci_alpha = 0.1,
  preci_beta = 0.1,
  preci_eta = 0.1,
  n.adapt = 5000,
  n.iter = 50000,
  n.chains = 3,
  n.burnin = floor(n.iter/2),
  n.thin = max(1, floor((n.iter - n.burnin)/50000)),
  conv.diag = FALSE,
  trace = NULL,
  dic = FALSE,
  mcmc.samples = FALSE
)

Arguments

nstu

an integer indicating the number of studies included in the dataset.

K

an integer indicating the number of candiate test in the dataset.

data

a list conating the input dataset to be used for meta-analysis.

testname

a string vector of the names of the candidate tests in the dataset in the same order as presetned in the dataset.

directory

a string specifying the designated directory to save trace plots or potential scale reduction factors calculated in the function. The default is NULL.

diag

a number indicating the value of diagonal entries of the scale matrix R of the precision matrix \Sigma. The default is 5.

off_diag

a number indicating the value of off-diagonal entries of the scale matrix R of the precision matrix \Sigma. The default is 0.05.

digits

a positive integer he number of digits to the right of the decimal point to keep for the results; digits=4 by default.

mu_alpha

a number indicating the mean of the normal distribution that the prior of the fixed effect for sensitivity follows. The default is 0.

mu_beta

a number indicating the mean of the normal distribution that the prior of the fixed effect for specificity follows. The default is 0.

mu_eta

a number indicating the mean of the normal distribution that the prior of the fixed effect for prevalence follows. The default is 0.

preci_alpha

a number indicating the precision of the normal distribution that the prior of the fixed effect for sensitivity follows. The default is 0.1.

preci_beta

a number indicating the precision of the normal distribution that the prior of the fixed effect for specificity follows. The default is 0.1.

preci_eta

a number indicating the precision of the normal distribution that the prior of the fixed effect for prevalence follows. The default is 0.1.

n.adapt

a positive integer indicating the number of iterations for adaptation. The default is 5,000.

n.iter

a postive integer indicating the number of iterations in each MCMC chain. The default is 50,000.

n.chains

a postive interger indicating the number of MCMC chains. The default is 3.

n.burnin

a positive integer indicating the number of burn-in iterations at the beginning of each chain without saving any of the posterior samples. The default is floor(n.iter/2).

n.thin

the thinning rate for MCMC chains, which is used to save memory and computation time when n.iter is large. For example, the algorithm saves only one sample in every nth iteration, where n is given by n.thin.

conv.diag

a logical value specifying whether to compute potential scale reduction factors proposed for convergence diagnostics. The default is FALSE.

trace

a string vector containing a subset of different quantities which can be chosen from prevalence("prev"), sensitivity ("Se"), specificity ("Sp"), positive and negative predictive values ("ppv" and "npv" repectively), positive likelihood ("LRpos"), and negative likelihood ("LRneg").

dic

a logical value indicating whether the function will output the deviance information criterion (DIC) statistic. The default is false.

mcmc.samples

a logical value indicating whether the coda samples generated in the meta-analysis. The default is FALSE.

Value

A list with the raw output for graphing the results, the effect size estimates, which lists the posterior mean, standard deviation, median, and a $95$% equal tail credible interval for the median.

Note

This example uses a small number of MCMC iterations (n.iter = 500) for demonstration. For real-world analyses, longer chains (e.g., n.iter = 50000) are recommended to achieve convergence and stable posterior summaries.

References

Ma X, Lian Q, Chu H, Ibrahim JG, Chen Y (2018). “A Bayesian hierarchical model for network meta-analysis of multiple diagnostic tests.” Biostatistics, 19(1), 87–102. ISSN 14684357, doi:10.1093/biostatistics/kxx025.

Examples


data(dat.kang)
set.seed(9)
kang.out <- nmadt.hierarchical(nstu = 12, K = 2, data = dat.kang,
                               directory = tempdir(), testname = c("D-dimer", "Ultrasonography"),
                               diag = 5, off_diag = 0.05, digits = 4, mu_alpha = 0, mu_beta = 0,
                               mu_eta = 0, preci_alpha = 0.1, preci_beta = 0.1, preci_eta = 0.1,
                               n.adapt = 1000, n.iter = 500, n.chains = 3, conv.diag = TRUE,
                               trace = "prev", dic = TRUE, mcmc.samples = FALSE)


Hierarchical Model Network Meta-Analysis of Diagnostic Accuracy Studies Under MNAR Assumptions

Description

nmadt.hierarchical.MNAR performs meta-analysis using the hierarchical model (Ma et al. 2018) based on the missing not at random(MNAR) assumption.

Usage

nmadt.hierarchical.MNAR(
  nstu,
  K,
  data,
  testname,
  directory = NULL,
  diag = 5,
  off_diag = 0.05,
  digits = 4,
  mu_alpha = 0,
  mu_beta = 0,
  mu_eta = -0,
  preci_alpha = 0.1,
  preci_beta = 0.1,
  preci_eta = 0.1,
  gamma1,
  gamma0,
  mu_gamma = 0,
  preci_gamma = 1,
  n.burnin = floor(n.iter/2),
  n.thin = max(1, floor((n.iter - n.burnin)/1e+05)),
  n.adapt = 5000,
  n.iter = 50000,
  n.chains = 3,
  conv.diag = FALSE,
  trace = NULL,
  dic = FALSE,
  mcmc.samples = FALSE
)

Arguments

nstu

an integer indimessageing the number of studies included in the dataset.

K

an integer indicating the number of candiate test in the dataset.

data

a list conating the input dataset to be used for meta-analysis.

testname

a string vector of the names of the candidate tests in the dataset in the same order as presetned in the dataset.

directory

a string specifying the designated directory to save trace plots or potential scale reduction factors calculated in the function. The default is NULL.

diag

a number indicating the value of diagonal entries of the scale matrix R of the precision matrix \Sigma. The default is 5.

off_diag

a number indicating the value of off-diagonal entries of the scale matrix R of the precision matrix \Sigma. The default is 0.05.

digits

a positive integer he number of digits to the right of the decimal point to keep for the results; digits=4 by default.

mu_alpha

a number indicating the mean of the normal distribution that the prior of the fixed effect for sensitivity follows. The default is 0.

mu_beta

a number indicating the mean of the normal distribution that the prior of the fixed effect for specificity follows. The default is 0.

mu_eta

a number indicating the mean of the normal distribution that the prior of the fixed effect for prevalence follows. The default is 0.

preci_alpha

a number indicating the precision of the normal distribution that the prior of the fixed effect for sensitivity follows. The default is $0.1$.

preci_beta

a number indicating the precision of the normal distribution that the prior of the fixed effect for specificity follows. The default is $0.1$.

preci_eta

a number indicating the precision of the normal distribution that the prior of the fixed effect for prevalence follows. The default is $0.1$.

gamma1

a vector indicating coefficients of study-specific sensitivity in the MNAR model.

gamma0

a vector indicating coefficients of study-specific specificity in the MNAR model.

mu_gamma

a number specifying mean of intercept in the MNAR model. The default is 0.

preci_gamma

a number specifying precision of intercept in the MNAR model. The default is 1.

n.burnin

a positive integer indicating the number of burn-in iterations at the beginning of each chain without saving any of the posterior samples. The default is floor(n.iter/2).

n.thin

the thinning rate for MCMC chains, which is used to save memory and computation time when n.iter is large. For example, the algorithm saves only one sample in every nth iteration, where n is given by n.thin.

n.adapt

a positive integer indicating the number of iterations for adaptation. The default is 5,000.

n.iter

a postive integer indicating the number of iterations in each MCMC chain. The default is 50,000.

n.chains

a postive interger indicating the number of MCMC chains. The default is 3.

conv.diag

a logical value specifying whether to compute potential scale reduction factors proposed for convergence diagnostics. The default is FALSE.

trace

a string vector containing a subset of different quantities which can be chosen from prevalence("prev"), sensitivity ("Se"), specificity ("Sp"), positive and negative predictive values ("ppv" and "npv" repectively), positive likelihood ("LRpos"), and negative likelihood ("LRneg").

dic

a logical value indicating whether the function will output the deviance information criterion (DIC) statistic. The default is false.

mcmc.samples

a logical value indicating whether the coda samples generated in the meta-analysis. The default is FALSE.

Value

A list with the raw output for graphing the results, the effect size estimates, which lists the posterior mean, standard deviation, median, and a $95$% equal tail credible interval for the median.

Note

This example uses a small number of MCMC iterations (n.iter = 1000) for demonstration. For real-world analyses, longer chains (e.g., n.iter = 50000) are recommended to achieve convergence and stable posterior summaries.

References

Ma X, Lian Q, Chu H, Ibrahim JG, Chen Y (2018). “A Bayesian hierarchical model for network meta-analysis of multiple diagnostic tests.” Biostatistics, 19(1), 87–102. ISSN 14684357, doi:10.1093/biostatistics/kxx025.

Examples

data(dat.kang)
set.seed(9)
kang.out <- nmadt.hierarchical.MNAR(nstu = 12, K = 2, data = dat.kang,
                                   directory = tempdir(), 
                                   testname = c("D-dimer", "Ultrasonography"),
                                   n.adapt = 1000, n.iter = 1000, n.chains = 3,
                                   gamma1=c(-0.5,-0.5), gamma0=c(-0.5,-0.5))

HSROC Model for Network Meta-Analysis of Diagnostic Accuracy Studies

Description

nmadt.hsroc performs network meta-analysis of diagnostic tests using the HSROC (hierarchical summary receiver operating characteristic) model (Lian et al. 2019) and outputs estimations of accuracy measurements.

Usage

nmadt.hsroc(
  nstu,
  K,
  data,
  testname,
  directory = NULL,
  eta = 0,
  xi_preci = 1.25,
  digits = 4,
  n.adapt = 5000,
  n.iter = 50000,
  n.chains = 3,
  n.burnin = floor(n.iter/2),
  n.thin = max(1, floor((n.iter - n.burnin)/1e+05)),
  conv.diag = FALSE,
  trace = NULL,
  dic = FALSE,
  mcmc.samples = FALSE
)

Arguments

nstu

an integer indicating the number of studies included in the dataset.

K

an integer indicating the number of candiate test in the dataset.

data

a list conating the input dataset to be used for meta-analysis.

testname

a string vector of the names of the candidate tests in the dataset in the same order as presetned in the dataset.

directory

a string specifying the designated directory to save trace plots or potential scale reduction factors calculated in the function. The default is NULL.

eta

a number indicating the mean of log(S) and log(P) which determines the covariance matrices of the cutoff values and accuracy values respectively. The default is 0.

xi_preci

a number indicating the precision of log(S) and log(P) which determines the covariance matrices of the cutoff values and accuracy values respectively. The default is 1.25.

digits

a positive integer he number of digits to the right of the decimal point to keep for the results; digits=4 by default.

n.adapt

a positive integer indicating the number of iterations for adaptation. The default is 5,000.

n.iter

a postive integer indicating the number of iterations in each MCMC chain. The default is 50,000.

n.chains

a postive interger indicating the number of MCMC chains. The default is 3.

n.burnin

a positive integer indicating the number of burn-in iterations at the beginning of each chain without saving any of the posterior samples. The default is floor(n.iter/2).

n.thin

the thinning rate for MCMC chains, which is used to save memory and computation time when n.iter is large. For example, the algorithm saves only one sample in every nth iteration, where n is given by n.thin.

conv.diag

a logical value specifying whether to compute potential scale reduction factors proposed for convergence diagnostics. The default is FALSE.

trace

a string vector containing a subset of different quantities which can be chosen from prevalence("prev"), sensitivity ("Se"), specificity ("Sp"), positive and negative predictive values ("ppv" and "npv" repectively), positive likelihood ("LRpos"), and negative likelihood ("LRneg").

dic

a logical value indicating whether the function will output the deviance information criterion (DIC) statistic. The default is false.

mcmc.samples

a logical value indicating whether the coda samples generated in the meta-analysis. The default is FALSE.

Value

A list with the raw output for graphing the results, the effect size estimates, which lists the posterior mean, standard deviation, median, and a $95$% equal tail credible interval for the median.

References

Lian Q, Hodges JS, Chu H (2019). “A Bayesian Hierarchical Summary Receiver Operating Characteristic Model for Network Meta-Analysis of Diagnostic Tests.” Journal of the American Statistical Association, 114(527), 949-961. doi:10.1080/01621459.2018.1476239.

Examples


data(dat.kang)
set.seed(9)
kang.out.hsroc <- nmadt.hsroc(nstu=12, K=2, data=dat.kang, testname=c("D-dimer","Ultrasonography"))


HSROC Model for Network Meta-Analysis of Diagnostic Accuracy Studies Under MNAR Assumptions

Description

nmadt.hsroc.MNAR performs network meta-analysis of diagnostic tests using the HSROC (hierarchical summary receiver operating characteristic) model (Lian et al. 2019) based on the MNAR assumption.

Usage

nmadt.hsroc.MNAR(
  nstu,
  K,
  data,
  testname,
  directory = NULL,
  eta = 0,
  xi_preci = 1.25,
  digits = 4,
  gamma1,
  gamma0,
  mu_gamma = 0,
  preci_gamma = 1,
  n.adapt = 10000,
  n.iter = 50000,
  n.chains = 3,
  n.burnin = floor(n.iter/2),
  n.thin = max(1, floor((n.iter - n.burnin)/1e+05)),
  conv.diag = FALSE,
  trace = NULL,
  dic = FALSE,
  mcmc.samples = FALSE
)

Arguments

nstu

an integer indicating the number of studies included in the dataset.

K

an integer indicating the number of candiate test in the dataset.

data

a list conating the input dataset to be used for meta-analysis.

testname

a string vector of the names of the candidate tests in the dataset in the same order as presetned in the dataset.

directory

a string specifying the designated directory to save trace plots or potential scale reduction factors calculated in the function. The default is NULL.

eta

a number indicating the mean of log(S) and log(P) which determines the covariance matrices of the cutoff values and accuracy values respectively. The default is 0.

xi_preci

a number indicating the precision of log(S) and log(P) which determines the covariance matrices of the cutoff values and accuracy values respectively. The default is 1.25.

digits

a positive integer he number of digits to the right of the decimal point to keep for the results; digits=4 by default.

gamma1

a vector indicating coefficients of study-specific sensitivity in the MNAR model.

gamma0

a vector indicating coefficients of study-specific specificity in the MNAR model.

mu_gamma

a number specifying mean of intercept in the MNAR model. The default is 0.

preci_gamma

a number specifying precision of intercept in the MNAR model. The default is 1.

n.adapt

a positive integer indicating the number of iterations for adaptation. The default is 5,000.

n.iter

a postive integer indicating the number of iterations in each MCMC chain. The default is 50,000.

n.chains

a postive interger indicating the number of MCMC chains. The default is 3.

n.burnin

a positive integer indicating the number of burn-in iterations at the beginning of each chain without saving any of the posterior samples. The default is floor(n.iter/2).

n.thin

the thinning rate for MCMC chains, which is used to save memory and computation time when n.iter is large. For example, the algorithm saves only one sample in every nth iteration, where n is given by n.thin.

conv.diag

a logical value specifying whether to compute potential scale reduction factors proposed for convergence diagnostics. The default is FALSE.

trace

a string vector containing a subset of different quantities which can be chosen from prevalence("prev"), sensitivity ("Se"), specificity ("Sp"), positive and negative predictive values ("ppv" and "npv" repectively), positive likelihood ("LRpos"), and negative likelihood ("LRneg").

dic

a logical value indicating whether the function will output the deviance information criterion (DIC) statistic. The default is false.

mcmc.samples

a logical value indicating whether the coda samples generated in the meta-analysis. The default is FALSE.

Value

A list with the raw output for graphing the results, the effect size estimates, which lists the posterior mean, standard deviation, median, and a $95$% equal tail credible interval for the median.

References

Lian Q, Hodges JS, Chu H (2019). “A Bayesian Hierarchical Summary Receiver Operating Characteristic Model for Network Meta-Analysis of Diagnostic Tests.” Journal of the American Statistical Association, 114(527), 949-961. doi:10.1080/01621459.2018.1476239.

Examples


data(dat.kang)
set.seed(9)
kangMNAR.out.hsroc <- nmadt.hsroc.MNAR(nstu=12, K=2, data=dat.kang,
testname=c("D-dimer","Ultrasonography"),gamma1=c(-0.5,-0.5), gamma0=c(-0.5,-0.5))


Plot method for 'nmadt' objects

Description

This method automatically generates diagnostic meta-analysis plots based on the fitted 'nmadt' object and the specified plot 'type'.

Usage

## S3 method for class 'nmadt'
plot(x, type = c("sroc", "density", "forest", "contour"), ...)

Arguments

x

An object of class 'nmadt', typically produced by one of the model-fitting functions:

  • nmadt.hierarchical() — hierarchical model under MAR assumption;

  • nmadt.hsroc() — HSROC model under MAR assumption;

  • nmadt.hierarchical.MNAR() — hierarchical model allowing for MNAR (missing not at random) mechanism;

  • nmadt.hsroc.MNAR() — HSROC model allowing for MNAR mechanism.

These functions all return an object of class 'nmadt' suitable for plotting.

type

Character string specifying the type of plot to generate. One of "sroc", "density", "forest", or "contour". Defaults to "sroc" if not specified.

...

Additional arguments passed to the underlying plotting functions (e.g., graphical parameters such as cex.axis, cex.lab, etc.).

Details

The available plot types are:

"sroc" (default)

Summary Receiver Operating Characteristic (SROC) curve. Visualizes the trade-off between sensitivity and specificity across studies, along with the hierarchical model fit.

"density"

Posterior density plots for study- and test-level sensitivity and specificity parameters. Useful for checking convergence and posterior uncertainty.

"forest"

Forest plot summarizing point estimates and uncertainty intervals for sensitivity and specificity of each test across studies. Helpful for visualizing study heterogeneity.

"contour"

Contour-enhanced plots showing joint posterior density of sensitivity and specificity for each test or study. Useful for visual comparison of test performance.

If type is not specified, the function defaults to "sroc". For example, both plot(x) and plot(x, type = "sroc") will produce the SROC plot.

Value

Invisibly returns the input 'nmadt' object x. The function is primarily called for its side effect of generating plots rather than returning a value.

Examples


data(dat.kang)
set.seed(9)
kang.out <- nmadt.hierarchical(nstu=12, K=2, data=dat.kang, 
            testname=c("D-dimer","Ultrasonography"))
plot(kang.out, type = "sroc")
plot(kang.out, type = "forest")
plot(kang.out, type = "contour")
plot(kang.out, type = "density")



Print method for 'nmadt' objects

Description

Print method for 'nmadt' objects

Usage

## S3 method for class 'nmadt'
print(x, ...)

Arguments

x

An object of class 'nmadt'

...

Not used. Included for S3 method compatibility.

Examples


data(dat.kang)
set.seed(9)
kang.out <- nmadt.hierarchical(nstu=12, K=2, data=dat.kang, 
            testname=c("D-dimer","Ultrasonography"))
print(kang.out) 



Summary method for 'nmadt' objects

Description

Provides a concise summary of posterior results from network meta-analysis of diagnostic tests fitted using the NMADTA framework. Displays median estimates and 95 sensitivity, specificity, predictive values, likelihood ratios, and prevalence.

Usage

## S3 method for class 'nmadt'
summary(object, ...)

Arguments

object

An object of class nmadt, typically created by nmadt.hierarchical() or nmadt.hsroc().

...

Additional arguments (currently not used).

Details

The function extracts and prints key posterior summaries from the fitted model, including medians and 95

The output is formatted for human readability, with each section clearly labeled.

Value

The function returns the input object (invisibly) after printing the summary.

Examples


data(dat.kang)
set.seed(9)
kang.out <- nmadt.hierarchical(nstu=12, K=2, data=dat.kang, 
            testname=c("D-dimer","Ultrasonography"))
summary(kang.out)