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{
# Create initial model
model <- pkmodel(
  parameterization = "Clearance",
  absorption = "Intravenous",
  numCompartments = 2,
  data = pkData,
  ID = "Subject",
  A1 = "Amount",
  CObs = "Conc",
  Time = "Act_Time",
  modelName = "pk_model"
)

# Fit Model
job <- fitmodel(model)
#> Using MPI host with 4 cores
#> 
#> NLME Job
#> sharedDirectory is not given in the host class instance.
#> Valid NLME_ROOT_DIRECTORY is not given, using current working directory:
#> C:/Users/jcraig/Documents/GitHub/R-RsNLME/docs/reference
#> 
#> Compiling 1 of 1 NLME models
#> TDL5 version: 24.9.1.1
#> 
#> Status: OK
#> License expires: 2026-04-08
#> Refresh until: 2025-05-07 20:38:27
#> Current Date: 2025-04-07
#> 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
#>          4 1559.94 1.51691 1.47592 1.51570 1.51267    16  112
#>          5 1545.53 1.69253 1.65038 1.68761 1.68812    16  112
#>          6 1537.46 1.87322 1.83076 1.86587 1.86828    16  112
#>          7 1532.81 2.04832 2.00610 2.03978 2.04280    16  112
#>          8 1530.43 2.19847 2.15746 2.19006 2.19264    16  112
#>          9 1529.44 2.28870 2.24956 2.28142 2.28275    16  112
#>         10 1528.44 2.36768 2.33174 2.36244 2.36178    16  112
#>         11 1525.84 2.52046 2.49445 2.52134 2.51486    16  112
#>         12 1519.67 2.80483 2.80466 2.82032 2.80038    16  112
#>         13 1515.10 3.21194 3.25592 3.24936 3.20963    16  112
#>         14 1510.03 3.05238 3.08750 3.07917 3.04942    16  112
#>         15 1504.03 3.18762 3.25244 3.21772 3.18563    16  112
#>         16 1503.29 3.75212 3.93610 3.79491 3.75353    16  112
#>         17 1495.99 3.57164 3.73550 3.60451 3.57215    16  112
#>         18 1493.74 3.72773 3.93150 3.76212 3.72926    16  112
#>         19 1486.86  4.46486  4.87109  4.50720  4.47162    16  112
#>         20 1482.33  4.54962  4.99801  4.59027  4.55754    16  112
#>         21 1465.23  5.63303  6.49837  5.67268  5.65262    16  112
#>         22 1449.27  6.59887  7.94730  6.63178  6.63436    16  112
#>         23 1448.20  6.63453  8.02035  6.66403  6.67397    16  112
#>         24 1447.20  6.48840  7.81175  6.50995  6.53610    16  112
#>         25 1445.80  6.66308  8.03269  6.67198  6.72787    16  112
#>         26 1443.68  7.05368  8.50609  7.03508  7.15239    16  112
#>         27 1442.28  7.73989  9.30359  7.67427  7.88704    16  112
#>         28 1439.90  8.00197  9.57586  7.91965  8.15561    16  112
#>         29 1438.04  8.71977 10.37810  8.58723  8.90172    16  112
#>         30 1433.56 10.51470 12.38290 10.24620 10.76480    16  112
#>         31 1430.80 13.20840 15.39390 12.73360 13.55560    16  112
#>         32 1426.24 13.39910 15.55390 12.89450 13.73680    16  112
#>         33 1423.81 13.37820 15.51600 12.86180 13.71630    16  112
#>         34 1420.55 13.70890 15.83190 13.11970 14.05080    16  112
#>         35 1419.51 13.04010 15.05450 12.47940 13.35950    16  112
#>         36 1418.94 13.20170 15.18740 12.60690 13.52300    16  112
#>         37 1418.52 13.34050 15.25530 12.69030 13.65650    16  112
#>         38 1418.36 13.37370 15.22970 12.68750 13.68070    16  112
#>         39 1418.06 13.40110 15.13910 12.64770 13.68500    16  112
#>         40 1417.51 13.43880 14.93790 12.55190 13.66830    16  112
#>         41 1416.28 13.54310 14.48840 12.34650 13.63650    16  112
#>         42 1412.63 13.81930 13.15790 11.73050 13.50180    16  112
#>         43 1407.84 14.02130 11.77100 11.06010 13.29600    16  112
#>         44 1396.03 14.26380  9.51721  9.94067 12.90450    16  112
#>         45 1395.16 14.29720  9.34148  9.85834 12.88540    16  112
#>         46 1393.35 14.74660  9.26154  9.97137 13.20540    16  112
#>         47 1392.09 15.37510  9.54412 10.34430 13.74600    16  112
#>         48 1391.28 15.54000  9.56985 10.42690 13.86320    16  112
#>         49 1389.36 15.99990  9.88680 10.78810 14.24390    16  112
#>         50 1383.23 16.82190 10.23320 11.36040 14.80120    16  112
#>         51 1369.52 18.30030 10.88910 12.42670 15.78270    16  112
#>         52 1369.33 17.92850 10.52810 12.09090 15.44410    16  112
#>         53 1368.42 17.88140 10.44130 12.04870 15.36520    16  112
#>         54 1366.48 17.61510 10.38310 11.94490 15.13790    16  112
#>         55 1363.06 16.78580 10.04080 11.47630 14.45060    16  112
#>         56 1362.31 13.82850  8.69583  9.76333 11.93010    16  112
#>         57 1357.67 15.93530  9.66199 10.99520 13.73650    16  112
#>         58 1355.79 15.74690  9.56148 10.89120 13.57230    16  112
#>         59 1355.65 15.58150  9.41209 10.79040 13.40820    16  112
#>         60 1355.00 15.68560  9.44333 10.83690 13.49060    16  112
#>         61 1354.90 15.68560  9.41837 10.83000 13.49110    16  112
#>         62 1354.80 15.68740  9.37022 10.82650 13.48340    16  112
#>         63 1354.61 15.70510  9.29862 10.83830 13.48970    16  112
#>         64 1353.66 15.72660  8.80199 10.87760 13.46370    16  112
#>         65 1352.13 15.77960  8.26341 10.97590 13.48090    16  112
#>         66 1349.69 15.87630  7.49375 11.15190 13.53640    16  112
#>         67 1348.18 16.29090  6.02434 11.68150 13.86540    16  112
#>         68 1346.34 16.71400  6.71746 11.93300 14.29090    16  112
#>         69 1345.37 16.43280  6.82777 11.72850 14.04620    16  112
#>         70 1345.16 16.42540  6.64103 11.76870 14.03860    16  112
#>         71 1345.13 16.45730  6.57512 11.81440 14.06960    16  112
#>         72 1345.11 16.48070  6.56530 11.85440 14.09680    16  112
#>         73 1345.06 16.47850  6.55807 11.89300 14.10530    16  112
#>         74 1344.80 16.45650  6.57700 12.10850 14.14470    16  112
#>         75 1344.41 16.39200  6.57185 12.45800 14.18110    16  112
#>         76 1343.45 16.19350  6.59046 13.30500 14.23230    16  112
#>         77 1341.39 15.78050  6.60390 15.30820 14.37450    16  112
#>         78 1337.19 15.05110  6.65227 19.61790 14.76860    16  112
#>         79 1327.88 13.93180  6.70938 28.02470 15.71720    16  112
#>         80 1302.82 12.80220  6.76827 38.86270 17.14170    16  112
#>         81 1284.74 12.33980  6.79452 43.29190 17.72490    16  112
#>         82 1282.34 12.76410  6.77007 41.87900 17.70010    16  112
#>         83 1279.32 13.15660  6.72522 39.98650 17.56910    16  112
#>         84 1277.51 13.16020  6.62288 41.20580 17.80480    16  112
#>         85 1276.86 13.41570  6.58475 40.84230 17.89380    16  112
#>         86 1276.27 13.89050  6.52270 40.70480 18.16860    16  112
#>         87 1276.13 14.08000  6.52653 40.79190 18.30560    16  112
#>         88 1276.05 14.20080  6.54900 40.96770 18.41330    16  112
#>         89 1276.01 14.20620  6.56174 41.01130 18.41290    16  112
#>         90 1275.87 14.31720  6.60695 41.11430 18.43160    16  112
#>         91 1275.68 14.34790  6.62197 41.15470 18.37020    16  112
#>         92 1273.84 14.55290  6.75451 41.40800 17.47950    16  112
#>         93 1271.14 14.86770  6.88971 41.58780 15.89640    16  112
#>         94 1269.45 15.41650  6.99641 41.70710 12.99820    16  112
#>         95 1267.17 15.67980  6.82707 41.49850 14.43090    16  112
#>         96 1266.02 15.77030  6.69588 41.32660 14.35680    16  112
#>         97 1265.63 15.43280  6.57327 41.14070 14.04780    16  112
#>         98 1265.59 15.43120  6.59821 41.17400 14.03770    16  112
#>         99 1265.59 15.40390  6.59947 41.18690 14.02430    16  112
#>        100 1265.59 15.39370  6.59984 41.19000 14.02580    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.

# Copy model and accept all effects from the original model run
vpcModel <- copyModel(model, acceptAllEffects = TRUE, modelName = "vpc_model")
# }