The progressify package allows you to easily add progress
reporting to sequential and parallel map-reduce code by piping to the
progressify() function. Easy!
library(progressify)
handlers(global = TRUE)
library(lme4)
# Fit random-slope model
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
my_stat <- function(fit) {
fixef(fit)
}
# Run bootstrap with progress signaling
res <- bootMer(fm1, my_stat, nsim = 1000) |> progressify()
This vignette demonstrates how to use this approach to add progress
reporting to lme4 functions such as bootMer(). The lme4
package provides functions for fitting linear, generalized linear, and
nonlinear mixed-effects models. For example, bootMer() runs a
statistic function nsim times:
library(lme4)
# Fit random-slope model
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
my_stat <- function(fit) {
fixef(fit)
}
res <- bootMer(fm1, my_stat, nsim = 1000)
By default, bootMer() provides no progress feedback. However, we can
easily add progress reporting using the progressify() function:
library(lme4)
library(progressify)
handlers(global = TRUE)
# Fit random-slope model
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
my_stat <- function(fit) {
fixef(fit)
}
res <- bootMer(fm1, my_stat, nsim = 1000) |> progressify()
The same works for parametric bootstrap confidence intervals, which
use bootMer() internally:
ci <- confint(fm1, method = "boot", nsim = 1000) |> progressify()
The progressify() function supports the following lme4
functions:
bootMer()confint() for merMod objects with method = "boot"Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.