Run a pharmpy nlmixr-format model with nlmixr2
run_nlme_nlmixr.RdInternal companion to run_nlme(); called when the input model is in
pharmpy's nlmixr backend. The function turns the pharmpy nlmixr model into
an rxode2/nlmixr2 function, fits it with nlmixr2::nlmixr2(), and
wraps the result in a list that mimics the shape of a pharmpy
ModelfitResults so downstream helpers (attach_fit_info(),
compare_nlme_fit(), etc.) work without engine-specific branches.
Usage
run_nlme_nlmixr(
model,
data = NULL,
id,
path = getwd(),
estimation_method = NULL,
control = NULL,
force = NULL,
save_fit = TRUE,
save_summary = TRUE,
save_final = TRUE,
clean = TRUE,
verbose = TRUE
)Arguments
- model
pharmpy model object or NONMEM model code (character) or path to NONMEM model file.
- data
filename of dataset or data.frame as input to NONMEM / nlmixr. Optional, can also be included in
modelobject (if specified as pharmpy model object).- id
run id, e.g.
run1. This will be the folder in which the NONMEM model is run. If no folder is specified, it will create a folderrun1in the current working directory, and will increment the run number for each subsequent run.- path
path to nonmem model. If not specified, will assume current working directory.
- estimation_method
Optional. Character vector of estimation method(s) to apply to model. Will remove all existing estimation steps in the model and update with methods specified in argument.
- control
nlmixr2-only. Optional control list passed verbatim to
nlmixr2::nlmixr2()(e.g.nlmixr2est::foceiControl()ornlmixr2est::saemControl()). Ignored for NONMEM models.- force
if run folder (
id) exists, should existing results be removed before rerunning NONMEM? DefaultFALSE.- save_fit
save fit object. If
TRUE, will save as <run_id.rds>. Can also specify filename (rds) to save to.- save_summary
save fit summary and parameter estimates to file? Default is
TRUE. Will use current folder, and save asfit_summary_<id>.txtandfit_parameters_<id>.csv.- save_final
after running the model, should a file
final.modbe created with the final estimates from the run.- clean
clean up run folder after NONMEM execution?
- verbose
verbose output?