Skip to contents

The main workhorse of the movedesign workflow. Runs one full round of simulation and analyses to evaluate whether the design meets its estimation targets. #' Call this function once your design has been built using md_prepare() for empirical data, or md_simulate() for user-specified parameters.

Because a single run is subject to stochastic variation, treat outputs from md_run() as exploratory, and use md_replicate() for more robust inferences (as it aggregates results across multiple replicates).

Usage

md_run(design, trace = TRUE, .seeds = NULL)

Arguments

design

An object of class movedesign_input, as returned by md_prepare() or md_simulate().

trace

Logical. If TRUE (default), prints progress messages and elapsed time for each step. Set to FALSE for silent execution.

.seeds

(Optional) List of integer seeds, one per individual, used to reproduce a previous run exactly. Seeds from a prior run are stored in the $seedList slot of the object returned by this function. Leave as NULL (default) for a fresh run with automatically generated seeds.

Value

An object of class movedesign_processed, accepted by downstream functions such as md_plot_preview(), or md_compare_preview().

Details

Progress messages are printed by default. Every individual simulation is assigned a unique random seed, stored in $seedList of the returned object. Passing that list to .seeds in a subsequent call reproduces the run exactly. This is particularly useful when replicating a result first produced in the Shiny app.

Typical workflow:

  • Prepare a study design with md_prepare().

  • Run all simulations and analyses with md_run().

  • Summarize or plot outputs from the returned object.

See also

md_prepare() and md_simulate() to build the input object. md_replicate() to run the workflow multiple times and aggregate results, which is recommended over a single md_run() call for any final design evaluation. md_plot_preview() and md_compare_preview() to inspect or compare these preliminary outputs.

Other workflow_steps: md_compare(), md_prepare(), md_replicate(), md_simulate()

Examples

if(interactive()) {

input <- md_prepare(
  data = buffalo,
  models = models,
  species = "buffalo",
  n_individuals = 5,
  dur = list(value = 1, unit = "month"),
  dti = list(value = 1, unit = "day"),
  add_individual_variation = FALSE,
  set_target = "hr",
  which_meta = "mean")
  
output <- md_run(input)
}