Skip to contents

Copies previously executed model into a new object and optionally accept all estimates returned from model execution. A new working directory is created and all files from base model are copied into it.

Usage

copyModel(model, acceptAllEffects = FALSE, modelName = "", workingDir = "")

Arguments

model

Model object to be copied

acceptAllEffects

Set to TRUE to accept all effects, update PML statements, and test.mdl file from original model run

modelName

New model name for subdirectory created for model output. Subdirectory is created in current working directory.

workingDir

Working directory to run the model. Current working directory will be used if workingDir not specified.

Value

Modified NlmePmlModel object

Examples

# \donttest{
model <- pkmodel(
  parameterization = "Clearance",
  numCompartments = 2,
  data = pkData,
  ID = "Subject",
  Time = "Act_Time",
  A1 = "Amount",
  CObs = "Conc",
  workingDir = tempdir()
  )
 host <- hostParams(sharedDirectory = tempdir(),
                    parallelMethod = "None",
                    hostName = "local",
                    numCores = 1)
job <- fitmodel(model,
                numIterations = 3,
                hostPlatform = host)
#> 
#> NLME Job
#> 
#> Compiling 1 of 1 NLME models
#> TDL5 version: 25.7.1.1
#> 
#> Status: OK
#> License expires: 2026-08-06
#> Refresh until: 2025-09-05 07:01:25
#> Current Date: 2025-08-06
#> The model compiled
#> 
#> 
#>  Iteration    -2LL     tvV    tvCl    tvV2   tvCl2 nSubj nObs
#>          1 1734.38 1.07796 1.05372 1.10597 1.07380    16  112
#>          2 1640.76 1.19901 1.16447 1.21074 1.19472    16  112
#>          3 1587.09 1.35133 1.31271 1.35521 1.34724    16  112
#> 
#> Trying to generate job results...
#> 
#> Generating Overall.csv
#> Generating EtaEta.csv
#> Generating Eta.csv
#> Generating EtaStacked.csv
#> Generating bluptable.dat
#> Generating ConvergenceData.csv
#> Generating initest.csv
#> Generating doses.csv
#> Generating omega.csv
#> Generating omega_stderr.csv
#> Generating theta.csv
#> Generating thetaCorrelation.csv
#> Generating thetaCovariance.csv
#> Generating Covariance.csv
#> Generating Residuals.csv
#> Generating posthoc.csv
#> 
#> Finished summarizing results. Transferring data and loading the results...
#> Done generating job results.

finalModelVPC <- copyModel(model,
                           acceptAllEffects = TRUE,
                           modelName = "model_VPC",
                           workingDir = tempdir())
# }