Skip to contents

Runs candidate models with and without IIV on \(K_a\) by modifying only the corresponding random-effect setting in the current model code.

Usage

step_iiv_ka(
  dat,
  start.mod = NULL,
  search.space = "oralbase",
  no.cores = NULL,
  param_table = NULL,
  penalty.control = NULL,
  precomputed_results_file = NULL,
  filename = "test",
  foldername = NULL,
  .modEnv = NULL,
  verbose = TRUE,
  ...
)

Arguments

dat

A data frame containing pharmacokinetic data in standard nlmixr2 format, including "ID", "TIME", "EVID", and "DV", and may include additional columns.

start.mod

A named integer vector specifying the starting model code. If NULL, a base model is generated using base_model().

search.space

Character, one of "ivbase" or "oralbase". Default is "oralbase".

no.cores

Integer. Number of CPU cores to use. If NULL, uses rxode2::getRxThreads().

param_table

Optional data frame of initial parameter estimates. If NULL, the table is generated by auto_param_table().

penalty.control

A list of penalty control parameters defined by penaltyControl(), specifying penalty values used for model diagnostics during fitness evaluation.

precomputed_results_file

Optional path to a CSV file of previously computed model results used for caching.

filename

Optional character string used as a prefix for output files. Defaults to "test".

foldername

Character string specifying the name of the folder to be created in the current working directory to store intermediate results. If NULL, a temporary path is used via tempdir().

.modEnv

An optional environment used to store intermediate results across model runs.

verbose

Logical. If TRUE, print progress messages.

...

Additional arguments forwarded to mod.run().

Value

A list with the following elements:

  • results_table: A data.frame summarizing the evaluated models.

  • best_code: A named integer vector representing the selected model code.

  • best_row: A one-row data.frame corresponding to the selected model.

Details

This step is executed only when the search space is "oralbase" and the starting model code does not already include inter-individual variability on \(K_a\). If these conditions are not met, no model comparison is performed.

Author

Zhonghui Huang

Examples

# \donttest{
  dat <- theo_sd
  param_table <- initialize_param_table()
  param_table$init[param_table$Name == "lcl"] <- log(2)
  param_table$init[param_table$Name == "lvc"] <- log(30)
  penalty.control <- penaltyControl()
  penalty.control$penalty.terms <-
    c("rse", "theta", "covariance", "shrinkage", "omega")
  start.mod <- base_model("oralbase")
  step_iiv_ka(
    dat = dat,
    start.mod = start.mod,
    search.space = "oralbase",
    param_table = param_table,
    filename = "step_etaka_test",
    penalty.control = penalty.control,
    saem.control = nlmixr2est::saemControl(logLik = TRUE,nBurn=15,nEm=15)
  )
#> [Success] Model file created:
#> /tmp/RtmpzBHrsN/mod1.txt
#> SAEM control (core) = niter=15|15; nBurn=15; nEm=15; seed=99; print=1
#> [Success] Model file created:
#> /tmp/RtmpzBHrsN/mod2.txt
#> $results_table
#>        Step                            Penalty.terms
#> 1 IIV on Ka rse, theta, covariance, shrinkage, omega
#> 2 IIV on Ka rse, theta, covariance, shrinkage, omega
#>                                               Model.name            Model.code
#> 1   oral_1cmpt_FO_abs_etaCL_FOelim_uncorrelated_combined 1,0,0,0,0,0,0,0,0,0,3
#> 2 oral_1cmpt_FO_abs_etaCLKA_FOelim_uncorrelated_combined 1,0,0,0,0,0,0,1,0,0,3
#>    Fitness      AIC      BIC      OFV
#> 1 20538.42 521.1247 538.4215 266.5249
#> 2 10673.18 632.9992 653.1788 376.3994
#> 
#> $best_code
#> no.cmpt  eta.km  eta.vc  eta.vp eta.vp2   eta.q  eta.q2  eta.ka      mm   mcorr 
#>       1       0       0       0       0       0       0       1       0       0 
#>      rv 
#>       3 
#> 
#> $best_row
#>        Step                            Penalty.terms
#> 2 IIV on Ka rse, theta, covariance, shrinkage, omega
#>                                               Model.name            Model.code
#> 2 oral_1cmpt_FO_abs_etaCLKA_FOelim_uncorrelated_combined 1,0,0,0,0,0,0,1,0,0,3
#>    Fitness      AIC      BIC      OFV
#> 2 10673.18 632.9992 653.1788 376.3994
#> 
# }