The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
nlmixr2save can cache more than nlmixr2
fits. If your package has its own simulation or stochastic estimation
functions, you can register them so the := operator
restores cached results without breaking reproducibility.
Use saveFitRandom() to tell nlmixr2save
that a function should be treated as random-state-aware.
After registration, calls of the form below are cached in
sim.rds together with the starting and ending random
state:
On restore, nlmixr2save checks:
If those checks pass, the cached value is loaded and the random seed is advanced to the same state the original run would have produced.
If your package always wants a function treated as stochastic,
register it in .onLoad():
You can also unregister it later:
nlmixr2save handles nlmixr2(...) calls
differently from ordinary function calls:
deterministic estimation methods are cached as saved fits
(.zip bundles),
stochastic estimation methods are cached with seed metadata
(.rds files).
To place your estimation method into the seed-aware group, define the
nlmixr2Est.<method> method with a random
attribute set to TRUE or to a function that inspects the
control object.
nlmixr2Est.myMethod <- function(object, data, control, ...) {
# run stochastic estimation here
}
attr(nlmixr2Est.myMethod, "random") <- TRUEIf the stochastic behavior depends on control settings, the attribute can be a function:
With that in place, this call uses the seed-aware cache path automatically:
Use saveFitRandom() when:
you are caching a regular function such as a simulation helper,
the result should be stored as a generic .rds,
and
reproducibility depends on restoring the random seed state.
Use the random attribute on
nlmixr2Est.<method> when:
the function is an nlmixr2 estimation
method,
deterministic runs should still use the fit-saving
.zip path, and
stochastic runs should move into the seed-aware .rds
path.
The same limitations apply here as in the main usage vignette:
:= needs to see the expensive call directly on the
right-hand side.
Seed-aware restores only replay safely when the starting random state matches.
Generic registered functions are restored from .rds,
not from the text-and-csv fit format used for deterministic
nlmixr2 fits.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.