Overview

Description

buildAll builds the complete statistical model by iteratively calling functions buildmlx and buildVar.

Usage

buildAll <- function(project=NULL, final.project=NULL, model="all", prior=NULL, weight=NULL, coef.w1=0.5, cv.min=0.001, fError.min=1e-3,
                     paramToUse="all", covToTest="all", covToTransform="none", center.covariate=FALSE, 
                     criterion="BICc", linearization=FALSE, ll=T, test=T, direction=NULL, steps=1000,
                     max.iter=20, explor.iter=2, seq.cov=FALSE, seq.corr=TRUE, seq.cov.iter=0, 
                     p.max=0.1, p.min=c(0.075, 0.05, 0.1), print=TRUE, nb.model=1,
                     fix.param1=NULL, fix.param0=NULL, remove=T, add=T, delta=c(30,10,5), 
                     omega.set=NULL, pop.set1=NULL, pop.set2=NULL)

Arguments

project
a string: the initial Monolix project
final.project
the final Monolix project (default is the original project)a string: the final Monolix project (default adds “_buildAll” to the original project)
model
the components of the model to optimize c(“residualError”, “covariate”, “correlation”), (default=“all”)
prior
list of prior probabilities for each component of the model (default=NULL)
weight
list of penalty weights for each component of the model (default=NULL)
coef.w1
multiplicative weight coefficient used for the first iteration only (default=0.5)
cv.min
value of the coefficient of variation below which an individual parameter is considered fixed (default=0.001)
fError.min
minimum fraction of residual variance for combined error model (default = 1e-3)
paramToUse
list of parameters possibly function of covariates (default=“all”)
covToTest
components of the covariate model that can be modified (default=“all”)
covToTransform
list of (continuous) covariates to be log-transformed (default=“none”)
center.covariate
TRUE/{FALSE} center the covariates of the final model (default=FALSE)
criterion
penalization criterion to optimize c(“AIC”, “BIC”, {“BICc”}, gamma)
linearization
TRUE/{FALSE} whether the computation of the likelihood is based on a linearization of the model (default=FALSE)
ll
{TRUE}/FALSE compute the observe likelihood and the criterion to optimize at each iteration (default=TRUE)
test
{TRUE}/FALSE perform additional statistical tests for building the model (default=TRUE)
direction
method for covariate search c({“full”}, “both”, “backward”, “forward”), (default=“full” or “both”)
steps
maximum number of iteration for stepAIC (default=1000)
max.iter
maximum number of SAMBA iterations (default=20)
exp.iter
number of iterations during the exploratory phase of SAMBA (default=2)
seq.cov
TRUE/{FALSE} whether the covariate model is built before the correlation model (default=FALSE)
seq.corr
{TRUE}/FALSE whether the correlation model is built iteratively (default=TRUE)
seq.cov.iter
number of iterations before building the correlation model (only when seq.cov=F, default=0)
p.max
maximum p-value used for removing non significant relationships between covariates and individual parameters (default=0.1)
p.min
vector of 3 minimum p-values used for testing the components of a new model (default=c(0.075, 0.05, 0.1))
print
{TRUE}/FALSE display the results (default=TRUE)
nb.model
number of models to display at each iteration (default=1)
fix.param1
parameters with variability that cannot be removed (default=NULL)
fix.param0
parameters without variability that cannot be added (default=NULL)
remove
{TRUE}/FALSE try to remove random effects (default=TRUE)
add
{TRUE}/FALSE try to add random effects (default=TRUE)
delta
maximum difference in criteria for testing a new model (default=c(30,10,5))
omega.set
settings to define how a variance varies during iterations of SAEM
pop.set1
Monolix settings 1
pop.set2
Monolix settings 2


Example

Using version <= 4.0.2 of Rsmlx requires to load explicitly lixoftConnectors. This package is automatically loaded with Rsmlx 4.0.3.

library(lixoftConnectors)
initializeLixoftConnectors(software="monolix")
library(Rsmlx)

We select a Monolix project

project <- "projects/simulatedPK2.mlxtran"

Example using the defaults settings of buildmlx and buildVar:

buildAll.res1 <- buildAll(project)

Selected model:

loadProject(buildAll.res1$project)
getIndividualParameterModel()
## $name
## [1] "ka" "Cl" "V1" "Q"  "V2"
## 
## $distribution
##          ka          Cl          V1           Q          V2 
## "logNormal" "logNormal" "logNormal" "logNormal" "logNormal" 
## 
## $limits
## named list()
## 
## $formula
## [1] "log(ka) = log(ka_pop) + eta_ka\nlog(Cl) = log(Cl_pop) + beta_Cl_X03*X03 + eta_Cl\nlog(V1) = log(V1_pop) + beta_V1_X01*X01 + beta_V1_X02*X02 + eta_V1\nlog(Q) = log(Q_pop) + beta_Q_X01*X01\nlog(V2) = log(V2_pop)\nCorrelations\n\tID : {Cl, V1}\n"
## 
## $variability
## $variability$id
##    ka    Cl    V1     Q    V2 
##  TRUE  TRUE  TRUE FALSE FALSE 
## 
## 
## $covariateModel
## $covariateModel$ka
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
## FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## $covariateModel$Cl
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
## FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## $covariateModel$V1
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
##  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## $covariateModel$Q
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
##  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## $covariateModel$V2
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
## FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## 
## $correlationBlocks
## $correlationBlocks$id
## $correlationBlocks$id[[1]]
## [1] "Cl" "V1"

Example using several settings of buildmlx and buildVar:

buildAll.res2 <- buildAll(project, final.project="projects/buildAll2.mlxtran", 
                          paramToUse=c("Cl", "V1", "Q"), covToTest=c("X01", "X02", "X03", "X04"),
                          fix.param0="Q", fix.param1=c("ka", "Cl"))

Selected model:

loadProject(buildAll.res2$project)
getIndividualParameterModel()
## $name
## [1] "ka" "Cl" "V1" "Q"  "V2"
## 
## $distribution
##          ka          Cl          V1           Q          V2 
## "logNormal" "logNormal" "logNormal" "logNormal" "logNormal" 
## 
## $limits
## named list()
## 
## $formula
## [1] "log(ka) = log(ka_pop) + eta_ka\nlog(Cl) = log(Cl_pop) + beta_Cl_X03*X03 + eta_Cl\nlog(V1) = log(V1_pop) + beta_V1_X01*X01 + beta_V1_X02*X02 + eta_V1\nlog(Q) = log(Q_pop) + beta_Q_X01*X01\nlog(V2) = log(V2_pop)\nCorrelations\n\tID : {Cl, V1}\n"
## 
## $variability
## $variability$id
##    ka    Cl    V1     Q    V2 
##  TRUE  TRUE  TRUE FALSE FALSE 
## 
## 
## $covariateModel
## $covariateModel$ka
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
## FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## $covariateModel$Cl
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
## FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## $covariateModel$V1
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
##  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## $covariateModel$Q
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
##  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## $covariateModel$V2
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
## FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## 
## $correlationBlocks
## $correlationBlocks$id
## $correlationBlocks$id[[1]]
## [1] "Cl" "V1"

Following what is done with buildmlxand buildVar, prior information about the statistical model can be introduced either by defining prior probabilities or introducing a weighting for the penalty term.

In this example, relationships between covariates and parameters are strongly penalized (weight=5) while correlations are lightly penalized (weight=0.1).

Different weights are used for the variances: variability of Q is privileged while that of V1 is strongly penalized.

buildAll.res3 <- buildAll(project, weight=list(covariate=5, correlation=0.3, variance=c(Q=0.05, V1=20)))
print(buildAll.res3$variability.model)
## NULL
loadProject(buildAll.res3$project)
getIndividualParameterModel()
## $name
## [1] "ka" "Cl" "V1" "Q"  "V2"
## 
## $distribution
##          ka          Cl          V1           Q          V2 
## "logNormal" "logNormal" "logNormal" "logNormal" "logNormal" 
## 
## $limits
## named list()
## 
## $formula
## [1] "log(ka) = log(ka_pop) + eta_ka\nlog(Cl) = log(Cl_pop) + beta_Cl_X03*X03 + eta_Cl\nlog(V1) = log(V1_pop) + beta_V1_X01*X01 + beta_V1_X02*X02 + eta_V1\nlog(Q) = log(Q_pop) + beta_Q_X01*X01\nlog(V2) = log(V2_pop)\nCorrelations\n\tID : {Cl, V1}\n"
## 
## $variability
## $variability$id
##    ka    Cl    V1     Q    V2 
##  TRUE  TRUE  TRUE FALSE FALSE 
## 
## 
## $covariateModel
## $covariateModel$ka
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
## FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## $covariateModel$Cl
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
## FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## $covariateModel$V1
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
##  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## $covariateModel$Q
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
##  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## $covariateModel$V2
##   X01   X02   X03   X04   X05   X06   X07   X08   X09   X10 
## FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
## 
## 
## $correlationBlocks
## $correlationBlocks$id
## $correlationBlocks$id[[1]]
## [1] "Cl" "V1"