This function takes a bbi_nmboot_model (created by a previous new_bootstrap_run() call) and creates n new model objects and re-sampled datasets in a subdirectory. The control stream found at get_model_path(.boot_run) is used as the "template" for these new model objects, and the new datasets are sampled from the dataset defined in its $DATA record (i.e. get_data_path(.boot_run)).

setup_bootstrap_run(
  .boot_run,
  n = 200,
  strat_cols = NULL,
  seed = 1234,
  data = NULL,
  .bbi_args = list(no_grd_file = TRUE, no_shk_file = TRUE),
  .overwrite = FALSE
)

Arguments

.boot_run

A bbi_nmboot_model object.

n

Number of data sets and model runs to generate.

strat_cols

Columns to maintain proportion for stratification

seed

A numeric seed to set prior to resampling the data; use NULL to avoid setting a seed.

data

A dataset to resample from. Defaults to NULL, which will use the filtered output from nm_data(.boot_run, filter = TRUE). If provided, must include the same column names as what's returned from nm_data(.mod).

.bbi_args

Named list passed to model_summary(orig_mod, .bbi_args), where orig_mod is the model .boot_run is based on. See print_bbi_args() for valid options. Defaults to list(no_grd_file = TRUE, no_shk_file = TRUE) because model_summary() is only called internally to extract the number of records, so those files are irrelevant. Only used if the based on model (the model being bootstrapped) has been executed.

.overwrite

Logical (T/F) indicating whether or not to overwrite existing setup for a bootstrap run.

Details

Once you have run this function, you can execute your bootstrap with submit_model(). You can use get_model_status() to check on your submitted bootstrap run. Once all models have finished, use summarize_bootstrap_run() to view the results. See examples below.

Examples

if (FALSE) {

# Setup
.boot_run <- new_bootstrap_run(.mod)
.boot_run <- setup_bootstrap_run(
  .boot_run,
  n = 1000,
  seed = 1234,
  strat_cols = c("STUDY", "ETN")
)

# Submit
submit_model(.boot_run)

# Check status of runs during submission
get_model_status(.boot_run)

# Summarize results, once all runs have finished
if (check_nonmem_finished(.boot_run)) {
  .boot_sum <- summarize_bootstrap_run(.boot_run)
}
}