sequence: Sequence of scenarios

View source: R/sequence.R

sequenceR Documentation

Sequence of scenarios

Description

Scenario sequences can be used to implement changes in model parameters over time, which otherwise would remain constant for the duration of a simulation. A sequence of scenarios is treated as a single scenario and each scenario is simulated one after the other. If scenario n in a sequence was simulated, scenario n+1 will start off in the model state where n had ended.

Usage

sequence(seq, breaks = NULL)

Arguments

seq

list of scenario objects

breaks

optional vector of numerics, scenarios' output times will be modified so that one scenario ends at the break and the next one begins

Details

Sequences are generally treated the same as scenarios: Sequences can be simulated, as well as effects and EPx can be derived.

Requirements

All scenarios in a sequence must fulfill the following requirements:

  • All scenarios must have identical state variables

  • The output times of all scenarios must represent a continuous time series without gaps or overlaps

Using the breaks argument, the function can split up the scenarios' output times at the given break points. The break points must be within the interval defined by the superset of all output times in the sequence.

Value

an S4 object of type ScenarioSequence

See Also

sequence.extract

Examples

# Create a scenario with background mortality only
scen1 <- minnow_it %>%
  set_noexposure() %>%
  set_times(0:10)
# Modify a scenario parameter, e.g. set background mortality to zero
scen2 <- scen1 %>% set_param(c(hb=0))

# Create a sequence of scenarios, scenario #1 will be simulated for the
# time period [0, 4], and #2 for [4, 10]
sq <- sequence(list(scen1, scen2), breaks=c(4))

# Simulate the sequence: the mortality stops after t=4.0, due to scenario #2
# being simulated after t=4.0, which disabled the background mortality
simulate(sq)
# Effect endpoints can also be calculated
effect(sq)


cvasi documentation built on Sept. 11, 2025, 5:11 p.m.