Plot IPCW cumulative incidence with bootstrap percentile confidence intervals
Source:R/competing-risks.R
plot_ipcw_cuminc_boot_ci_cr.RdCombines bootstrap cumulative incidence curves from get_ipcw_boot_cr()
with the point estimate from the original IPCW-weighted data to produce a
cumulative incidence plot with 95% percentile confidence intervals,
mirroring plot_ipcw_km_boot_ci_se() for the single-event case.
Usage
plot_ipcw_cuminc_boot_ci_cr(
boot_data,
orig_data,
esttimes = seq(from = 0, to = 10, length.out = 100),
extend = TRUE,
covariate = "z1"
)Arguments
- boot_data
A list of long-format data frames with IPCW weights, as returned by
get_ipcw_boot_cr().- orig_data
A single long-format data frame with IPCW weights for the original (non-bootstrapped) dataset, as returned by
add_ipcw_weights_cr(). Used for the point estimate.- esttimes
Numeric vector of times at which to evaluate cumulative incidence. Defaults to 100 equally spaced points from 0 to 10.
- extend
Logical. Passed to
cuminc_ipcw_cr(). Default isTRUE.- covariate
Character string. Name of the covariate column, used only when
extend = FALSEto compute the truncation time. Default is"z1".
Value
A ggplot2::ggplot() object. Add layers or themes to customise.
Examples
if (FALSE) { # \dontrun{
set.seed(42)
dat <- sim_data_cr(n = 200, censoring = "baseline")
dat_long <- add_ipcw_weights_cr(wide_to_long_cr(dat), strat = "no")
boot_list <- get_ipcw_boot_cr(dat, B = 50)
plot_ipcw_cuminc_boot_ci_cr(boot_list, dat_long, esttimes = seq(0, 5, 0.1))
} # }