Summarize the parameter estimates, run details, and any heuristics of a
bootstrap run, saving the results to a boot_summary.RDS data file within the
bootstrap run directory.
Usage
summarize_bootstrap_run(.boot_run, force_resummarize = FALSE)
bootstrap_estimates(.boot_run, format_long = FALSE, force_resummarize = FALSE)
get_boot_models(.boot_run)Arguments
- .boot_run
A
bbi_nmboot_modelobject.- force_resummarize
Logical (T/F). If
TRUE, force re-summarization. Will only update the saved outRDSfile when specified viasummarize_bootstrap_run(). See details for more information.- format_long
Logical (T/F). If
TRUE, format data as a long table, making the data more portable for plotting.
Details
bootstrap_estimates()quickly extracts and formats the parameter estimates from each model run. If the data was previously summarized, the data will be read in instead of re-executing (this can be overridden viaforce_resummarize = TRUE).summarize_bootstrap_run()does the following things:Tabulates run details and heuristics.
Calls
summary_log()and binds the results to the parameter estimates.bootstrap_estimates()will include this appended model summary information if aboot_summary.RDSdata file exists.
Either saves this data out to
boot_summary.RDS, or reads it in if it already exists (see section below).Formats the returned object as a
bbi_nmboot_summaryS3 object, and displays key summary information when printed to the console.
Saved out data file:
The first time summarize_bootstrap_run() is called (or if
force_resummarize = TRUE), it will save the results to a boot_summary.RDS
data file within the bootstrap run directory. If one already exists, that data
set will be read in by default instead of being re-summarized.
The purpose of this is functionality two fold. For one, it helps avoid the need of re-executing
model_summary()calls for a large number of runs. It also helps to reduce the number of files you need to commit via version control (seecleanup_bootstrap_run()).
Functions
summarize_bootstrap_run(): Summarize a bootstrap run and store resultsbootstrap_estimates(): Tabulate parameter estimates for each model submission in a bootstrap runget_boot_models(): Read in all bootstrap run model objects
Examples
if (FALSE) { # \dontrun{
.boot_run <- read_model(file.path(MODEL_DIR, "1-boot"))
boot_sum <- summarize_bootstrap_run(.boot_run)
# Optionally compare to original estimates
param_estimates_compare(boot_sum)
# Long format is helpful for plotting estimates:
bootstrap_estimates(.boot_run, format_long = TRUE) %>%
dplyr::filter(grepl("THETA", parameter_names)) %>%
ggplot(aes(x = estimate)) +
facet_wrap(~parameter_names, scales = "free") +
geom_histogram(color = "white", alpha = 0.7) +
theme_bw()
} # }
