simulate | R Documentation |
bbi_nonmem_model
objectCreate and submit a new bbi_nmsim_model
object, which is then attached to
the existing bbi_nonmem_model
object
add_simulation(
.mod,
n = 200,
seed = 1234,
data = NULL,
sim_cols = c("DV", "PRED"),
gitignore_sim = getOption("bbr.gitignore_sim"),
.join_col = "NUM",
.inherit_tags = TRUE,
.bbi_args = NULL,
.mode = getOption("bbr.bbi_exe_mode"),
...,
.overwrite = NULL,
.config_path = NULL,
.wait = TRUE,
.dry_run = FALSE
)
has_simulation(.mod)
get_simulation(.mod)
.mod |
A |
n |
Number of simulations/subproblems. Adds |
seed |
A seed for simulation. Appended to |
data |
A dataset to simulate from. Defaults to |
sim_cols |
Character column name(s) defining the simulated values to table out. |
gitignore_sim |
If |
.join_col |
Character column name(s) used to join table files post
execution. Gets appended to the generated |
.inherit_tags |
If |
.bbi_args |
A named list specifying arguments to pass to bbi
formatted like |
.mode |
Mode for model submission: "local", "sge", or "slurm". If
unspecified, the value is set to the value of the |
... |
args passed through to |
.overwrite |
Logical to specify whether or not to overwrite existing
model output from a previous run. If |
.config_path |
Path to a bbi configuration file. If |
.wait |
If |
.dry_run |
Returns an object detailing the command that would be run, insted of running it. This is primarily for testing but also a debugging tool. |
add_simulation
does the following things:
Checks that .mod
was previously executed and tabled out an MSF
file
(i.e. $EST MSFO=1.MSF
).
Note: If you are using bbi <= 3.3.0
, the MSF
file must have
an upper case extension. By default, bbi <= 3.3.0
will delete .msf
(lower case) files upon model completion.
Performs various checks to confirm the status of .mod
, the contents of its
control stream, and the input data.
Creates a new bbi_nmsim_model
object with the following differences from
the original control stream:
Removes the following record types for simulation: $EST
, $COV
,
$TABLE
, $SIMULATION
Removes PK and prior records: $PRIOR
, $THETA/$THETAP/$THETAPV
,
$OMEGA/$OMEGAP/$OMEGAPD
, $SIGMA/$SIGMAP/$SIGMAPD
Adds a new custom $SIMULATION
record using user specified values (e.g.
seed
and n
).
TRUE=FINAL
is appended to ensure the final values are used rather
than the initial estimates.
ONLYSIMULATION
flag is appended to reduce run times.
Adds a new $TABLE
record tabling out simulated values (sim_cols
) and
.join_col
column(s)
Adds a new $MSFI
record (run with NOMSFTEST
) pointing to the MSF
file of .mod
Creates a specification file, storing seeds
, n
, and other various items
helpful for traceability purposes.
Submits the model for execution.
add_simulation()
: Add a simulation to a bbi_nonmem_model
object
has_simulation()
: Helper for determining if a bbi_nonmem_model
has a
simulation attached to it. Returns TRUE
if a bbi_nmsim_model
specification file is found within the output directory of .mod
, and
FALSE
otherwise.
get_simulation()
: Read in and return a bbi_nmsim_model
object stored
within the output directory of .mod
.
By default, the output directory of the simulation is gitignore
'd (see
gitignore_sim
argument). When a collaborator attempts to read in the parent
model, they would see it has an attached simulation with a status of "Not Run"
.
To re-run this simulation using the specs that were originally used, you can simply execute the following commands:
.sim <- get_simulation(.mod) submit_model(.sim)
This will execute the simulation using the same n
, seed
, and data
that
were provided by the collaborator.
nm_join_sim()
## Not run:
# Add a new simulation and submit for execution
add_simulation(
.mod,
n = 100,
.mode = "local",
.wait = FALSE
)
# Optionally read in simulation model object
if(has_simulation(.mod)){
.sim <- get_simulation(.mod)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.