Overview

Description

Fit several structural PK models and select the best one based on a corrected Bayesian Information Criterion for mixed effects models.

Models to compare can be defined by rate constants and/or clearances and can include or not nonlinear elimination models.

Usage

pkbuild <- function(data=NULL, project=NULL, param="clearance", new.dir=NULL, MM=FALSE, level=NULL) 

Arguments

data
a list with fields
project
a Monolix project
param
parameterization ({“clearance”}, “rate”, “both)
new.dir
name of the directory where the created files are stored (default is the current working directory)
MM
({FALSE}, TRUE): tested models include or not Michaelis Menten elimination models
level
an integer between 1 and 9 (used by setSettings)


Examples

Reading a data file

Let us use the warfarin PK data in this example:

head(read.csv('data/warfarinPK.csv'))
##   id time   y amount   wt age sex
## 1  1    0   .    100 66.7  50   1
## 2  1   24 9.2      . 66.7  50   1
## 3  1   36 8.5      . 66.7  50   1
## 4  1   48 6.4      . 66.7  50   1
## 5  1   72 4.8      . 66.7  50   1
## 6  1   96 3.1      . 66.7  50   1

warfarin is administrated orally:

library(Rsmlx)
warfarinPK <- list(
  dataFile = "data/warfarinPK.csv",
  headerTypes = c("id", "time", "observation", "amount", "contcov", "contcov", "catcov"),
  administration = "oral")

By default, PK models parameterized with clearance(s) are fitted.

warf.pk1 <- pkbuild(data=warfarinPK,  new.dir="warfarinPK")
## 
## [1] "warfarinPK/pk_kaVCl.mlxtran"
## Estimation of the population parameters...
## Estimation of the log-likelihood... 
## 
## [1] "warfarinPK/pk_Tk0VCl.mlxtran"
## Estimation of the population parameters...
## Estimation of the log-likelihood... 
## 
## [1] "warfarinPK/pk_TlagkaVCl.mlxtran"
## Estimation of the population parameters...
## Estimation of the log-likelihood... 
## 
## [1] "warfarinPK/pk_TlagTk0VCl.mlxtran"
## Estimation of the population parameters...
## Estimation of the log-likelihood... 
## 
## [1] "warfarinPK/pk_TlagTk0V1V2QCl.mlxtran"
## Estimation of the population parameters...
## Estimation of the log-likelihood... 
## 
## [1] "warfarinPK/pk_TlagkaV1V2QCl.mlxtran"
## Estimation of the population parameters...
## Estimation of the log-likelihood...

Comparison of these models is based on a corrected Bayesian Information Criterion for mixed effects models:

\[{\rm BIC}_{\rm cor} = -2 LL + \log(N)\times d_N + \log(n) \times d_n\] where \(N\) is the number of individuals and \(n\) the total number of observations. Then, \(d_N\) is the number of parameters associated to the variability of the individual parameters and \(d_n\) the number of parameters associated to the variability of the observations.

According to this criterion, the best PK model for this data is oral0_1cpt_TlagTk0VCl.txt.

print(warf.pk1)
## $pop.ini
##      Tlag       Tk0         V        Cl 
## 0.4976130 2.7169311 8.0309565 0.1314533 
## 
## $project
## [1] "warfarinPK/pk_TlagTk0VCl.mlxtran"
## 
## $model
## [1] "C:/ProgramData/Lixoft/MonolixSuite2018R2/factory/library/pk/oral0_1cpt_TlagTk0VCl.txt"
## 
## $data
## $data$dataFile
## [1] "data/warfarinPK.csv"
## 
## $data$headerTypes
## [1] "id"          "time"        "observation" "amount"      "contcov"    
## [6] "contcov"     "catcov"     
## 
## $data$administration
## [1] "oral"
## 
## 
## $bic
##                           model  bic.cor
## 1     oral0_1cpt_TlagTk0VCl.txt 733.1481
## 2      oral1_1cpt_TlagkaVCl.txt 741.6389
## 3 oral0_2cpt_TlagTk0ClV1QV2.txt 742.6148
## 4  oral1_2cpt_TlagkaClV1QV2.txt 747.3132
## 5         oral0_1cpt_Tk0VCl.txt 852.9823
## 6          oral1_1cpt_kaVCl.txt 930.6924
## 
## $pop.est
##   Tlag_pop    Tk0_pop      V_pop     Cl_pop   omega_Cl  omega_Tk0 
## 0.76667249 1.44991989 8.01969062 0.13187578 0.29005720 0.62290427 
## omega_Tlag    omega_V          a          b 
## 0.52872349 0.22050731 0.29641453 0.08008048

Models parameterized with rate constants can be used instead:

warf.pk2 <- pkbuild(data=warfarinPK,  new.dir="warfarinPK", param="rate")
## 
## [1] "warfarinPK/pk_kaVk.mlxtran"
## Estimation of the population parameters...
## Estimation of the log-likelihood... 
## 
## [1] "warfarinPK/pk_Tk0Vk.mlxtran"
## Estimation of the population parameters...
## Estimation of the log-likelihood... 
## 
## [1] "warfarinPK/pk_TlagkaVk.mlxtran"
## Estimation of the population parameters...
## Estimation of the log-likelihood... 
## 
## [1] "warfarinPK/pk_TlagTk0Vk.mlxtran"
## Estimation of the population parameters...
## Estimation of the log-likelihood... 
## 
## [1] "warfarinPK/pk_TlagTk0Vk12k21k.mlxtran"
## Estimation of the population parameters...
## Estimation of the log-likelihood... 
## 
## [1] "warfarinPK/pk_TlagkaVk12k21k.mlxtran"
## Estimation of the population parameters...
## Estimation of the log-likelihood... 
## 
## [1] "warfarinPK/pk_TlagTk0Vk12k21k13k31k.mlxtran"
## Estimation of the population parameters...
## Estimation of the log-likelihood...
print(warf.pk2$bic)
##                                  model  bic.cor
## 1       oral0_2cpt_TlagTk0Vkk12k21.txt 728.8428
## 2             oral0_1cpt_TlagTk0Vk.txt 730.0196
## 3        oral1_2cpt_TlagkaVkk12k21.txt 735.0020
## 4              oral1_1cpt_TlagkaVk.txt 739.8068
## 5 oral0_3cpt_TlagTk0Vkk12k21k13k31.txt 750.0923
## 6                 oral0_1cpt_Tk0Vk.txt 848.6419
## 7                  oral1_1cpt_kaVk.txt 930.1225
print(warf.pk2$pop.est)
##   Tlag_pop    Tk0_pop      V_pop      k_pop    k12_pop    k21_pop 
## 0.75361753 1.55712577 7.68333651 0.01531562 0.00123484 0.01073081 
##  omega_Tk0 omega_Tlag    omega_V    omega_k  omega_k12  omega_k21 
## 0.52345186 0.55001744 0.20284500 0.12669779 1.91575523 1.97310823 
##          a          b 
## 0.26006046 0.08041606

or both:

warf.pk3 <- pkbuild(data=warfarinPK,  new.dir="warfarinPK", param="both")
## 
## [1] "warfarinPK/pk_kaVCl.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_Tk0VCl.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_TlagkaVCl.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_TlagTk0VCl.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_TlagTk0V1V2QCl.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_TlagkaV1V2QCl.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_kaVk.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_Tk0Vk.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_TlagkaVk.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_TlagTk0Vk.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_TlagTk0Vk12k21k.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_TlagkaVk12k21k.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_TlagTk0Vk12k21k13k31k.mlxtran"
## [INFO] Results have been successfully loaded
print(warf.pk3$bic)
##                                   model  bic.cor
## 1        oral0_2cpt_TlagTk0Vkk12k21.txt 728.8428
## 2              oral0_1cpt_TlagTk0Vk.txt 730.0196
## 3             oral0_1cpt_TlagTk0VCl.txt 733.1481
## 4         oral1_2cpt_TlagkaVkk12k21.txt 735.0020
## 5               oral1_1cpt_TlagkaVk.txt 739.8068
## 6              oral1_1cpt_TlagkaVCl.txt 741.6389
## 7         oral0_2cpt_TlagTk0ClV1QV2.txt 742.6148
## 8          oral1_2cpt_TlagkaClV1QV2.txt 747.3132
## 9  oral0_3cpt_TlagTk0Vkk12k21k13k31.txt 750.0923
## 10                 oral0_1cpt_Tk0Vk.txt 848.6419
## 11                oral0_1cpt_Tk0VCl.txt 852.9823
## 12                  oral1_1cpt_kaVk.txt 930.1225
## 13                 oral1_1cpt_kaVCl.txt 930.6924


Using a Monolix project

If a Monolix project has been already created using the data file, it can be used for providing data information

warf.pk4  <- pkbuild(project="projects/warfarinPK.mlxtran", new.dir="warfarinPK")
## 
## [1] "warfarinPK/pk_kaVCl.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_Tk0VCl.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_TlagkaVCl.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_TlagTk0VCl.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_TlagTk0V1V2QCl.mlxtran"
## [INFO] Results have been successfully loaded
## 
## [1] "warfarinPK/pk_TlagkaV1V2QCl.mlxtran"
## [INFO] Results have been successfully loaded

Of course, the results are the same as those obtained using the data file

print(warf.pk4$bic)
##                           model  bic.cor
## 1     oral0_1cpt_TlagTk0VCl.txt 733.1481
## 2      oral1_1cpt_TlagkaVCl.txt 741.6389
## 3 oral0_2cpt_TlagTk0ClV1QV2.txt 742.6148
## 4  oral1_2cpt_TlagkaClV1QV2.txt 747.3132
## 5         oral0_1cpt_Tk0VCl.txt 852.9823
## 6          oral1_1cpt_kaVCl.txt 930.6924