Visualize Summaries of Simulation Results

sim_plot(x, ..., sample_sizes, stat = c("bias", "mc_var", "mse"))

x | A |
---|---|

... | Extra arguments currently ignored. |

sample_sizes | A |

stat | A |

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#