Skip to contents

Adds bootstrap replicates to an existing qdr_analysis, for example after a fast analysis run with bootstrap_times = 0. Plotting the returned analysis with ggplot2::autoplot() then draws confidence bands.

Usage

add_bootstrap(object, bootstraps)

Arguments

object

A qdr_analysis object.

bootstraps

A non-empty named list of qdr_bootstrap objects, named by model, such as the output of bootstrap_dose_response_models(). Names must match models in object.

Value

The qdr_analysis with the supplied bootstraps added or replaced. Models not named in bootstraps keep their existing bootstrap results.

Details

Each bootstrap must come from the matching fit in object: the same model, data, and coefficients. Bootstraps computed from another dataset or fit are rejected. Pass analysis$fits to bootstrap_dose_response_models(), which expects a model set or a list of fits rather than a whole analysis.

Examples

analysis <- analyze_dose_response(read_dose_response(
  system.file("extdata", "Ward_rotavirus.txt", package = "singlehit")
), bootstrap_times = 0, check_trend = FALSE)
boots <- bootstrap_dose_response_models(analysis$fits, times = 50, seed = 1)
analysis <- add_bootstrap(analysis, boots)
ggplot2::autoplot(analysis)