library(Rsmlx)
library(ggplot2)
theme_set(theme_bw())

Read and plot the data

Let us first read the warfarin PKPD data using an existing Monolix project

warfarinPKPD.project <- "projects/warfarinPKPD.mlxtran"
warfarin.data <- mlxR::readDatamlx(project = warfarinPKPD.project)
## [INFO] The lixoftConnectors package has been successfully initialized:
## lixoftConnectors package version -> 2019.1
## Lixoft softwares suite version   -> 2019R1
print(warfarin.data$data)
## NULL

We can now plot the PK data

ggplot(warfarin.data$y1, aes(x=time, y=y1, color=id)) + geom_point(size=1) + geom_line() +
  theme(legend.position = "none") 

and the PD data

ggplot(warfarin.data$y2, aes(x=time, y=y2, color=id)) + geom_point(size=1) + geom_line() +
  theme(legend.position = "none") 


Building the statistical model

The structural model for this data is a joint model from the Monolix PKPD library.

The administration is extravascular with a first order absorption (rate constant ka) and a lag time (Tlag). The PK model has one compartment (volume V) and a linear elimination (clearance Cl). The PD model is an indirect turnover model with full inhibition (Imax=1) of the production (baseline response R0, degradation rate kout, and half-maximal inhibitory concentration IC50).

We will then use buildmlxfor building the statistical model

warfarinPKPD.res <- buildmlx(project=warfarinPKPD.project, covToTransform = "all")
## [INFO] lixoftConnectors package switched from "simulx" mode to "monolix" mode.
## 
## 
## direction = "full" will be used for the covariate search
## 
## ____________________________________________
## Initialization:
## 
## Covariate model:
##      sex age lw70 wt
## Tlag   0   0    0  0
## ka     0   0    0  0
## V      0   0    1  0
## Cl     0   0    1  0
## Imax   0   0    0  0
## IC50   0   0    0  0
## Rin    0   0    0  0
## kout   0   0    0  0
## 
## Correlation model:
## list()
## 
## Residual error model:
##          y1          y2 
## "combined1"  "constant" 
## Estimation of the log-likelihood of the initial model ... 
## 
## Estimated criteria (importanceSampling):
##    -2LL    s.e.     AIC    BICc     BIC 
## 2079.43    0.69 2121.43 2181.98 2152.21 
## ____________________________________________
## ____________________________________________
## Iteration 1:
## 
## Covariate model:
##      sex age lw70 wt lage lwt
## Tlag   0   0    0  0    0   0
## ka     0   0    0  0    0   0
## V      0   0    1  0    0   0
## Cl     0   0    1  0    1   0
## Imax   0   0    0  0    0   0
## IC50   0   0    0  0    0   0
## Rin    0   0    0  0    0   0
## kout   0   0    0  0    0   0
## 
## Correlation model:
## list()
## 
## Residual error model:
##          y1          y2 
## "combined2"  "constant" 
## Run scenario for model 1 ... 
## Estimation of the population parameters... 
## Sampling from the conditional distribution... 
## Estimation of the log-likelihood... 
## 
## Estimated criteria (importanceSampling):
##    -2LL    s.e.     AIC    BICc     BIC 
## 2064.99    0.14 2108.99 2171.00 2141.24 
## ____________________________________________
## Iteration 2:
## 
## Covariate model:
##      sex age lw70 wt lage lwt
## Tlag   0   0    0  0    0   0
## ka     0   0    0  0    0   0
## V      0   0    1  0    0   0
## Cl     0   0    1  0    1   0
## Imax   0   0    0  0    0   0
## IC50   0   0    0  0    0   0
## Rin    0   0    0  0    0   0
## kout   0   0    0  0    0   0
## 
## Correlation model:
## list()
## 
## Residual error model:
##          y1          y2 
## "combined2" "combined1" 
## Run scenario for model 2 ... 
## Estimation of the population parameters... 
## Sampling from the conditional distribution... 
## Estimation of the log-likelihood... 
## 
## Estimated criteria (importanceSampling):
##    -2LL    s.e.     AIC    BICc     BIC 
## 2044.06    0.18 2090.06 2156.24 2123.77 
## ____________________________________________
## Iteration 3:
## 
## Covariate model:
##      sex age lw70 wt lage lwt
## Tlag   0   0    0  0    0   0
## ka     0   0    0  0    0   0
## V      0   0    1  0    0   0
## Cl     0   0    1  0    1   0
## Imax   0   0    0  0    0   0
## IC50   0   0    0  0    1   0
## Rin    0   0    0  0    0   0
## kout   0   0    0  0    0   0
## 
## Correlation model:
## list()
## 
## Residual error model:
##             y1             y2 
##    "combined2" "proportional" 
## Run scenario for model 3 ... 
## Estimation of the population parameters... 
## Sampling from the conditional distribution... 
## Estimation of the log-likelihood... 
## 
## Estimated criteria (importanceSampling):
##    -2LL    s.e.     AIC    BICc     BIC 
## 2041.19    0.18 2087.19 2150.67 2120.90 
## ____________________________________________
## Iteration 4:
## No difference between two successive iterations
## ____________________________________________
## Final model:
## 
## Covariate model:
##      sex age lw70 wt lage lwt
## Tlag   0   0    0  0    0   0
## ka     0   0    0  0    0   0
## V      0   0    1  0    0   0
## Cl     0   0    1  0    1   0
## Imax   0   0    0  0    0   0
## IC50   0   0    0  0    1   0
## Rin    0   0    0  0    0   0
## kout   0   0    0  0    0   0
## 
## Correlation model:
## list()
## 
## Residual error model:
##             y1             y2 
##    "combined2" "proportional" 
## 
## Estimated criteria (importanceSampling):
##    -2LL    s.e.     AIC    BICc     BIC 
## 2041.19    0.18 2087.19 2150.67 2120.90 
## ____________________________________________
## total time: 173.1s
## ____________________________________________


Confidence intervals

90% confidence intervals for the population parameters can be computed using confintmlx with the estimated Fisher Information Matrix

ci.fim <- confintmlx(project=warfarinPKPD.res$project, linearization=FALSE)
## Estimation of the standard errors ...
print(ci.fim$confint)
##                   estimate        lower       upper
## Tlag_pop        0.84136711  0.608040015  1.16423030
## ka_pop          1.22715089  0.809538711  1.86019432
## V_pop           7.99912010  7.628216303  8.38805821
## beta_V_lw70     0.88505519  0.641640359  1.12847003
## Cl_pop          0.13720581  0.127431118  0.14773028
## beta_Cl_lage    0.33498366  0.090700200  0.57926712
## beta_Cl_lw70    0.64769233  0.259922528  1.03546213
## Imax_pop        0.99994854  0.999237594  0.99999653
## IC50_pop        1.08501239  0.943032003  1.24836897
## beta_IC50_lage -0.57961361 -1.024677661 -0.13454955
## Rin_pop         5.26944832  5.077032343  5.46915674
## kout_pop        0.05372605  0.052185461  0.05531213
## omega_Tlag      0.47682923  0.327609236  0.69401619
## omega_ka        0.77941880  0.511271776  1.18820107
## omega_V         0.14624826  0.113529050  0.18839720
## omega_Cl        0.24409674  0.196785191  0.30278305
## omega_Imax      1.27727457  0.238000318  6.85474008
## omega_IC50      0.43140471  0.339817179  0.54767692
## omega_Rin       0.02137942  0.006931041  0.06594672
## omega_kout      0.04943081  0.033440251  0.07306778
## a1              0.33697392  0.267610218  0.40633763
## b1              0.06928487  0.057454655  0.08111509
## b2              0.12291266  0.111357305  0.13446802