Visualize Summaries of Simulation Results

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



A list of several simulation summary objects, of class simulation_stats.


Extra arguments currently ignored.


A numeric vector giving the sample sizes at which each of the simulations in the input x was performed. There should be one unique sample size corresponding to each element of x.


A character indicating which of three simulation summary statistics for which to generate a plot. Options are currently limited to bias ("bias"), variance ("mc_var"), and mean-squared error ("mse").


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 <-, 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