Description Usage Arguments Value Examples
View source: R/as_experiment.R
Converts a data frame into an experiment, using the columns of the data frame to populate values of parameters, periods of observation, duration of simulation and seeds of an object of class experiment.
1 2 | as_experiment(df, parameters = NULL, obsrates = NULL, tmax = "tmax",
seed = "seed", experiment, model, dic = NULL)
|
df |
A data frame containing values of paramters, periods of observation, durations of simulation and seeds for an experiment. |
parameters |
Names or indexes of columns of |
obsrates |
Names or indexes of columns of |
tmax |
Name or index of the column of |
seed |
Name or index of the column of |
experiment |
The name of an experiment of the |
model |
The path to a |
dic |
A named vector of character strings. The values and the names of
this vector should be consistent with the names of
|
An object of class experiment
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # A first example:
if (exists("sir1", inherits = FALSE)) rm(sir1)
df <- as.data.frame(repl(sir1, 5))
exp_name <- name(sir1)
gaml_file <- attr(sir1, "model")$path
as_experiment(df, experiment = exp_name, model = gaml_file)
# Alternative uses:
as_experiment(df, 1:5, 6:8, 9, 10, exp_name, gaml_file)
as_experiment(df, c("p_S0", "p_I0", "p_R0", "p_beta", "p_gamma"),
c("r_S", "r_I", "r_R"), "tmax", "seed", exp_name, gaml_file)
# Or a mixture of character and numeric indexes:
as_experiment(df, 1:5, c("r_S", "r_I", "r_R"), "tmax", "seed", exp_name,
gaml_file)
# And even using default parameters specification:
as_experiment(df, obsrates = c("r_S", "r_I", "r_R"),
experiment = exp_name, model = gaml_file)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.