Overview

Description

Use a single accuracy level, between 1 and 9, to automatically tune all the settings of a Monolix project.

When the accuray level is equal to 1, the algorithms are very fast but the results may be not precise.

When the accuray level is equal to 9, the algorithms require more time but the results are much more accurate.

Default Monolix settings are obtained with level=5.

Usage

setSettings(project, new.project=NULL, level=5)

Arguments

project
a Monolix project.
new.project
the new created Monolix project (default is the original project)
level
an integer between 1 and 9 (default=5)


Example

Let us use the following PK project which was created with the default settings (level=5)

project <- "projects/warfarinPK2.mlxtran"

We first create a new project that will run extremly fast in Monolix.

setSettings(project, new.project="projects/warfarinPK2_level1.mlxtran", level=1)

We now modify the settings of the original project in order to get very accurate results:

setSettings(project, level=9)


Using setSettings with MlxConnectors

setSettingscan be used as a Monolix connector.

library("MlxConnectors")
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"
project <- "projects/warfarinPK2.mlxtran"
loadProject(project)

All the tasks are performed with this project, without linearization:

getScenario()[1:2]
## $tasks
##   populationParameterEstimation conditionalDistributionSampling 
##                            TRUE                            TRUE 
##       conditionalModeEstimation         standardErrorEstimation 
##                            TRUE                            TRUE 
##         logLikelihoodEstimation                           plots 
##                            TRUE                           FALSE 
## 
## $linearization
## [1] FALSE

New settings are automatically defined with level=1:

setSettings(level=1)
unlist(getPopulationParameterEstimationSettings())
##      nbburningiterations  nbexploratoryiterations      exploratoryautostop 
##                      "5"                    "500"                   "TRUE" 
##      exploratoryinterval         exploratoryalpha    nbsmoothingiterations 
##                    "150"                      "0"                    "200" 
##        smoothingautostop        smoothinginterval           smoothingalpha 
##                   "TRUE"                     "50"                    "0.7" 
##           smoothingratio       simulatedannealing                 tauomega 
##                    "0.1"                   "TRUE"                   "0.95" 
##            tauerrormodel              variability nboptimizationiterations 
##                   "0.95"                   "none"                     "20" 
##    optimizationtolerance 
##                  "1e-04"
unlist(getStandardErrorEstimationSettings())
## miniterations maxiterations 
##            50           200
unlist(getConditionalDistributionSamplingSettings())
##                 ratio       nbminiterations nbsimulatedparameters 
##                  0.05                 50.00                 10.00
unlist(getLogLikelihoodEstimationSettings())
##       nbfixediterations          samplingmethod        nbfreedomdegrees 
##                 "10000"                 "fixed"                     "5" 
## freedomdegreessampling1 freedomdegreessampling2 freedomdegreessampling3 
##                     "1"                     "2"                     "5" 
## freedomdegreessampling4 freedomdegreessampling5 
##                    "10"                    "15"

Running the complete sequence of tasks is extremely fast with these settings:

ptm <- proc.time()
runScenario()
print(proc.time() - ptm)
##    user  system elapsed 
##    8.82    0.41    3.23

Here are some results obtained with level=1:

getEstimatedPopulationParameters()
##    ka_pop     V_pop    Cl_pop  omega_ka   omega_V  omega_Cl        a1 
## 0.6039859 7.7372264 0.1336502 0.7385390 0.2194838 0.2795273 0.5569399 
##        b1 
## 0.0828160
getEstimatedStandardErrors()
## $stochasticApproximation
##      ka_pop       V_pop      Cl_pop    omega_ka     omega_V    omega_Cl 
## 0.148921718 0.351668685 0.007037249 0.192084836 0.036817338 0.038627763 
##          a1          b1 
## 0.104388655 0.018922506
getEstimatedLogLikelihood()
## $importanceSampling
##          -2LL standardError           AIC           BIC 
##  884.98669716    0.03144165  900.98669716  912.71258438

Algorithms require much more time with the settings defined with level=9

setSettings(level=9)
unlist(getPopulationParameterEstimationSettings())
##      nbburningiterations  nbexploratoryiterations      exploratoryautostop 
##                      "5"                    "500"                   "TRUE" 
##      exploratoryinterval         exploratoryalpha    nbsmoothingiterations 
##                    "150"                      "0"                    "200" 
##        smoothingautostop        smoothinginterval           smoothingalpha 
##                   "TRUE"                     "50"                    "0.7" 
##           smoothingratio       simulatedannealing                 tauomega 
##                    "0.1"                   "TRUE"                   "0.95" 
##            tauerrormodel              variability nboptimizationiterations 
##                   "0.95"                   "none"                     "20" 
##    optimizationtolerance 
##                  "1e-04"
unlist(getStandardErrorEstimationSettings())
## miniterations maxiterations 
##            50           200
unlist(getConditionalDistributionSamplingSettings())
##                 ratio       nbminiterations nbsimulatedparameters 
##                  0.05                 50.00                 10.00
unlist(getLogLikelihoodEstimationSettings())
##       nbfixediterations          samplingmethod        nbfreedomdegrees 
##                 "10000"                 "fixed"                     "5" 
## freedomdegreessampling1 freedomdegreessampling2 freedomdegreessampling3 
##                     "1"                     "2"                     "5" 
## freedomdegreessampling4 freedomdegreessampling5 
##                    "10"                    "15"
ptm <- proc.time()
runScenario()
print(proc.time() - ptm)
##    user  system elapsed 
##    8.41    0.40    3.39

Of course, results obtained with level=9 are supposed to be ``better’’ than those obtained with level=1

getEstimatedPopulationParameters()
##    ka_pop     V_pop    Cl_pop  omega_ka   omega_V  omega_Cl        a1 
## 0.6039859 7.7372264 0.1336502 0.7385390 0.2194838 0.2795273 0.5569399 
##        b1 
## 0.0828160
getEstimatedStandardErrors()
## $stochasticApproximation
##      ka_pop       V_pop      Cl_pop    omega_ka     omega_V    omega_Cl 
## 0.148921718 0.351668685 0.007037249 0.192084836 0.036817338 0.038627763 
##          a1          b1 
## 0.104388655 0.018922506
getEstimatedLogLikelihood()
## $importanceSampling
##          -2LL standardError           AIC           BIC 
##  884.98669716    0.03144165  900.98669716  912.71258438