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.
setSettings(project, new.project=NULL, level=5)
Let us use the following PK project which was created with the default settings (level=5)
project <- "projects/warfarinPK1.mlxtran"
We first create a new project that will run extremly fast in Monolix.
library(Rsmlx)
setSettings(project, new.project="projects/warfarinPK1_level1.mlxtran", level=1)
We now modify the settings of the original project in order to get very accurate results:
setSettings(project, level=9)
setSettings
can be used as a Monolix connector.
library("lixoftConnectors")
initializeLixoftConnectors(software = "monolix")
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
setSettings(level=1)
unlist(getPopulationParameterEstimationSettings())
## exploratoryautostop smoothingautostop
## "TRUE" "TRUE"
## nbburningiterations nbexploratoryiterations
## "5" "500"
## nbsmoothingiterations simulatedannealing
## "50" "TRUE"
## simulatedannealingiterations exploratoryalpha
## "1000" "0"
## smoothingalpha exploratoryinterval
## "0.7" "50"
## smoothinginterval smoothingratio
## "20" "0.1"
## variability tauomega
## "none" "0.9"
## tauerrormodel nboptimizationiterations
## "0.9" "10"
## optimizationtolerance
## "5e-04"
unlist(getStandardErrorEstimationSettings())
## miniterations maxiterations
## 50 200
unlist(getConditionalDistributionSamplingSettings())
## nbminiterations nbsimulatedparameters ratio
## 20.0 5.0 0.1
unlist(getLogLikelihoodEstimationSettings())
## nbfixediterations nbfreedomdegrees freedomdegreessampling1
## "5000" "5" "1"
## freedomdegreessampling2 freedomdegreessampling3 freedomdegreessampling4
## "2" "5" "10"
## freedomdegreessampling5 samplingmethod
## "15" "fixed"
Running the complete sequence of tasks is extremely fast with these settings:
ptm <- proc.time()
runScenario()
print(proc.time() - ptm)
## user system elapsed
## 6.77 0.27 2.10
Here are some results obtained with
getEstimatedPopulationParameters()
## ka_pop V_pop Cl_pop omega_ka omega_V omega_Cl
## 0.60725714 7.70495328 0.13348864 0.76359681 0.20726923 0.28274915
## a1 b1
## 0.58293777 0.06724816
getEstimatedStandardErrors()
## $stochasticApproximation
## ka_pop V_pop Cl_pop omega_ka omega_V omega_Cl
## 0.14388645 0.32703877 0.00704306 0.24386013 0.02954997 0.03890614
## a1 b1
## 0.09777818 0.01702185
getEstimatedLogLikelihood()
## $importanceSampling
## -2LL standardError AIC BICc BIC
## 850.472426 0.184638 866.472426 888.416575 878.198313
Algorithms require much more time with the settings defined with
setSettings(level=9)
unlist(getPopulationParameterEstimationSettings())
## exploratoryautostop smoothingautostop
## "TRUE" "TRUE"
## nbburningiterations nbexploratoryiterations
## "5" "1000"
## nbsmoothingiterations simulatedannealing
## "1000" "TRUE"
## simulatedannealingiterations exploratoryalpha
## "1000" "0"
## smoothingalpha exploratoryinterval
## "0.7" "300"
## smoothinginterval smoothingratio
## "200" "0.1"
## variability tauomega
## "none" "0.98"
## tauerrormodel nboptimizationiterations
## "0.98" "40"
## optimizationtolerance
## "5e-05"
unlist(getStandardErrorEstimationSettings())
## miniterations maxiterations
## 200 400
unlist(getConditionalDistributionSamplingSettings())
## nbminiterations nbsimulatedparameters ratio
## 200.00 25.00 0.01
unlist(getLogLikelihoodEstimationSettings())
## nbfixediterations nbfreedomdegrees freedomdegreessampling1
## "50000" "5" "1"
## freedomdegreessampling2 freedomdegreessampling3 freedomdegreessampling4
## "2" "5" "10"
## freedomdegreessampling5 samplingmethod
## "15" "fixed"
ptm <- proc.time()
runScenario()
print(proc.time() - ptm)
## user system elapsed
## 92.60 1.36 27.61
Of course, results obtained with
getEstimatedPopulationParameters()
## ka_pop V_pop Cl_pop omega_ka omega_V omega_Cl
## 0.58442519 7.76791533 0.13350195 0.76676366 0.22021213 0.28190062
## a1 b1
## 0.55669386 0.07175258
getEstimatedStandardErrors()
## $stochasticApproximation
## ka_pop V_pop Cl_pop omega_ka omega_V omega_Cl
## 0.151296033 0.350195987 0.007052124 0.210525231 0.036307467 0.039493863
## a1 b1
## 0.094964592 0.017450940
getEstimatedLogLikelihood()
## $importanceSampling
## -2LL standardError AIC BICc BIC
## 850.20843363 0.02635225 866.20843363 888.15258302 877.93432085