Package 'DTAplots'

Title: Creates Plots Accompanying Bayesian Diagnostic Test Accuracy Meta-Analyses
Description: Function to create forest plots. Functions to use posterior samples from Bayesian bivariate meta-analysis model, Bayesian hierarchical summary receiver operating characteristic (HSROC) meta-analysis model or Bayesian latent class (LC) meta-analysis model to create Summary Receiver Operating Characteristic (SROC) plots using methods described by Harbord et al (2007)<doi:10.1093/biostatistics/kxl004>.
Authors: Ian Schiller [aut, cre], Nandini Dendukuri [ctb]
Maintainer: Ian Schiller <[email protected]>
License: GPL (>= 2)
Version: 1.0.2.5
Built: 2024-08-25 05:55:34 UTC
Source: https://github.com/cran/DTAplots

Help Index


Anti-CCP dataset

Description

This dataset gives the observed cross-tabulation of the Anti-cyclic citrullinated peptide (Anti-CCP) test for rheumatoid arthritis (test under evaluation) and the 1987 revised American college or Rheumatology (ACR) criteria or clinical diagnosis (reference test) for 37 studies.

Usage

data(Anti_CCP)

Format

A data frame with 37 observations on the following 5 variables.

Study

First author and year of publication of the study.

TP

Individuals who tested positive on both tests.

FP

Individuals who tested positive on the test under evaluation and negative on the reference test.

FN

Individuals who tested negative on the test under evaluation and positive on the reference test.

TN

Individuals who tested negative on both tests.

References

Nishimura K, Sugiyama D, Kogata Y, Tsuji G, Nakazawa T, Kawano S, Saigo K, Morinobu A, Koshiba M, Kuntz KM, Kamae I, Kumagai S. Meta-analysis: diagnostic accuracy of anti-cyclic citrullinated peptide antibody and rheumatoid factor for rheumatoid arthritis. Ann Intern Med. 2007 Jun 5;146(11):797-808. doi: 10.7326/0003-4819-146-11-200706050-00008. PMID: 17548411.


Forest plot for sensitivity and specificity

Description

Function to create adjacent forest plots for both sensitivity and specificity also displaying study labels and 2x2 tables

Usage

Forest(Data, study = NULL, level = 0.95, conf.int = "Wilson",
se.axis = NULL, sp.axis = NULL, save_plot = NULL, res = 90,
summary = NULL, digits = 2, summary_label = NULL,
study.cex=1, summary.cex=1.1,
col.headers = c("Study", "TP", "FP", "FN", "TN", "Sens (95% CI)",
"Spec (95% CI)", "Sens (95% CI)", "Spec (95% CI)"))

Arguments

Data

a data frame with the number of rows equal to the number of studies and 4 columns. Each row consists of the entries of the 2x2 table of the index test (i.e. test under evaluation) vs. the reference test reported in each study. The ordering of the columns is ++, +-, -+, –, where the first entry refers to the result of the test under evaluation and the second entry refers to the result of the reference test. The header of the data frame must be "TP", "FP", "FN" and "TN", respectively.

study

a character vector of study/labels, e.g. Author (and Year) for each study. If NULL, the function will generate generic labels : "Study 1, Study 2, ..."

level

confidence level of the confidence intervals for sensitivity and specificity estimates.

conf.int

method used to compute the confidence interval for a biomial proportion. Either "Normal.approx" or "Wilson" (default).

se.axis

x-axis range for sensitivity, based on a vector of 2 components. The first component should be the minimum of the desired x-axis range, while the second component should be the maximum of the desired x-axis range. If NULL (default), the range is calculated from the Data (min,max) of sensitivity.

sp.axis

x-axis range for specificity, based on a vector of 2 components. The first component should be the minimum of the desired x-axis range, while the second component should be the maximum of the desired x-axis range. If NULL (default), the range is calculated from the Data (min,max) of specificity.

save_plot

character string pointing to the directory where the plot will be saved in .jpeg format. If NULL, no plot will be saved.

res

esolution (dpi) of the jpeg file.

summary

Default is NULL. This will add summary point estimates that were calculated externaly. Multiple summary points can be provided. If provided, summary should be in the form of a matrix with with each row representing one summary point made of 6 columns. The columns should be (order matters) : 1- summary point estimate for individuals truly positive (i.e. sensitivity).
2- lower bound of the 95% CI for corresponding summary point estimate.
3- upper bound of the 95% CI for corresponding summary point estimate.
4- summary point estimate for individuals truly negative (i.e. specificity).
5- lower bound of the 95% CI for corresponding summary point estimate.
6- upper bound of the 95% CI for corresponding summary point estimate.

digits

number of decimal places to display for sensitivity/specificity point estimates and respective interval limits. Default = 2.

summary_label

To provide names to the summary point estimates provided by summary argument. Default is NULL

study.cex

Change font size of study labels provided by argument study

summary.cex

Change font size of summary labels provided by argument summary_label

col.headers

To change the headers of the forest plot sections.

Value

No return value

Author(s)

Ian Schiller and Nandini Dendukuri

Examples

# FUNCTION USED WITH DEFAULT ARGUMENTS
data(Anti_CCP)
Forest(Anti_CCP)

# CONFIDENCE INTERVAL BASED ON THE NORMAL APPROXIMATION METHOD
Forest(Anti_CCP, conf.int = "Normal.approx")

# SET THE SENSITIVITY & SPECIFICITY X-AXES FROM 0 TO 1 INSTEAD
Forest(Anti_CCP, se.axis = c(0,1), sp.axis = c(0,1)	)

# PROVIDE STUDY LABELS
Forest(Anti_CCP, study=Anti_CCP$Study)

# To display the sensitivity and specificity summary point estimates previously obtained
# from a Bayesian bivariate meta-analysis model.
data(posterior_samples_Bivariate)
Summary_Se = median(posterior_samples_Bivariate[,1])
Summary_Se_low = quantile(posterior_samples_Bivariate[,1], prob=0.025)
Summary_Se_up = quantile(posterior_samples_Bivariate[,1], prob=0.975)
Summary_Sp = median(posterior_samples_Bivariate[,2])
Summary_Sp_low = quantile(posterior_samples_Bivariate[,2], prob=0.025)
Summary_Sp_up = quantile(posterior_samples_Bivariate[,2], prob=0.975)

Forest(Anti_CCP, study=Anti_CCP$Study, summary = cbind(Summary_Se, Summary_Se_low, Summary_Se_up,
      Summary_Sp, Summary_Sp_low, Summary_Sp_up))

# Random summary point estimates generated for illustrative example
n = 5 # Simulate summary point estimates coming from 5 different models
Summary_Se = runif(n, 0.5,0.6)
Summary_Se_low = runif(n, 0.4, 0.5)
Summary_Se_up = runif(n, 0.6,0.7)
Summary_Sp =runif(n, 0.9,0.95)
Summary_Sp_low = runif(n, 0.85,0.9)
Summary_Sp_up = runif(n, 0.95,1)

Forest(Anti_CCP, study=Anti_CCP$Study, summary = cbind(Summary_Se, Summary_Se_low, Summary_Se_up,
      Summary_Sp, Summary_Sp_low, Summary_Sp_up), summary_label=c("Summary estimate 1",
      "Summary estimate 2", "Summary estimate 3", "Summary estimate 4", "Summary estimate 5"))

Samples of the posterior distributions obtained from a Bayesian bivariate meta-analysis model

Description

This dataset provides a sample from the posterior distributions of the various parameters resulting from a Bayesian bivariate meta-analysis model, that are needed to create a summary plot in the receiver operating characteristic (ROC) space.

The posterior samples were obtained by fitting the Bivariate model using the rjags package to data from a systematic review of anti-cyclic citrullinated peptide antibody (anti-CCP) for rheumatoid arthritis. Overall, 37 studies were meta-analyzed, a total of 3 chains were used with 14,000 burn-in iterations after which we drew 1,000 samples from the posterior distributions for the following parameters:

“mu[1]” for the mean logit-transformed sensitivity.
“mu[2]” for the mean logit-transformed specificity.
“tau[1]” for the between-study standard deviation in the logit-transformed sensitivity.
“tau[2]” for the between-study standard deviation in the logit-transformed specificity.
“rho” for the correlation between the mean logit-transformed sensitivity and the mean logit-transformed specificity.
“se” for the logit-transformed sensitivity in individual studies.
“sp” for the logit-transformed specificity in individual studies.
“Mean_Se” for the mean sensitivity.
“Mean_Sp” for the mean specificity.

Usage

data(posterior_samples_Bivariate)

Format

A matrix with 3,000 samples from the posterior distribution for each of the 81 parameters listed in the description above.

References

Nishimura K, Sugiyama D, Kogata Y, Tsuji G, Nakazawa T, Kawano S, Saigo K, Morinobu A, Koshiba M, Kuntz KM, Kamae I, Kumagai S. Meta-analysis: diagnostic accuracy of anti-cyclic citrullinated peptide antibody and rheumatoid factor for rheumatoid arthritis. Ann Intern Med. 2007 Jun 5;146(11):797-808. doi: 10.7326/0003-4819-146-11-200706050-00008. PMID: 17548411.


Samples of the posterior distributions obtained from a Bayesian HSROC meta-analysis model

Description

This dataset provides a sample from the posterior distributions of the various parameters resulting from a Bayesian hierarchical summary receiver operating characteristic (HSROC) meta-analysis model, that are needed to create a SROC plot in the receiver operating characteristic (ROC) space.

The posterior samples were obtained by fitting the HSROC model using the rjags package to data from a systematic review of anti-cyclic citrullinated peptide antibody (anti-CCP) for rheumatoid arthritis. Overall, 37 studies were meta-analyzed, a total of 3 chains were used with 14,000 burn-in iterations after which we drew 1,000 samples from the posterior distributions for the following parameters:

“THETA” for the overall mean cut-off value for defining a positive test (threshold parameter).
“LAMBDA” for the overall difference in means (accuracy parameter).
“beta” for the logarithm of the ratio of the standard deviation of test results among patients with and without the disease.
“tau[1]” for the standard deviation of the accuracy parameter.
“tau[2]” for the standard deviation of the threshold parameter.
“se” for the individual logit-transformed sensitivity.
“sp” for the individual logit-transformed specificity.

Usage

data(posterior_samples_HSROC)

Format

A matrix with 3,000 samples from the posterior distribution for each of the 79 parameters listed in the description above.

References

Nishimura K, Sugiyama D, Kogata Y, Tsuji G, Nakazawa T, Kawano S, Saigo K, Morinobu A, Koshiba M, Kuntz KM, Kamae I, Kumagai S. Meta-analysis: diagnostic accuracy of anti-cyclic citrullinated peptide antibody and rheumatoid factor for rheumatoid arthritis. Ann Intern Med. 2007 Jun 5;146(11):797-808. doi: 10.7326/0003-4819-146-11-200706050-00008. PMID: 17548411.


Samples of the posterior distributions obtained from a Bayesian latent class (LC) meta-analysis model

Description

This dataset provides a sample from the posterior distributions of various parameters resulting from an extended Bayesian bivariate meta-analysis model which accounts for the reference test to be imperfect. These parameters can then be used to create a summary plot in the receiver operating characteristic (ROC) space.

The posterior samples were obtained by fitting the latent class model using the rjags pacakge to data from a Cochrane Review to assess the accuracy of the GeneXpertTM (Xpert) test for tuberculosis (TB) meningitis in extrapulmonary specimens. In each study the index test was Xpert and the reference standard was culture. Both tests are known to have sub-optimal sensitivity, therefore the true TB meningitis status is unknown. Overall, 29 studies were meta-analyzed, a total of 3 chains were used with 14,000 burn-in iterations after which we drew 1,000 samples from the posterior distributions for the following parameters :

“mu[1]” for the mean logit-transformed sensitivity.
“mu[2]” for the mean logit-transformed specificity.
“tau[1]” for the between-study standard deviation in the logit-transformed sensitivity.
“tau[2]” for the between-study standard deviation in the logit-transformed specificity.
“rho” for the correlation between the mean logit-transformed sensitivity and the mean logit-transformed specificity.
“se” for the logit-transformed sensitivity in individual studies.
“sp” for the logit-transformed specificity in individual studies.
“Mean_Se” for the mean sensitivity.
“Mean_Sp” for the mean specificity.

Usage

data(posterior_samples_Bivariate)

Format

A matrix with 3,000 samples from the posterior distribution for each of the 67 parameters listed in the description above.

References

Kohli M, Schiller I, Dendukuri N, et al. Xpert® MTB/RIF assay for extrapulmonary tuberculosis and rifampicin resistance. Cochrane Database Syst Rev. 2018;8(8):CD012768.


A function to create a summary plot in Receiver Operating Characteristic (ROC) space

Description

This function creates : 1) a plot of the mean sensitivity and mean specificity together with prediction and credible region resulting from a bivariate meta-analysis model, or 2) a summary ROC curve resulting from a hierarchical summary receiver operating characteristic (HSROC) meta-analysis model. It uses posterior samples of ? from these meta-analysis models obtained with rjags package from a meta-analysis bivariate model for diagnostic test accuracy. It allows for the possibility that the reference test is not perfect.

Usage

SROC_rjags(X, n, model = "Bivariate",
dataset = NULL, ref_std=NULL, title = "Summary plot",
xlab = "Specificity", ylab = "Sensitivity",
Se.range=c(0,1), Sp.range=c(0,1),
SROC_curve = FALSE, lwd.curve=3, col.curve="black", lty.curve="solid",
cred_region = TRUE, predict_region = TRUE,
region_level = 0.95, lty.cred.region = "solid",
lty.predict.region = "dotted", trunc_low = 0.025, trunc_up = 0.025,
col.predict.region = "black", col.cred.region = "red",
lwd.cred.region = 2.5, lwd.predict.region = 2.5,
study_col1 = "blue", study_col2 = rgb(0, 0, 1, 0.15),
study_symbol = "circles", summary.point=TRUE,
pch.summary.point = 19, cex.summary.point = 3,
col.summary.point = 1)

Arguments

X

An mcmc.list object. See details for further explanations.

n

Number of studies in the meta-analysis.

model

specify the model used to create X. Default is "Bivariate". Other option is "HSROC". See details for further explanations.

dataset

a matrix with the number of rows equal to the number of studies and 4 columns. Each row consists of the entries of the 2x2 table of the index test (i.e. test under evaluation) vs. the reference test reported in each study. The ordering of the columns is ++, +-, -+, –, where the first entry refers to the result of the test under evaluation and the second entry refers to the result of the reference test. If set to NULL (default), individual posterior estimates of test under evaluation characteristics, i.e. points with coordinate (sensitivity, (1-specificity)), will not be drawn on the SROC plot.

ref_std

if "dataset" is not set to NULL, then "ref_std" must be set to TRUE if the meta-analysis model assumes a perfect reference standard test or to FALSE if the meta-analysis model assumes an imperfect reference standard test.

title

plot title.

xlab

x axis label.

ylab

y axis label.

Se.range

the y-axis limits of the plot.

Sp.range

the x-axis limits of the plot.

SROC_curve

logical. If TRUE, a SROC curve is drawn.

lwd.curve

The line width of the SROC curve, a positive number, defaulting to 3. See "lwd" in "par".

col.curve

A specification for the default color of the SROC curve. Defaults to "black". See "col" in "par".

lty.curve

The SROC curve line type. Default to "solid". See "lty" in "par".

cred_region

logical. If TRUE (default), a credible region curve is drawn on the plot.

predict_region

logical. If TRUE (default), a prediction region curve is drawn on the plot.

region_level

The credible (prediction) level required for the credible (prediction) region. Default value ie 0.95.

lty.cred.region

The credible region line type. Default to "solid". See "lty" in "par".

lty.predict.region

The prediction region line type. Default to "dotted". See "lty" in "par".

trunc_low

Quantile to determine lower limit of threshold THETA used for creating the SROC curve. Default to 0.025. See details for further explanations.

trunc_up

Quantile to determine upper limit of the threshold THETA used for creating the SROC curve. Default to 0.025. See details for further explanations.

col.predict.region

specification for the default plotting color of the prediction region curve. Defaults to "black".

col.cred.region

specification for the default plotting color of the credible region curve. Defaults to "red".

lwd.cred.region

The line width of the credible region curve, a positive number, defaulting to 2.5.

lwd.predict.region

line width of the prediction region, a positive number, defaulting to 2.5.

study_col1

specification for the default plotting color of the individual study point perimeter. Defaults to "blue".

study_col2

specification for the default plotting color of the individual study point shading. Defaults to rgb(0, 0, 1, 0.15).

study_symbol

specification of the type of symbol to represent the individual study point. Either "circles" (default) or "squares".

summary.point

logical. If TRUE (default), a summary point estimate of coordinate (mean specificity, mean sensitivity) is drawn.

pch.summary.point

An integer specifying a symbol to represent the joint mean sensitivity and mean specificity summary point estimate. See "pch" in "par".

cex.summary.point

The magnification to be used for the symbol to represent the joint mean sensitivity and mean specificity summary point estimate.

col.summary.point

A specification for the default color.

Details

If model is set to Bivariate, the function expects that the parameters of the bivariate model have been spelled exactly as follows in the jags model :

“mu[1]” for the mean logit-transformed sensitivity.
“mu[2]” for the mean logit-transformed specificity.
“tau[1]” for the between-study standard deviation in the logit-transformed sensitivity.
“tau[2]” for the between-study standard deviation in the logit-transformed specificity.
“rho” for the correlation between the logit-transformed sensitivity and the mean logit-transformed specificity.
“se” for the logit-transformed sensitivity in individual studies.
“sp” for the logit-transformed specificity in individual studies.
“Summary_Se” for the sensitivity summary estimate.
“Summary_Sp” for the specificity summary estimate.

If model is set to HSROC, the function expects that the parameters of the HSROC model have been spelled exactly as follows in the jags model :

“THETA” for the overall mean cut-off value for defining a positive test (threshold parameter).
“LAMBDA” for the overall difference in means (accuracy parameter).
“beta” for the logarithm of the ratio of the standard deviation of test results among patients with and without the disease.
“tau[1]” for the standard deviation of the accuracy parameter.
“tau[2]” for the standard deviation of the threshold parameter.
“se” for the logit-transformed sensitivity in individual studies.
“sp” for the logit-transformed specificity in individual studies.

The default values for arguments of the function assume the posterior densities provided are for parameters of a Bivariate model. Therefore, it will create a plot with a summary point, credible and prediction region curves.

If the argument SROC_curve is set to true, the function will plot Sensitivity vs Specificity at the posterior mean values of LAMBDA and beta across values of the posterior sample of THETA. The trunc_low and trunc_up arguments truncate the posterior sample of THETA by (trunc_low)*100 to (trunc_up)*100 to ensure the SROC curve remains within the observed scope of the study points.

Value

No return value

Author(s)

Ian Schiller and Nandini Dendukuri

References

Rutter, C. M., and Gatsonis, C. A. (2001) A hierarchical regression approach to meta-analysis of diagnostic accuracy evaluations. Statistics in Medicine, 20(19):2865-2884.

Reitsma, J.B., Glas, A.S., Rutjes, A.W.S., Scholten, R.J.P.M., Bossuyt, P.M. and Zwinderman, A.H. (2005). Bivariate analysis of sensitivity and specificity produces informative summary measures in diagnostic reviews. Journal of Clinical Epideiology 58, 982-90

Harbord, R.M., Deeks, J.J, Egger, M., Whiting, P., and Sterne, J.A. (2007) A unification of models for meta-analysis of diagnostic accuracy studies. Biostatistics 8, 239-251.

Dendukuri, N., Schiller, I., Joseph, L., and Pai, M. (2012) Bayesian meta-analysis of the accuracy of a test for tuberculosis pleuritis in the absence of a gold-standard reference. Biometrics. doi:10.1111/j. 1541-0420.2012.01773.x

Examples

##############################################################################################
# The example requires the rjags output from a bivariate meta-analysis model.
# We use the posterior_samples_Bivariate dataset which contains the results  of a
# bivariate meta-analysis of Anti_CCP dataset.

#The number of studies
data(Anti_CCP)
n=dim(Anti_CCP)[1]

#We load the samples of the posterior distribution
data(posterior_samples_Bivariate)

# Summary plot
SROC_rjags(X=posterior_samples_Bivariate, model="Bivariate",n=n, study_col1="blue",
           study_col2=rgb(0, 0, 1, 0.15), dataset=Anti_CCP[,2:5], ref_std=TRUE)


##########################################################################################
# The example requires the rjags output from a HSROC meta-analysis model.
# We use the posterior_samples_HSROC dataset which contains the results of a
# HSROC meta-analysis of the Anti_CCP dataset.

#The number of studies
data(Anti_CCP)
n=dim(Anti_CCP)[1]

#We load the samples of the posterior distribution
data(posterior_samples_HSROC)

# Summary plot
SROC_rjags(X=posterior_samples_HSROC, model="HSROC",n=n, study_col1="blue",
           study_col2=rgb(0, 0, 1, 0.15), dataset=Anti_CCP[,2:5], ref_std=TRUE,
           SROC_curve = TRUE, cred_region = FALSE, predict_region = FALSE)

##########################################################################################
# The example requires the rjags output from a Bayesian latent class meta-analysis model.
# We use the posterior_samples_LC dataset which contains the results of a
# latent class meta-analysis of the Xpert dataset.

#The number of studies
data(Xpert)
n=dim(Xpert)[1]

#We load the samples of the posterior distribution
data(posterior_samples_LC)

# Summary plot
SROC_rjags(X=posterior_samples_LC, model="Bivariate",n=n, study_col1="blue",
           study_col2=rgb(0, 0, 1, 0.15), dataset=Xpert[,2:5], ref_std=FALSE)

Xpert dataset

Description

This dataset gives the observed cross-tabulation of GeneXpertTM (Xpert) test for tuberculosis (TB) meningitis in extrapulmonary specimens (test under evaluation) and culture (reference test) for 29 studies.

Usage

data(Xpert)

Format

A data frame with 29 observations on the following 5 variables.

Study

First author and year of publication of the study.

++

Individuals who tested positive on both tests.

+-

Individuals who tested positive on the test under evaluation and negative on the reference test.

-+

Individuals who tested negative on the test under evaluation and positive on the reference test.

--

Individuals who tested negative on both tests.

References

Kohli M, Schiller I, Dendukuri N, et al. Xpert® MTB/RIF assay for extrapulmonary tuberculosis and rifampicin resistance. Cochrane Database Syst Rev. 2018;8(8):CD012768.