Skip to contents

Run a model for a given scenario

Usage

run_scenario(
  project,
  scenarioId,
  modelId,
  progressbar = NULL,
  silent = clairvoyant::opts$get("silent")
)

Arguments

project

The project, as imported with read_project()

scenarioId

The identifier of the scenario to run

modelId

The identifier of the model to run

Value

An object of class clairvoyant_scenarioResult, containing, among other things, $resultDf, a data frame with the result of all model runs.

Examples

### Get the path to an example project
exampleProjectPath <-
  system.file(
    "example1",
    package = "clairvoyant"
  );

### Import it
exampleProject <-
  clairvoyant::read_project(
    exampleProjectPath
  );

policy_model_1_results <-
  clairvoyant::run_scenario(
    project = exampleProject,
    scenarioId = "policy_model_2",
    modelId = "basic_model",
    progressbar = TRUE
  );
#> Starting to process 4 parameters ('prevalence', 'population_size', 'productionCosts' & 'salePrice') with a total of 2574 parameter value combinations.

policy_model_1_results;
#> 🔮 {clairvoyant} scenario results
#> 
#> Ran model 'basic_model' for scenario 'policy_model_2', which specified 4 parameters ('prevalence', 'population_size', 'productionCosts' & 'salePrice'). Computed 2 intermediate values ('profit_per_pill' & 'number_of_customers') to arrive at final outcome 'total_profit'.
#> 
#> For the point estimate values, I yielded the following results:
#> 
#>      prevalence population_size productionCosts salePrice profit_per_pill
#> 1259          3        17000000               3        15              12
#>      number_of_customers total_profit
#> 1259              510000      6120000
#>