| |
| R Under development (unstable) (2022-03-19 r81942) -- "Unsuffered Consequences" |
| Copyright (C) 2022 The R Foundation for Statistical Computing |
| Platform: x86_64-pc-linux-gnu (64-bit) |
| |
| R is free software and comes with ABSOLUTELY NO WARRANTY. |
| You are welcome to redistribute it under certain conditions. |
| Type 'license()' or 'licence()' for distribution details. |
| |
| R is a collaborative project with many contributors. |
| Type 'contributors()' for more information and |
| 'citation()' on how to cite R or R packages in publications. |
| |
| Type 'demo()' for some demos, 'help()' for on-line help, or |
| 'help.start()' for an HTML browser interface to help. |
| Type 'q()' to quit R. |
| |
| > ## reproducible examples. |
| > |
| > library(parallel) |
| > |
| > if(require(boot)) { |
| + run1 <- function(...) { |
| + library(boot) |
| + cd4.rg <- function(data, mle) MASS::mvrnorm(nrow(data), mle$m, mle$v) |
| + cd4.mle <- list(m = colMeans(cd4), v = var(cd4)) |
| + boot(cd4, corr, R = 500, sim = "parametric", |
| + ran.gen = cd4.rg, mle = cd4.mle) |
| + } |
| + cl <- makeCluster(mc <- 2) |
| + clusterSetRNGStream(cl, 123) |
| + cd4.boot <- do.call(c, parLapply(cl, seq_len(mc), run1)) |
| + print(boot.ci(cd4.boot, type = c("norm", "basic", "perc"), |
| + conf = 0.9, h = atanh, hinv = tanh)) |
| + stopCluster(cl) |
| + } |
| Loading required package: boot |
| BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS |
| Based on 1000 bootstrap replicates |
| |
| CALL : |
| boot.ci(boot.out = cd4.boot, conf = 0.9, type = c("norm", "basic", |
| "perc"), h = atanh, hinv = tanh) |
| |
| Intervals : |
| Level Normal Basic Percentile |
| 90% ( 0.4705, 0.8589 ) ( 0.4620, 0.8597 ) ( 0.4900, 0.8689 ) |
| Calculations on Transformed Scale; Intervals on Original Scale |
| > |
| > |
| > proc.time() |
| user system elapsed |
| 0.217 0.040 0.593 |