Progress updates for 'boot' functions
Henrik Bengtsson
Source:vignettes/progressify-81-boot.md
progressify-81-boot.RmdThe progressify package allows you to easily add
progress reporting to sequential and parallel map-reduce code by piping
to the progressify() function. Easy!
TL;DR
library(progressify)
handlers(global = TRUE)
library(boot)
# Run bootstrap with progress signaling
x <- 1:100
my_stat <- function(data, i) mean(data[i])
res <- boot(data = x, statistic = my_stat, R = 1000) |> progressify()Introduction
This vignette demonstrates how to use this approach to add progress
reporting to boot
functions such as boot(), censboot(), and
tsboot().
The boot package provides functions for generating bootstrap replicates. Because these computations are iterative and computationally intensive, they can benefit significantly from progress reporting.
For example, boot() runs a statistic function
R times:
library(boot)
x <- 1:100
my_stat <- function(data, i) mean(data[i])
res <- boot(data = x, statistic = my_stat, R = 1000)By default, boot() provides no feedback on how far it
has progressed. However, we can easily add progress reporting using the
progressify() function:
library(boot)
library(progressify)
handlers(global = TRUE)
x <- 1:100
my_stat <- function(data, i) mean(data[i])
res <- boot(data = x, statistic = my_stat, R = 1000) |> progressify()Supported Functions
The progressify() function supports the following
boot functions: