Learn R Programming

cutpointr (version 1.1.2)

boot_ci: Calculate bootstrap confidence intervals from a cutpointr object

Description

Given a cutpointr object that includes bootstrap results this function calculates a bootstrap confidence interval for a selected variable. Missing values are removed before calculating the quantiles. In the case of multiple optimal cutpoints all cutpoints / metric values are included in the calculation. Values of the selected variable are returned for the percentiles alpha / 2 and 1 - alpha / 2. The metrics in the bootstrap data frames of cutpointr are suffixed with _b and _oob to indicate in-bag and out-of-bag, respectively. For example, to calculate quantiles of the in-bag AUC variable = AUC_b should be set.

Usage

boot_ci(x, variable, in_bag = TRUE, alpha = 0.05)

Arguments

x

A cutpointr object with bootstrap results

variable

Variable to calculate CI for

in_bag

Whether the in-bag or out-of-bag results should be used for testing

alpha

Alpha level. Quantiles of the bootstrapped values are returned for (alpha / 2) and 1 - (alpha / 2).

Value

A data frame with the columns quantile and value

See Also

Other main cutpointr functions: add_metric(), boot_test(), cutpointr(), multi_cutpointr(), predict.cutpointr(), roc()

Examples

Run this code
# NOT RUN {
opt_cut <- cutpointr(suicide, dsi, suicide, gender,
  metric = youden, boot_runs = 1000)
boot_ci(opt_cut, optimal_cutpoint, in_bag = FALSE, alpha = 0.05)
boot_ci(opt_cut, acc, in_bag = FALSE, alpha = 0.05)
boot_ci(opt_cut, cohens_kappa, in_bag = FALSE, alpha = 0.05)
boot_ci(opt_cut, AUC, in_bag = TRUE, alpha = 0.05)
# }

Run the code above in your browser using DataLab