add_reactevt.Rd
Define the modifications to other events, costs, utilities, or other items affected by the occurrence of the event
add_reactevt(.data = NULL, name_evt, input)
Existing data for event reactions
Name of the event for which reactions are defined.
Expressions that define what happens at the event, using functions as defined in the Details section
There are a series of objects that can be used in this context to help define the event reactions.
The following functions may be used to define event reactions within this add_reactevt()
function:
modify_item()
| Adds & Modifies items/flags/variables for future events
new_event()
| Adds events to the vector of events for that patient
modify_event()
| Modifies existing events by changing their time
Apart from the items defined with add_item(), we can also use standard variables that are always defined within the simulation:
curtime
| Current event time (numeric)
prevtime
| Time of the previous event (numeric)
cur_evtlist
| Named vector of events that is yet to happen for that patient (named numeric vector)
evt
| Current event being processed (character)
i
| Patient being iterated (character)
simulation
| Simulation being iterated (numeric)
The model will run until curtime
is set to Inf
, so the event that terminates the model should modify curtime
and set it to Inf
.
add_reactevt(name_evt = "start",input = {})
#> $start
#> $start$react
#> {
#> }
#>
#> $start$comp_out
#> compute_outputs(cost_ongoing_i = cost_ongoing, cost_instant_i = cost_instant,
#> cost_cycle_i = cost_cycle, util_cycle_i = util_cycle, util_instant_i = util_instant,
#> utilmlt_i = utilmlt, cycle_l_i = cycle_l, util_cycle_l_i = util_cycle_l,
#> prevtime_i = prevtime, curtime_i = curtime, starttime_i = cycle_starttime,
#> util_starttime_i = util_cycle_starttime, input_list_trt = input_list_trt)
#>
#>
add_reactevt(name_evt = "idfs",input = {modify_item(list("fl.idfs"= 0))})
#> $idfs
#> $idfs$react
#> {
#> modify_item(list(fl.idfs = 0))
#> }
#>
#> $idfs$comp_out
#> compute_outputs(cost_ongoing_i = cost_ongoing, cost_instant_i = cost_instant,
#> cost_cycle_i = cost_cycle, util_cycle_i = util_cycle, util_instant_i = util_instant,
#> utilmlt_i = utilmlt, cycle_l_i = cycle_l, util_cycle_l_i = util_cycle_l,
#> prevtime_i = prevtime, curtime_i = curtime, starttime_i = cycle_starttime,
#> util_starttime_i = util_cycle_starttime, input_list_trt = input_list_trt)
#>
#>