run_sim: run_sim

View source: R/run_sim.R

run_simR Documentation

run_sim

Description

run_sim

Usage

run_sim(
  .sim_fun = generate_data,
  .sim_args = list_conditions_datagen(),
  .plan_future = plan_future(),
  .seed_start = TRUE,
  .progress_bar = FALSE,
  ...
)

Arguments

.sim_fun

A function name. The function to be iterated over in the simulations.

.sim_args

A named list of simulation conditions. Each element must match a named argument in .sim_fun, and each element must have length equal to the number of combinations of conditions. Alternately, pass a call to list_conditions_datagen or list_conditions_estimate.

.plan_future

A call to plan_future.

.seed_start

A logical or numeric. Passed to the seed argument of furrr_options. If TRUE, furrr will use L'Ecuyer-CMRG RNG streams for parallel-safe random number generation that will produce identical results regardless of the parallel strategy set by .plan_future. If .seed_start is a numeric scalar, all runs of the run_sim function with identical .sim_fun and .sim_args will produce identical results.

...

Parameters passed to sim_fun.

Value

A list of objects created by applying .sim_fun to each combination of conditions given in .sim_args.

Examples

## Not run: 

.n_reps <- 1:2

purrr::map(.n_reps, ~run_sim(
  .sim_args = list_conditions_datagen(
    .n_sch = 5,
    .n_stu = 5,
    .clust_cov = .8,
    .pct_mobile = .5,
    .gamma_x = list(c(0, 0))
   )
 )) %>%
 rlang::set_names(., nm = paste0("replication_", .n_reps))


## End(Not run)

tessaleejohnson/corclus documentation built on Oct. 11, 2022, 3:46 a.m.