Executes an NLME Bootstrap
bootstrap.RdMethod to execute an NLME Bootstrap
Usage
bootstrap(
model,
hostPlatform = NULL,
params,
bootParams,
runInBackground = FALSE,
saveResult = TRUE,
overwriteFitDir = FALSE,
...
)Arguments
- model
PK/PD model class object.
- hostPlatform
Host definition for model execution. See
hostParams. Ifmissing, multicore local host with 4 threads is used.- params
Engine parameters. See
engineParams. Ifmissing, default parameters generated by engineParams(model) are used.- bootParams
Bootstrap parameters. See
BootstrapParams. Ifmissing, default parameters generated by BootstrapParams() are used.- runInBackground
Logical. When
TRUE, the wrapper starts the engine asynchronously and returns a job object immediately; pass that object tocollectJob()when the run has finished to obtain the typed result. WhenFALSE(the default), the wrapper blocks until the engine completes and returns the result directly.Background execution is supported only on Linux hosts, whether local or remote: a local host whose
hostTypeis"linux"(the default on Linux workstations), or a remote host withhostType"linux","RHEL", or"UBUNTU". It is not supported on Windows (hostType = "windows", including the default local host when R runs on Windows): leave the argument atFALSE. PassingTRUEon a Windows host stops with an error. Remote Windows hosts are not supported at all.- saveResult
Logical; if
TRUE(default), the returnedrsnlme_bootis written to<workingDir>/bootstrap_<sanitizedModelName>_<YYYYMMDD_HHMMSS>.rdsso the run becomes self-describing on disk.workingDiris the model's working directory (model@modelInfo@workingDir), not necessarily R's processgetwd().sanitizedModelNameis derived frommodel@modelInfo@modelNameby replacing every character outside[A-Za-z0-9._-]with_; if the result is empty or contains no alphanumerics, the literal stringmodelis used instead. The timestamp is the wall-clock start of the engine call, formatted asYYYYMMDD_HHMMSSin the local time zone. ForrunInBackground = TRUE, the save happens atcollectJob()time rather than whenbootstrap()returns. A failing write produces a warning, never an error.- overwriteFitDir
Logical (default
FALSE).bootstrap()writes its aggregate artifacts (dmp.txt,residuals.csv,Boot*.csv) intomodel@modelInfo@workingDir- NOT intohostPlatform@sharedDirectory, which does not redirect aggregate output. Passing a model whoseworkingDiralready holds a fit's owndmp.txt/residuals.csv(e.g. a fitted model'sworkingDirtaken as-is) would silently overwrite that fit's outputs with a single bootstrap replicate's estimates, corrupting any downstream GOF/VPC that re-reads the directory. By defaultbootstrap()detects this and reroots the run into an isolated<workingDir>/bootstrap/<run-id>/subdirectory instead (viacopyModel), leaving the original fit untouched. SetoverwriteFitDir = TRUEto force running in-place and overwrite those files anyway (not recommended); this always emits a warning.- ...
Additional class initializer arguments for
BootstrapParamsorhostParams, or arguments available insideengineParamsfunctions. IfengineParamsarguments are supplied through bothparamsargument and additional argument (i.e., ellipsis), then the arguments inparamswill be ignored and only the additional arguments will be used with warning. IfhostParamsarguments are supplied through bothhostPlatformargument and additional argument, then its values will be overridden by additional arguments. In addition, ifBootstrapParamsarguments are supplied through bothbootParamsargument and additional argument, then its slots will be overridden by additional arguments.
Value
When runInBackground = FALSE, an rsnlme_boot
object: a named list of bootstrap result tables with class
c("rsnlme_boot", "list") and metadata attributes. The list carries
the existing aggregates (BootOverall, BootTheta,
BootOmega, BootOmegaCorrelation, BootOmegaStderr,
BootVarCoVar, BootSecondary) plus the per-replicate stacks
and per-parameter CI tables emitted by recent NLME8 builds
(BootThetaStacked, BootOmegaStacked, BootSigmaStacked,
BootOmegaCI, BootSigmaCI, BootEtaShrinkage,
BootEpsShrinkage). When bootParams@initialEstimates is
TRUE, a compact fitSummary table built from
dmp.txt + nlme7engine.log is also embedded. See
?rsnlme_boot for the full field and attribute contract and
?print.rsnlme_boot for the rendered output.
When saveResult = TRUE (the default), the rsnlme_boot is
also written to disk; see the saveResult parameter for the exact
path.
When runInBackground = TRUE, the bare BootNlmeJob is
returned; pass it to collectJob() to obtain the
rsnlme_boot (the RDS write, if requested, happens at that point).
Examples
if (FALSE) { # \dontrun{
input_data <- pkData
model <-
pkmodel(
numCompartments = 2,
data = input_data,
ID = "Subject",
Time = "Act_Time",
A1 = "Amount",
CObs = "Conc",
workingDir = tempdir()
)
# multicore
multicoreHost <- hostParams(
sharedDirectory = tempdir(),
parallelMethod = "Multicore",
hostName = "local_multicore",
numCores = 4
)
bootstrapdf <- bootstrap(model,
hostPlatform = multicoreHost,
params = engineParams(model),
numReplicates = 5,
randomNumSeed = 1234,
runInBackground = FALSE
)
} # }