# Fast example (runs in < 5 sec) - UNWRAPPED
set.seed(42)
generator <- function() rnorm(20)
# Very small simulation for demonstration
results_fast <- compare_methods_sim(generator, Rsim = 5, Rboot = 100)
# \donttest{
# Realistic simulation (takes > 5 sec) - WRAPPED in \donttest
set.seed(42)
generator <- function() rnorm(50, mean = 5, sd = 2)
sim_results <- compare_methods_sim(generator, Rsim = 50, Rboot = 500)
# Analyze coverage: does true mean (5) fall in each CI?
coverage_bs <- mean(sapply(sim_results, function(res) {
res$bs$ci[1] <= 5 && 5 <= res$bs$ci[2]
}))
coverage_bs
# }
Run the code above in your browser using DataLab