The comparison
class is intended to store scenario
s and to
compare among them. One scenario
must be set as the 'baseline' for such
comparisons.
Arguments
- ...
Multiple
scenario
s or a list ofscenario
objects. At least one of these scenarios, the 'baseline' scenario, must be named for the comparison to be correctly constructed. The baseline scenario name must be the same as passed tobaseline
.- baseline
A string for the element of the list of
scenario
objects which indicates which should be considered the 'baseline' outcome, against which other outcomes are compared.
Examples
# prepare two scenarios of the final size of an epidemic
pandemic_flu <- scenario(
name = "pandemic_flu",
model_function = "finalsize::final_size",
parameters = make_parameters_finalsize_UK(r0 = 1.5),
replicates = 1L
)
covid19 <- scenario(
name = "covid19",
model_function = "finalsize::final_size",
parameters = make_parameters_finalsize_UK(r0 = 5.0),
replicates = 1L
)
# create a comparison object
comparison(
pandemic_flu, covid19,
baseline = "pandemic_flu"
)
#> Scenario comparison object
#> Number of scenarios: 2
#> Baseline scenario: "pandemic_flu"
#> Some scenarios have no data, use `run_scenario()` to prepare data
#> Scenario matching variables:
#> No matching variables specified yet.
#> Scenario comparison variables:
#> No comparison variables specified yet.
#> Model functions found:
#> finalsize::final_size
# pass scenario objects as a list
# create a comparison object
comparison(
list(pandemic_flu, covid19),
baseline = "pandemic_flu"
)
#> Scenario comparison object
#> Number of scenarios: 2
#> Baseline scenario: "pandemic_flu"
#> Some scenarios have no data, use `run_scenario()` to prepare data
#> Scenario matching variables:
#> No matching variables specified yet.
#> Scenario comparison variables:
#> No comparison variables specified yet.
#> Model functions found:
#> finalsize::final_size