#' Confidence Intervals and Estimates of Sigma-Squared - Parallelized
#'
#' This function takes in a list of linear regression error variance (sigma-squared)
#' estimates generated by a Bag of Little Bootstraps procedure. Then, empirical
#' confidence intervals and point estimates of sigma-squared are determined for each
#' subsample. Afterwards, the endpoints of all confidence intervals are averaged to
#' form an overall confidence interval, and point estimates are averaged to form an
#' overall estimate. The difference between this function and s2_CI is that this
#' function uses parallel processing through furrr's future_map function.
#'
#' @param lrbs A linear_reg_bs or linear_reg_bs_par object containing BLB sigma-squared
#' estimates.
#' @param alpha The significance level. Default value is 0.05.
#' @return The overall confidence interval for sigma-squared, along with its overall
#' estimate.
#' @export
s2_CI_par <- function(lrbs, alpha = 0.05) {
s2 <- lrbs$bootstrap_s2_estimates
CIs <- future_map(s2, quantile, probs = c((alpha / 2), (1 - (alpha / 2))))
means <- future_map(s2, mean)
CI <- reduce(CIs, `+`) / length(CIs)
s2_hat <- reduce(means, `+`) / length(means)
return(c(Lower_Bound = CI[[1]], Estimate = s2_hat, Upper_Bound = CI[[2]]))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.