This is the main function for the batch simulation.

modified_simulation(sim_fun, ele_list, default_list, bigmemory = TRUE, ...)

batch_simulation(arg_grid, sim_fun, default_list, bigmemory = TRUE, ...)

Arguments

sim_fun

The simulation function. See sim_fun_test() for an example.

ele_list

An ele_list object generated by fill_in_struct().

default_list

A list of default values for sim_fun.

bigmemory

Use hash_big.matrix-class() to store large matrices?

...

Other parameters passed to sim_fun

arg_grid

An arg_grid object. See make_arg_grid().

Value

A batch_simulation object, also a data frame. The first column, var, is a list of ele_list that contains all the variables; the second to the second last columns are the values of the variables; the last column is the output of the simulation function.

Functions

  • modified_simulation(): Modify a single simulation.

Examples

batch_arg_set_grad <- new_arg_set()
batch_arg_set_grad <- batch_arg_set_grad %>%
  add_arg_ele(
    arg_name = "parameter", ele_name = "a",
    start = -6, end = -1, by = 1
  )
batch_grid_grad <- make_arg_grid(batch_arg_set_grad)
batch_output_grad <- batch_simulation(batch_grid_grad, sim_fun_grad,
  default_list = list(
    initial = list(x = 0, y = 0),
    parameter = list(a = -4, b = 0, c = 0, sigmasq = 1)
  ),
  length = 1e2,
  seed = 1614,
  bigmemory = FALSE
)
print(batch_output_grad)
#> Output(s) from 6 simulations.