summarize_sim {nima} | R Documentation |
Summarize Simulations Results
Description
Summarize Simulations Results
Usage
summarize_sim(simulation_results, truth, ci_level = 0.95)
Arguments
simulation_results |
A |
truth |
A |
ci_level |
A |
Examples
n_sim <- 1000
n_obs <- c(100, 10000)
mu <- 2
sim_results <- lapply(n_obs, function(sample_size) {
estimator_sim <- lapply(seq_len(n_sim), function(iter) {
y_obs <- rnorm(sample_size, mu)
est_param <- mean(y_obs)
est_var <- var(y_obs) / sample_size
estimate <- tibble::as_tibble(list(
param_est = est_param,
param_var = est_var
))
return(estimate)
})
estimates <- do.call(rbind, estimator_sim)
return(estimates)
})
sim_summary <- lapply(sim_results, summarize_sim, truth = mu)
[Package nima version 0.6.2 Index]