A wrapper around experiment2() that builds a fully-factorial set of simLists from a single base simList plus alternative params / modules / inputs / objects, then runs them via experiment2()'s future backend. The factorial design is built with factorialDesign().

experiment(
  sim,
  replicates = 1,
  params,
  modules,
  objects = list(),
  inputs,
  dirPrefix = "simNum",
  substrLength = 3,
  saveExperiment = TRUE,
  experimentFile = "experiment.RData",
  clearSimEnv = FALSE,
  notOlderThan,
  cl,
  ...
)

Arguments

sim

A simList, acting as the basis for the experiment.

replicates

The number of replicates to run of the same simList.

params

Like for SpaDES.core::simInit(), but for each parameter, provide a list of alternative values.

modules

Like for SpaDES.core::simInit(), but a list of module names (as strings).

objects

Like for SpaDES.core::simInit(), but a list of named lists of named objects.

inputs

Like for SpaDES.core::simInit(), but a list of inputs data.frames.

dirPrefix

String vector. This will be concatenated as a prefix on the directory names.

substrLength

Numeric. While making outputPath for each spades call, this is the number of characters kept from each factor level.

saveExperiment

Logical. Should the resulting experimental design be saved to a file. Default TRUE.

experimentFile

String. Filename if saveExperiment is TRUE; saved to outputPath(sim) in .RData format.

clearSimEnv

Logical. If TRUE, then the envir(sim) of each simList in the return is emptied, to reduce RAM load. Default FALSE.

notOlderThan

Currently unused (kept for back-compatibility).

cl

Deprecated and ignored; control parallelism with future::plan().

...

Passed to experiment2() and onward to SpaDES.core::spades() (e.g. debug, .plotInitialTime, cache, and events – see Controlling events in experiment2()).

Value

Invisibly, a simLists object. The experimental design list (expDesign + expVals) is attached as an attribute named "experiment" on the object's data environment, i.e. attr(out@.xData, "experiment"), and is also written to experimentFile.

Details

This function (and the simLists class it produces) was moved here from the now-unmaintained SpaDES.experiment package. Two behavioural notes versus the historical version: parallelism is now controlled by future::plan() rather than a cl cluster object (the cl argument is accepted but ignored, with a message), and the return value is a simLists object (as from experiment2()) rather than a plain list. The experimental design table is still saved to experimentFile and is attached to the result (see Value).

Author

Eliot McIntire