Introduction

These R functions require to install and load the MlxConnectors package, available with Monolix 2018.

install.packages("C:/ProgramData/Lixoft/MonolixSuite2018R1/mlxConnectors/R/MlxConnectors.tar.gz", 
repos = NULL, type = "source")
library("MlxConnectors")

You then need to initialize the Monolix connectors:

initializeMlxConnectors(software = "monolix")
## [INFO] The path to monolix installation directory has not been given.
## [INFO] The directory specified in the initialization file of the Lixoft Suite (located at "C:\Users\Marc\lixoft\lixoft.ini") will be used by default.
## -> "C:/ProgramData/Lixoft/MonolixSuite2018R1"

In some non-standard installation cases of Monolix, it may be necessary to specify the path to the installation directory of the Lixoft suite. If no path is given, the one written in the lixoft.ini file is used (usually “C:/ProgramData/Lixoft/MonolixSuite2018R1” for Windows).

initializeMlxConnectors(software = "monolix", mlxDirectory = "/path/to/MonolixSuite2018R1/")

getEstimatedIndividualParameters2

Get

Example:

We first load the warfarinPKPD project with the results already available

project <- "projects/warfarinPK1.mlxtran"
loadProject(project)
## [INFO] Results have been succesfully loaded

In this example, \(V\) depends on \({\rm wt}\) while \(Cl\) depends on \({\rm sex}\)

getIndividualParameterModel()$covariateModel
## $ka
##   sex   age  lw70    wt 
## FALSE FALSE FALSE FALSE 
## 
## $V
##   sex   age  lw70    wt 
## FALSE FALSE  TRUE FALSE 
## 
## $Cl
##   sex   age  lw70    wt 
##  TRUE FALSE FALSE FALSE
p <- getEstimatedIndividualParameters2()
names(p)
## [1] "saem"            "conditionalMean" "conditionalSD"   "conditionalMode"
## [5] "popPopCov"       "popIndCov"
head(p$popPopCov,8)
##    id        ka        V        Cl
## 1 100 0.6182933 7.809852 0.1226697
## 2   1 0.6182933 7.809852 0.1226697
## 3   2 0.6182933 7.809852 0.1226697
## 4   3 0.6182933 7.809852 0.1226697
## 5   4 0.6182933 7.809852 0.1226697
## 6   5 0.6182933 7.809852 0.1226697
## 7   6 0.6182933 7.809852 0.1226697
## 8   7 0.6182933 7.809852 0.1226697
head(p$popIndCov,8)
##    id        ka        V        Cl
## 1 100 0.6182933 7.471361 0.1360221
## 2   1 0.6182933 7.471361 0.1360221
## 3   2 0.6182933 7.471361 0.1360221
## 4   3 0.6182933 8.827819 0.1360221
## 5   4 0.6182933 4.673506 0.1226697
## 6   5 0.6182933 8.350767 0.1360221
## 7   6 0.6182933 6.779781 0.1226697
## 8   7 0.6182933 9.835321 0.1360221
head(p$conditionalMode,8)
##    id        ka         V        Cl
## 1 100 0.2064192  7.431619 0.2727893
## 2   1 0.6041597  7.550416 0.1148304
## 3   2 0.4010885  7.723738 0.1319069
## 4   3 0.6638254  8.515940 0.1147760
## 5   4 0.7660089  4.867287 0.0765051
## 6   5 0.3916819 10.091620 0.1793809
## 7   6 0.9368598  6.179232 0.2214085
## 8   7 1.6474671  8.215237 0.1737963


getEstimatedPredictions

Get the individual predictions obtained with the estimated individual parameters

project <- "projects/warfarinPKPD.mlxtran"
loadProject(project)
## [INFO] Results have been succesfully loaded
r <- getEstimatedPredictions()
names(r)
## [1] "Cc" "R"
head(r$Cc)
##    id time popPopCov popIndCov conditionalMean
## 1 100  0.5  0.000000  0.000000        0.000000
## 2 100  1.0  5.947936  5.947936        1.571390
## 3 100  2.0 11.001960 11.001960        4.446337
## 4 100  3.0 11.965629 11.965629        6.422338
## 5 100  6.0 11.690630 11.690630        9.130060
## 6 100  9.0 11.116876 11.116876        9.509017
head(r$R)
##    id time popPopCov popIndCov conditionalMean
## 1 100   24  34.85856  34.85856        38.26558
## 2 100   36  24.38466  24.38466        29.42639
## 3 100   48  20.01869  20.01869        27.59837
## 4 100   72  20.01336  20.01336        35.88959
## 5 100   96  25.20197  25.20197        51.33813
## 6 100  120  32.80747  32.80747        66.61715


getEstimatedResiduals

Get the residuals computed from the individual predictions obtained with the estimated individual parameters.

r <- getEstimatedResiduals()
names(r)
## [1] "y1" "y2"
head(r$y1)
##    popPopCov  popIndCov conditionalMean
## 1  0.0000000  0.0000000      0.00000000
## 2 -6.6052066 -6.6052066      0.83880881
## 3 -8.8717463 -8.8717463     -2.13475926
## 4 -5.8524049 -5.8524049      0.27899057
## 5 -2.8691272 -2.8691272     -0.03885865
## 6 -0.3625793 -0.3625793      1.62853065
head(r$y2)
##   popPopCov popIndCov conditionalMean
## 1 2.4299418 2.4299418       1.5243000
## 2 0.6951999 0.6951999      -0.6449725
## 3 2.1215616 2.1215616       0.1067590
## 4 2.9204261 2.9204261      -1.2997307
## 5 9.2498757 9.2498757       2.3024637
## 6 8.5572901 8.5572901      -0.4298646


getSimulatedPredictions

Get the individual predictions obtained with the simulated individual parameters

r <- getSimulatedPredictions()
names(r)
## [1] "Cc" "R"
head(r$Cc)
##   rep  id time       Cc
## 1   1 100  0.5 0.000000
## 2   1 100  1.0 1.726032
## 3   1 100  2.0 4.818867
## 4   1 100  3.0 6.874309
## 5   1 100  6.0 9.464993
## 6   1 100  9.0 9.612777
head(r$R)
##   rep  id time        R
## 1   1 100   24 38.40097
## 2   1 100   36 29.24420
## 3   1 100   48 27.16583
## 4   1 100   72 35.86894
## 5   1 100   96 52.43279
## 6   1 100  120 68.21798


getSimulatedResiduals

Get the residuals computed from the individual predictions obtained with the simulated individual parameters.

r <- getSimulatedResiduals()
names(r)
## [1] "y1" "y2"
head(r$y1)
##   rep  id time   residual
## 1   1 100  0.5  0.0000000
## 2   1 100  1.0  0.4353875
## 3   1 100  2.0 -2.7327332
## 4   1 100  3.0 -0.4158490
## 5   1 100  6.0 -0.4617220
## 6   1 100  9.0  1.4878047
head(r$y2)
##   rep  id time   residual
## 1   1 100   24  1.4883123
## 2   1 100   36 -0.5965436
## 3   1 100   48  0.2217369
## 4   1 100   72 -1.2942434
## 5   1 100   96  2.0114846
## 6   1 100  120 -0.8553898