Re: [R] Repeating a R code and counting how many repetitions working

2021-12-11 Thread varin sacha via R-help
Dear Rui, Many thanks, I got it now, thanks. In my R code, I have moved the replication term N <-1000 out <- replicate(N, { This time I get what I am looking for. library(boot) s<- sample(178:798, 1, replace=TRUE) mean(s) N <- 1 out <- replica

Re: [R] Repeating a R code and counting how many repetitions working

2021-12-11 Thread Rui Barradas
Hello, As for the code, I think it's simple. Before calling boot.ci you need to call boot. And replicate calls the expression between {} N times. After running boot.ci, the component bca is extracted. See ?boot.ci, section Value, after bca: These latter four components will be matrices with

Re: [R] Repeating a R code and counting how many repetitions working

2021-12-11 Thread varin sacha via R-help
Dear Rui, I really thank you a lot for your response. Even if I don't fully understand your R code, there is something strange happening while running the code. Indeed, I have run this R code here below 20 times and I always got the same answer : [1] 1 l

Re: [R] Repeating a R code and counting how many repetitions working

2021-12-11 Thread Rui Barradas
Hello, The problem can be solved with ?replicate. in the code below I only repeat N <- 1e3, not 1e4. set.seed(2021) N <- 1e3 out <- replicate(N, { boot.out <- boot(data = dat, statistic = med, R = 1) boot.ci(boot.out, type = "bca")$bca[, 4:5] }) mean(out[1,] < mean(s) & mean(s) < out[2,

[R] Repeating a R code and counting how many repetitions working

2021-12-11 Thread varin sacha via R-help
Dear R-experts, Here below my R code. I am trying to do 2 things : 1) I would like to repeat this R code 1 times 2) Out of the 1 repetitions I would have liked R to tell me how many times the "true" mean value of the population called "s" in my R example here below is included in the 1