Description Usage Arguments Examples
View source: R/simulation_tools.R
Visualize Summaries of Simulation Results
1 |
x |
A |
... |
Extra arguments currently ignored. |
sample_sizes |
A |
stat |
A |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | n_sim <- 100
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)
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)
p_sim_summary <- sim_plot(sim_summary, sample_sizes = n_obs, stat = "mse")
p_sim_summary
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.