Skip to contents

Estimate decision curves for a list of predictive models and/or binary tests all at once. Necessary to make comparative inferences across multiple models or tests using their corresponding posterior draws.

Usage

dca(
  .data,
  thresholds = seq(0, 0.5, length = 51),
  prior_p = NULL,
  prior_se = NULL,
  prior_sp = NULL,
  priors = NULL,
  threshold_varying_prior = FALSE,
  ignorance_region_cutpoints = c(0.25, 0.75) * max(thresholds),
  min_sens_prior_mean = 0.01,
  max_sens_prior_mean = 0.99,
  max_sens_prior_sample_size = 5,
  ignorance_region_mean = 0.5,
  ignorance_region_sample_size = 2,
  prev_prior_mean = 0.5,
  prev_prior_sample_size = 2,
  summary_probs = c(0.025, 0.975),
  external_prevalence_data = NULL,
  prior_only = FALSE,
  n_draws = 4000
)

Arguments

.data

A data.frame with an outcomes column (0 or 1 for each individual) and one or more columns with predicted probabilities from each of desired list of predictive models, or with 0 or 1 indicator from each of desired list of binary tests.

thresholds

Numeric vector with probability thresholds with which the net benefit should be computed (default is seq(0, 0.5, length = 51)).

prior_p, prior_se, prior_sp

Non-negative shape values for Beta(alpha, beta) priors used for p, Se, and Sp, respectively. Default is uniform prior for all parameters - Beta(1, 1). A single vector of the form c(a, b) can be provided for each.

priors

A list with threshold- and model-specific priors should contain a vector for shape1 of prevalence (named p1) and shape2 (named p2). Similarly for Se1/Se2 and Sp1/Sp2, except these should be matrices with as many rows as thresholds and as many columns as models or tests.

summary_probs

Probabilities used to compute credible intervals (defaults to a 95% Cr.I.).

external_prevalence_data

Vector with two positive integers giving number of diseased and non-diseased individuals, respectively, from external data (e.g., if analyzing nested case-control data, this is the number of cases and non-cases in the source population).

prior_only

If set to TRUE, will produce prior DCA.

keep_fit

Logical indicating whether to keep stanfit in the output (default is FALSE).

keep_draws

Logical indicating whether to keep posterior draws from stanfit object (default is TRUE).

constant_prior

If TRUE (default), it will set a single prior for all models or tests in all thresholds. If FALSE, the prior will be threshold and, potentially, model/test-specific.

min_prior_mean, max_prior_mean

Minimum and maximum prior mean for sensitivity and specificity. Only used if constant_prior = FALSE.

refresh

Control verbosity of rstan::sampling (check its help page for details).

Value

An object of class BayesDCA

Examples

data(PredModelData)
fit <- dca(PredModelData)
plot(fit)