| simulate_scenarios | R Documentation |
Every column of scenarios other than id and replication is passed to
the simulator as a named argument, so the column names must be simulator
argument names and must not repeat an argument given in .... The
identifier and replication values are prepended to each generated
observation, which makes the result immediately suitable for grouped
estimation and recovery checks. Every scenario must produce the same primary
columns, otherwise the run is an error.
simulate_scenarios(
scenarios,
simulator,
...,
id = "scenario_id",
replication = "replication",
seed = NULL
)
scenarios |
A base |
simulator |
Canonical simulator name, taken from the |
... |
Arguments held constant across scenarios. |
id |
Single string naming the scenario identifier column of
|
replication |
Single string naming the replication column of
|
seed |
Optional single base seed. Row |
A simulab_sim base data.frame stacking every scenario's output,
with one row per generated observation: the id and replication columns
first, then the simulator's own columns. The scenarios component holds
the grid that was run, one row per scenario.
scenarios <- scenario_grid(mean_b = c(0, 0.5), replications = 2)
result <- simulate_scenarios(
scenarios, simulator = "ttest",
n_a = 20, n_b = 20, mean_a = 0, seed = 1
)
head(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.