The R Project SVN R

Rev

Rev 81048 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
56621 ripley 1
 
81944 ripley 2
R Under development (unstable) (2022-03-19 r81942) -- "Unsuffered Consequences"
3
Copyright (C) 2022 The R Foundation for Statistical Computing
68809 ripley 4
Platform: x86_64-pc-linux-gnu (64-bit)
56621 ripley 5
 
6
R is free software and comes with ABSOLUTELY NO WARRANTY.
7
You are welcome to redistribute it under certain conditions.
8
Type 'license()' or 'licence()' for distribution details.
9
 
10
R is a collaborative project with many contributors.
11
Type 'contributors()' for more information and
12
'citation()' on how to cite R or R packages in publications.
13
 
14
Type 'demo()' for some demos, 'help()' for on-line help, or
15
'help.start()' for an HTML browser interface to help.
16
Type 'q()' to quit R.
17
 
18
> library(parallel)
19
> 
80352 ripley 20
> if(require(boot, quietly = TRUE)) {
67807 ripley 21
+     cd4.rg <- function(data, mle) MASS::mvrnorm(nrow(data), mle$m, mle$v)
22
+     cd4.mle <- list(m = colMeans(cd4), v = var(cd4))
23
+     mc <- getOption("mc.cores", 2)
24
+     run1 <- function(...) boot(cd4, corr, R = 500, sim = "parametric",
25
+                                ran.gen = cd4.rg, mle = cd4.mle)
26
+     ## To make this reproducible:
27
+     set.seed(123, "L'Ecuyer"); mc.reset.stream()
28
+     res <- mclapply(seq_len(mc), run1)
29
+     cd4.boot <- do.call(c, res)
30
+     boot.ci(cd4.boot,  type = c("norm", "basic", "perc"),
31
+             conf = 0.9, h = atanh, hinv = tanh)
32
+ }
56621 ripley 33
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
34
Based on 1000 bootstrap replicates
35
 
36
CALL : 
37
boot.ci(boot.out = cd4.boot, conf = 0.9, type = c("norm", "basic", 
38
    "perc"), h = atanh, hinv = tanh)
39
 
40
Intervals : 
41
Level      Normal              Basic              Percentile     
62439 ripley 42
90%   ( 0.4575,  0.8547 )   ( 0.4703,  0.8575 )   ( 0.4964,  0.8663 )  
56621 ripley 43
Calculations on Transformed Scale;  Intervals on Original Scale
44
> 
45
> proc.time()
46
   user  system elapsed 
81944 ripley 47
  0.428   0.113   0.432