This function is slightly different from run_sim_parallel
.
run_sim_parallel
only runs multiple-core at the simulation level.
run_sim
uses only-single core.
run_sim
can be more efficient if using only one simulation (e.g., deterministic),
while run_sim_parallel
will be more efficient if the number of simulations is >1 (e.g., PSA).
Event ties are processed in the order declared within the init_event_list
argument (evts
argument within the first sublist of that object).
To do so, the program automatically adds a sequence from to 0 to the (number of events - 1) times 1e-10 to add to the event times when selecting the event with minimum time.
This time has been selected as it's relatively small yet not so small as to be ignored by which.min (see .Machine for more details)
A list of protected objects that should not be used by the user as input names or in the global environment to avoid the risk of overwriting them is as follows:
c("arm", "arm_list", "categories_for_export", "cur_evtlist", "curtime", "evt", "i", "prevtime", "sens", "simulation", "sens_name_used","list_env","uc_lists","npats","ipd").
The engine uses the L'Ecuyer-CMRG for the random number generator.
Note that the random seeds are set to be unique in their category (i.e., at patient level, patient-arm level, etc.)
If no drc
or drq
parameters are passed within sensitivity
or common_all
input lists, these are assigned a default value 0.03 for discounting costs, QALYs and others.
Ongoing items will look backward to the last time updated when performing the discounting and accumulation.
This means that the user does not necessarily need to keep updating the value, but only add it when the value
changes looking forward (e.g., o_q = utility at event 1, at event 2 utility does not change, but at event 3 it does,
so we want to make sure to add o_q = utility at event 3 before updating utility. The program will automatically
look back until event 1). Note that in previous versions of the package backward was the default, and now this has switched to forward.
The requirement to use modify_item
if using accum_backwards = TRUE
, is no longer the case thanks to a new method using active bindings, so it can be used normally.
It is important to note that the QALYs and Costs (ongoing or instant or per cycle) used should be of length 1.
If they were of length > 1, the model would expand the data,
so instead of having each event as a row, the event would have N rows (equal to the length of the costs/qalys to discount passed).
This means more processing of the results data would be needed in order for it to provide the correct results.
If the cycle
lists are used, then it is expected the user will declare as well the name of the variable
pasted with cycle_l
and cycle_starttime
(e.g., c_default_cycle_l and c_default_cycle_starttime) to
ensure the discounting can be computed using cycles, with cycle_l being the cycle length, and cycle_starttime
being the starting time in which the variable started counting. Optionally, max_cycles
must also be added (if no
maximum number of cycles, it should be set equal to NA).
debug = TRUE
will export a log file with the timestamp up the error in the main working directory. Note that
using this mode without modify_item or modify_item_seq may lead to inaccuracies if assignments are done in non-standard ways,
as the AST may not catch all the relevant assignments (e.g., an assigment like assign(paste("x_",i),5)
in a loop will not be identified).
continue_on_error
will skip the current simulation (so it won't continue for the rest of patient-arms) if TRUE.
Note that this will make the progress bar not correct, as a set of patients that were expected to be run is not.