This section is intended to help the user understand
mrgsolve takes when working through
a simulation problem. The focus is on the order
mrgsolve calls different user-defined
functions as well as when parameter updates
and output writing happens during the simulation
The model specification results in the definition
of four functions that
mrgsolve calls during the
simulation sequence. Naming them by
their code block identifiers, the functions are
Just prior to starting the problem (when
$PREAMBLE. This function is only called
once during the simulation sequence. The goal of
$PREAMBLE is to allow
the user to work with different
C++ data structures to get them ready for
the simulation run.
ID in the data set, one after another.
mrgsolve runs this sequence
just prior to simulating a given
- Copy any parameters that are found in the
idata_setto the working parameter list
- Copy any parameters that are found in
data_setto the working parameter list, with the copy being taken from the first actual data set row for that individual. If the first actual data set record in the data set is not the first record for the individual,
mrgsolvestill copies from the first data set record as long as the
- Set initial estimates from the base initial estimate list
- Copy initial estimates from
idata_setif they are found there.
- Start simulating the records for that individual
mrgsolve executes this sequence while working
from record to record for a given
nocb(next observation carried backward) is
TRUE, then parameters are copied from the current record if that is an actual data set record. Note that if
locf(first observation carried forward) is assumed to be
TRUE(see below). This is the last parameters will be copied from any input data set prior to advancing the system (when
locfis being used). Therefore, when parameter columns are found in both an
data_set, it will be the value found in the
data_setthat will overwrite both the base list and any parameter value that was copied from an
idata_set. It is not an error to have different parameter values in an
data-set, but the value found in the
data_setwill be used when this happens. More on parameters and the parameter update sequence can be found in sections 11.3 and 1.1.
- The system is advanced via
$PKMODEL, whichever one is invoked in the model specification file.
- If the current record is a dosing record, the dose is implemented (e.g. bolus made or infusion started).
- If the system is advancing according to
locf, then parameters are copied from the current record if that is an actual data set record. This is in contrast to
nocbadvance (see above).
$TABLEfunction is called
- If the current record is marked for inclusion in the simulated output, results are written to the output matrix.
- Continue to the next record in the individual.
- Once the last record is processed in an individual, a new individual is started.