Specify Engine Parameters for Model Simulation
specify_SimParams.RdUse to define engine parameters for model simulation. Generates a single
character string containing space-separated name=value pairs.
Usage
specify_SimParams(
numReplicates = 100L,
seed = 1234L,
sort = FALSE,
ODE = c("MatrixExponent", "DVERK", "DOPRI5", "AutoDetect", "Stiff"),
rtolODE = 1e-06,
atolODE = 1e-06,
maxStepsODE = 50000L
)Arguments
- numReplicates
Integer; Number of replicates (simulations) to generate. Must be positive. Always included in output.
- seed
Integer; Seed for the random number generator used during simulation. Always included in output.
- sort
Logical; Specifies whether to sort the input data by subject and time before simulation. Default:
FALSE. Always included in output.- ODE
Character; Specifies the ODE solver. Options:
"MatrixExponent","DVERK","DOPRI5","AutoDetect","Stiff". Default:"MatrixExponent".- rtolODE
Numeric; Relative tolerance for the ODE solver. Default:
1e-6. (Not applicable ifODE = "MatrixExponent").- atolODE
Numeric; Absolute tolerance for the ODE solver. Default:
1e-6. (Not applicable ifODE = "MatrixExponent").- maxStepsODE
Integer; Maximum number of steps for the ODE solver. Default:
50000L. (Not applicable ifODE = "MatrixExponent").
Value
A single character string containing space-separated name=value
pairs, ordered according to the function signature. Includes
numReplicates, seed, sort always, and other parameters if specified
with non-default, applicable values.
Details
This function allows customization of the NLME engine settings specific to simulation runs. Parameters are validated based on type and range.
The parameters numReplicates, seed, and sort are always included in
the output string. Other parameters (ODE, rtolODE, atolODE,
maxStepsODE) are included only if their specified value differs from the
function's default value and they are applicable (ODE tolerances are
ignored if ODE="MatrixExponent").
Values are returned as character strings. The order of parameters in the output string matches the order in the function definition.
Examples
# Default settings (includes numReplicates, seed, sort)
SimArgs1 <- specify_SimParams()
print(SimArgs1)
#> [1] " numReplicates=100 seed=1234 sort=FALSE"
# Custom settings
SimArgs2 <-
specify_SimParams(
numReplicates = 50,
seed = 9876,
sort = TRUE, # Non-default
ODE = "DVERK", # Non-default
rtolODE = 1e-5 # Non-default and applicable
)
print(SimArgs2)
#> [1] " numReplicates=50 seed=9876 sort=TRUE ODE=DVERK rtolODE=1e-05"
# Custom settings where ODE tolerances are ignored
SimArgs3 <-
specify_SimParams(
numReplicates = 20,
ODE = "MatrixExponent", # Default, but tolerances are now inapplicable
rtolODE = 1e-4 # Non-default, but ignored
)
print(SimArgs3)
#> [1] " numReplicates=20 seed=1234 sort=FALSE"