diff --git a/_pkgdown.yml b/_pkgdown.yml index 6e042cce..69178b35 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,24 +1,25 @@ templates: params: #bootswatch: cerulean - bootswatch: paper + #bootswatch: paper + bootswatch: Flatly -reference: - - title: Input information to PopED - contents: - - create.poped.database +#reference: +# - title: Input information to PopED +# contents: +# - create.poped.database -navbar: - title: "PopED" - type: inverse - left: - - text: "Intro" - href: articles/intro-poped.html - - text: "Reference" - href: reference/index.html - right: - - icon: fa-github - href: https://github.com/andrewhooker/PopED +#navbar: +# title: "PopED" +# type: inverse +# left: +# - text: "Intro" +# href: articles/intro-poped.html +# - text: "Reference" +# href: reference/index.html +# right: +# - icon: fa-github +# href: https://github.com/andrewhooker/PopED authors: Andrew C. Hooker: diff --git a/docs/LICENSE.html b/docs/LICENSE.html index ee999b67..1b2d8736 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -48,7 +48,7 @@
examples.Rmd
In this vignette, we try to highlight further PopED features that may be useful. Only code related to
+specific “new” features is described here in this vignette. These features (and more) are presented as r-scripts in the “examples” folder in the PopED installation directory located at:
system.file("examples", package="PopED")
You can view a list of the example files using the commands:
+ex_dir <- system.file("examples", package="PopED")
+list.files(ex_dir)
You can then open one of the examples (for example, ex.1.a.PK.1.comp.oral.md.intro.R
) using the following code
file_name <- "ex.1.a.PK.1.comp.oral.md.intro.R"
+ex_file <- system.file("examples",file_name,package="PopED")
+file.copy(ex_file,tempdir(),overwrite = T)
+file.edit(file.path(tempdir(),file_name))
The table below provides a check list of features for each of the available examples.
+Features | +Ex1 | +Ex2 | +Ex3 | +Ex4 | +Ex5 | +Ex6 | +Ex7 | +Ex8 | +Ex9 | +Ex10 | +Ex11 | +Ex12 | +Ex13 | +Ex14 | +Ex15 | +
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Analytical model | +X | +X | +X | +X | +X | +X | +X | +- | +- | +- | +X | +X | +X | +X | +X | +
ODE model and doses | +X | +X | +- | +- | +- | +X | +- | +X | +X | +X | +- | +- | +- | +- | +- | +
Irregular dosing | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +
Full cov matrix W | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +X | +
Inter-occ variability | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +X | +- | +
Discrete covariates | +- | +- | +- | +- | +- | +- | +X | +- | +- | +- | +X | +- | +- | +- | +- | +
Continuous covariates | +X | +X | +X | +X | +- | +X | +X | +X | +X | +X | +X | +X | +X | +X | +X | +
Multiple arms | +X | +- | +X | +X | +- | +- | +X | +X | +- | +- | +X | +X | +- | +X | +- | +
Multi response models | +- | +- | +X | +X | +- | +- | +- | +X | +- | +X | +- | +- | +- | +- | +- | +
Designs differ across responses |
+- | +- | +- | +X | +- | +- | +- | +X | +- | +- | +- | +- | +- | +- | +- | +
Calculate precision of derived parameters |
+- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +
Power calculation | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +X | +- | +- | +- | +- | +
Include previous FIM | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +X | +- | +- | +- | +- | +
Shrinkage/Bayesian FIM | +X | +X | +X | +X | +- | +- | +X | +- | +- | +X | +- | +- | +X | +- | +- | +
Discrete optimization | +X | +X | +X | +- | +- | +X | +- | +X | +- | +- | +- | +- | +- | +X | +- | +
Optimization of more-group designs (same response) |
+X | +- | +X | +X | +- | +- | +X | +X | +- | +- | +- | +- | +- | +X | +- | +
Different optimal sampling times between groups |
+- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +
Optimization with constraining sampling times |
+X | +- | +X | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +X | +- | +
Optimization of subjects per group |
+- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +- | +
The full code for this example is available in ex.4.PKPD.1.comp.emax.R
.
Here we define a PKPD mode using analytical equations. The PK is a one compartment model with intravenus bolus administration and linear elimination. The PD is an ordinary Emax model driven by the PK concentrations. The expected output of each measurement (PK or PD) is given in the vector model_switch
(see below for details).
library(PopED)
+f_pkpdmodel <- function(model_switch,xt,parameters,poped.db){
+ with(as.list(parameters),{
+ y=xt
+ MS <- model_switch
+
+ # PK model
+ CONC = DOSE/V*exp(-CL/V*xt)
+
+ # PD model
+ EFF = E0 + CONC*EMAX/(EC50 + CONC)
+
+ y[MS==1] = CONC[MS==1]
+ y[MS==2] = EFF[MS==2]
+
+ return(list( y= y,poped.db=poped.db))
+ })
+}
The error model also has to accommodate both response models.
+## -- Residual Error function
+## -- Proportional PK + additive PD
+f_Err <- function(model_switch,xt,parameters,epsi,poped.db){
+ returnArgs <- do.call(poped.db$model$ff_pointer,list(model_switch,xt,parameters,poped.db))
+ y <- returnArgs[[1]]
+ poped.db <- returnArgs[[2]]
+
+ MS <- model_switch
+
+ prop.err <- y*(1+epsi[,1])
+ add.err <- y+epsi[,2]
+
+ y[MS==1] = prop.err[MS==1]
+ y[MS==2] = add.err[MS==2]
+
+ return(list( y= y,poped.db =poped.db ))
+}
Some of the parameters are assumed to have log-normal distributions in the population.
+We specify in the poped.db
object the vector model_switch
in order to assign the sampling times written in the vector xt
to the PK (=1) or PD (=2) model.
poped.db <- create.poped.database(ff_fun=f_pkpdmodel,
+ fError_fun=f_Err,
+ fg_fun=f_etaToParam,
+ sigma=diag(c(0.15,0.015)),
+ bpop=c(CL=0.5,V=0.2,E0=1,EMAX=1,EC50=1),
+ d=c(CL=0.09,V=0.09,E0=0.04,EC50=0.09),
+ groupsize=20,
+ m=3,
+ xt=c( 0.33,0.66,0.9,5,0.1,1,2,5),
+ minxt=0,
+ maxxt=5,
+ bUseGrouped_xt=1,
+ model_switch=c(1,1,1,1,2,2,2,2),
+ a=list(c(DOSE=0),c(DOSE=1),c(DOSE=2)),
+ maxa=c(DOSE=10),
+ mina=c(DOSE=0))
The model predictions below show typical PK and PD profiles for three dose groups. The initial design, as shown in the poped.db
object, consists of 3 arms with doses of 0, 1, and 2 mg; PK sampling times are 0.33, 0.66, 0.9, and 5 hours/days; PD sampling times are 0.1, 1, 2, and 5 hours/days. With model.names=c("PK","PD")
one can name the outputs in the graph.
plot_model_prediction(poped.db,IPRED=TRUE,DV=TRUE,facet_scales="free",
+ separate.groups=TRUE,
+ model.names=c("PK","PD"))
The full code for this example is available in ex.9.PK.2.comp.oral.md.ode.compiled.R
.
In this example, the deSolve
library needs to be installed for computing solutions to a system of differential equations. For faster solutions one can use pre-compiled code using the Rcpp
library.
library(Rcpp)
+library(deSolve)
Here we define the two compartment model in R using deSolve notation
+PK.2.comp.oral.ode <- function(Time, State, Pars){
+ with(as.list(c(State, Pars)), {
+ dA1 <- -KA*A1
+ dA2 <- KA*A1 + A3* Q/V2 -A2*(CL/V1+Q/V1)
+ dA3 <- A2* Q/V1-A3* Q/V2
+ return(list(c(dA1, dA2, dA3)))
+ })
+}
Now we define the initial conditions of the ODE system A_ini
with a named vector, in this case all compartments are initialized to zero c(A1=0,A2=0,A3=0)
. The dosing input is defined as a data.frame eventdat
referring to the named compartment var = c("A1")
, the specified dose_times
and value=c(DOSE)
dose amounts. Note that the covariates DOSE
and the regimen TAU
can differ by arm and be optimized (as shown in ex.1.a.PK.1.comp.oral.md.intro.R
). For more information see the help pages for ?deSolve::ode
and ?deSolve::events
.
ff.PK.2.comp.oral.md.ode <- function(model_switch, xt, parameters, poped.db){
+ with(as.list(parameters),{
+ A_ini <- c(A1=0, A2=0, A3=0)
+ times_xt <- drop(xt)
+ dose_times = seq(from=0,to=max(times_xt),by=TAU)
+ eventdat <- data.frame(var = c("A1"),
+ time = dose_times,
+ value = c(DOSE), method = c("add"))
+ times <- sort(c(times_xt,dose_times))
+
+ # Here "PK.2.comp.oral.ode" is equivalent to the pre-compiled version "two_comp_oral_ode_Rcpp".
+ out <- ode(A_ini, times, PK.2.comp.oral.ode, parameters,
+ events = list(data = eventdat))#atol=1e-13,rtol=1e-13)
+ y = out[, "A2"]/(V1/Favail)
+ y=y[match(times_xt,out[,"time"])]
+ y=cbind(y)
+ return(list(y=y,poped.db=poped.db))
+ })
+}
The parameter definition function should match the parameters used in the above two functions.
+We now create a PopED database. The ff_fun
should now point to the function providing the solution of the ODE.
discrete_a <- cell(2,1)
+
+poped.db <- create.poped.database(ff_fun="ff.PK.2.comp.oral.md.ode",
+ fError_fun="feps.add.prop",
+ fg_fun="fg",
+ groupsize=20,
+ m=1, #number of groups
+ sigma=c(prop=0.1^2,add=0.05^2),
+ bpop=c(CL=10,V1=100,KA=1,Q= 3.0, V2= 40.0, Favail=1),
+ d=c(CL=0.15^2,KA=0.25^2),
+ notfixed_bpop=c(1,1,1,1,1,0),
+ xt=c( 48,50,55,65,70,85,90,120),
+ minxt=0,
+ maxxt=144,
+ discrete_xt = list(0:144),
+ a=c(DOSE=100,TAU=24),
+ maxa=c(DOSE=1000,TAU=24),
+ mina=c(DOSE=0,TAU=8),
+ discrete_a = list(DOSE=seq(0,1000,by=100),TAU=8:24))
We could also define the system using Rcpp, which will produce compiled code that should run faster (further examples in ex.2.c.warfarin.ODE.compiled.R
). First we redefine the ODE system using Rcpp.
cppFunction('List two_comp_oral_ode_Rcpp(double Time, NumericVector A, NumericVector Pars) {
+ int n = A.size();
+ NumericVector dA(n);
+
+ double CL = Pars[0];
+ double V1 = Pars[1];
+ double KA = Pars[2];
+ double Q = Pars[3];
+ double V2 = Pars[4];
+
+ dA[0] = -KA*A[0];
+ dA[1] = KA*A[0] - (CL/V1)*A[1] - Q/V1*A[1] + Q/V2*A[2];
+ dA[2] = Q/V1*A[1] - Q/V2*A[2];
+ return List::create(dA);
+ }')
Next we solve this system of ODEs using deSolve.
+Finally we create a poped database to use these functions by updating the previously created database.
+poped.db.Rcpp <- create.poped.database(poped.db,
+ ff_fun="ff.PK.2.comp.oral.md.ode.Rcpp")
We can compare the time for design evaluation with these two methods of describing the same model.
+tic(); eval <- evaluate_design(poped.db); toc()
+#> Elapsed time: 3.088 seconds.
+tic(); eval <- evaluate_design(poped.db.Rcpp); toc()
+#> Elapsed time: 1.09 seconds.
The difference is noticeable and gets larger for more complex and lengthy ODE models.
+The full code for this example is available in ex.8.tmdd_qss_one_target_compiled.R
.
Compile code using Rcpp for the TMDD model is as follows.
+Define the parameters and the distributions of those parameters.
+In the function that defines the dosing and derives the ODE solution, the discrete covariate SC_FLAG
is used to give the dose either into A1
or A2
, the sub-cutaneous or the IV compartment.
tmdd_qss_one_target_model_compiled <- function(model_switch,xt,parameters,poped.db){
+ with(as.list(parameters),{
+ y=xt
+
+ #The initialization vector for the compartment
+ A_ini <- c(A1=DOSE*SC_FLAG,
+ A2=DOSE*(1-SC_FLAG),
+ A3=0,
+ A4=R0)
+
+ #Set up time points for the ODE
+ times_xt <- drop(xt)
+ times <- sort(times_xt)
+ times <- c(0,times) ## add extra time for start of integration
+
+ # solve the ODE
+ out <- ode(A_ini, times, tmdd_qss_one_target_model_ode, parameters)#,atol=1e-13,rtol=1e-13)
+
+
+ # extract the time points of the observations
+ out = out[match(times_xt,out[,"time"]),]
+
+ # Match ODE output to measurements
+ RTOT = out[,"A4"]
+ CTOT = out[,"A2"]/V1
+ CFREE = 0.5*((CTOT-RTOT-KSSS)+sqrt((CTOT-RTOT-KSSS)^2+4*KSSS*CTOT))
+ COMPLEX=((RTOT*CFREE)/(KSSS+CFREE))
+ RFREE= RTOT-COMPLEX
+
+ y[model_switch==1]= RTOT[model_switch==1]
+ y[model_switch==2] =CFREE[model_switch==2]
+ #y[model_switch==3]=RFREE[model_switch==3]
+
+ return(list( y=y,poped.db=poped.db))
+ })
+}
Finally we define the residual unexplained variability model.
+Two different sub-studies are defined, with different sampling times per arm - in terms of total number of samples and the actual times1. Due to this difference in numbers and the relatively complicated study design we define the sample times (xt
) what each sample time will meansre (model_switch
) and which samples should be taken at the same study time (G_xt
) as matricies. Here three variables xt
, model_switch
, and G_xt
are matrices with each row representing one arm, and the number of columns is the maximum number of samples (for all endpoints) in any of the arms (i.e., max(ni)
). To be clear about which elements in the matriicies should be considered we specify the number of samples per arm by defining the vector ni
in the create.poped.database()
function.
xt <- zeros(6,30)
+study_1_xt <- matrix(rep(c(0.0417,0.25,0.5,1,3,7,14,21,28,35,42,49,56),8),nrow=4,byrow=TRUE)
+study_2_xt <- matrix(rep(c(0.0417,1,1,7,14,21,28,56,63,70,77,84,91,98,105),4),nrow=2,byrow=TRUE)
+xt[1:4,1:26] <- study_1_xt
+xt[5:6,] <- study_2_xt
+
+model_switch <- zeros(6,30)
+model_switch[1:4,1:13] <- 1
+model_switch[1:4,14:26] <- 2
+model_switch[5:6,1:15] <- 1
+model_switch[5:6,16:30] <- 2
+
+G_xt <- zeros(6,30)
+study_1_G_xt <- matrix(rep(c(1:13),8),nrow=4,byrow=TRUE)
+study_2_G_xt <- matrix(rep(c(14:28),4),nrow=2,byrow=TRUE)
+G_xt[1:4,1:26] <- study_1_G_xt
+G_xt[5:6,] <- study_2_G_xt
These can then be plugged into the normal poped.db
setup.
poped.db.2 <- create.poped.database(ff_fun=tmdd_qss_one_target_model_compiled,
+ fError_fun=tmdd_qss_one_target_model_ruv,
+ fg_fun=sfg,
+ groupsize=rbind(6,6,6,6,100,100),
+ m=6, #number of groups
+ sigma=c(0.04,0.0225),
+ bpop=c(CL=0.3,V1=3,Q=0.2,V2=3,FAVAIL=0.7,KA=0.5,VMAX=0,
+ KMSS=0,R0=0.1,KSSS=0.015,KDEG=10,KINT=0.05),
+ d=c(CL=0.09,V1=0.09,Q=0.04,V2=0.04,FAVAIL=0.04,
+ KA=0.16,VMAX=0,KMSS=0,R0=0.09,KSSS=0.09,KDEG=0.04,
+ KINT=0.04),
+ notfixed_bpop=c( 1,1,1,1,1,1,0,0,1,1,1,1),
+ notfixed_d=c( 1,1,1,1,1,1,0,0,1,1,1,1),
+ xt=xt,
+ model_switch=model_switch,
+ ni=rbind(26,26,26,26,30,30),
+ bUseGrouped_xt=1,
+ G_xt=G_xt,
+ a=list(c(DOSE=100, SC_FLAG=0),
+ c(DOSE=300, SC_FLAG=0),
+ c(DOSE=600, SC_FLAG=0),
+ c(DOSE=1000, SC_FLAG=1),
+ c(DOSE=600, SC_FLAG=0),
+ c(DOSE=1000, SC_FLAG=1)),
+ discrete_a = list(DOSE=seq(100,1000,by=100),
+ SC_FLAG=c(0,1)))
plot_model_prediction(poped.db.2,facet_scales="free")
eval_2 <- evaluate_design(poped.db.2);
+round(eval_2$rse)
+#> bpop[1] bpop[2] bpop[3] bpop[4] bpop[5] bpop[6]
+#> 2 2 2 3 3 5
+#> bpop[9] bpop[10] bpop[11] bpop[12] D[1,1] D[2,2]
+#> 3 3 3 2 11 12
+#> D[3,3] D[4,4] D[5,5] D[6,6] D[9,9] D[10,10]
+#> 22 20 24 19 12 13
+#> D[11,11] D[12,12] SIGMA[1,1] SIGMA[2,2]
+#> 20 18 3 3
The R code for this example is available in ex.12.covariate_distributions.R
.
Let’s assume that we have a model with a covariate included in the model description. Here we define a one-compartment PK model that uses allometric scaling with a weight effect on both clearance and volume of distribution.
+mod_1 <- function(model_switch,xt,parameters,poped.db){
+ with(as.list(parameters),{
+ y=xt
+
+ CL=CL*(WT/70)^(WT_CL)
+ V=V*(WT/70)^(WT_V)
+ DOSE=1000*(WT/70)
+ y = DOSE/V*exp(-CL/V*xt)
+
+ return(list( y= y,poped.db=poped.db))
+ })
+}
+
+par_1 <- function(x,a,bpop,b,bocc){
+ parameters=c( CL=bpop[1]*exp(b[1]),
+ V=bpop[2]*exp(b[2]),
+ WT_CL=bpop[3],
+ WT_V=bpop[4],
+ WT=a[1])
+ return( parameters )
+}
Now we define a design. In this case one group of individuals, where we define the individuals’ typical weight as 70 kg (a=c(WT=70)
).
poped_db <-
+ create.poped.database(
+ ff_fun=mod_1,
+ fg_fun=par_1,
+ fError_fun=feps.add.prop,
+ groupsize=50,
+ m=1,
+ sigma=c(0.015,0.0015),
+ notfixed_sigma = c(1,0),
+ bpop=c(CL=3.8,V=20,WT_CL=0.75,WT_V=1),
+ d=c(CL=0.05,V=0.05),
+ xt=c( 1,2,4,6,8,24),
+ minxt=0,
+ maxxt=24,
+ bUseGrouped_xt=1,
+ a=c(WT=70)
+ )
We can create a plot of the model prediction for the typical individual
+plot_model_prediction(poped_db)
And evaluate the initial design
+evaluate_design(poped_db)
+#> Problems inverting the matrix. Results could be misleading.
+#> $ofv
+#> [1] -Inf
+#>
+#> $fim
+#> [,1] [,2] [,3] [,4] [,5] [,6] [,7]
+#> [1,] 65.8889583 -0.7145374 0 0 0.00000 0.00000 0.000
+#> [2,] -0.7145374 2.2798156 0 0 0.00000 0.00000 0.000
+#> [3,] 0.0000000 0.0000000 0 0 0.00000 0.00000 0.000
+#> [4,] 0.0000000 0.0000000 0 0 0.00000 0.00000 0.000
+#> [5,] 0.0000000 0.0000000 0 0 9052.31524 29.49016 1424.255
+#> [6,] 0.0000000 0.0000000 0 0 29.49016 8316.09464 2483.900
+#> [7,] 0.0000000 0.0000000 0 0 1424.25450 2483.90024 440009.144
+#>
+#> $rse
+#> bpop[1] bpop[2] bpop[3] bpop[4] D[1,1] D[2,2]
+#> 3.247502 3.317107 0.000000 0.000000 21.026264 21.950179
+#> SIGMA[1,1]
+#> 10.061292
It is obvious that the covariate parameters can not be estimated according to this design calculation (RSE of bpop[3]=0 and bpop[4]=0). Why is that? Well, the calculation being done is assuming that every individual in the group has the same covariate (to speed up the calculation). This is clearly a poor prediction in this case!
+We can improve the computation by assuming a distribution of the covariate (WT) in the individuals in the study. We set groupsize=1
, the number of groups to be 50 (m=50
) and assume that WT is sampled from a normal distribution with mean=70 and sd=10 (a=as.list(rnorm(50, mean = 70, sd = 10)
).
poped_db_2 <-
+ create.poped.database(
+ ff_fun=mod_1,
+ fg_fun=par_1,
+ fError_fun=feps.add.prop,
+ groupsize=1,
+ m=50,
+ sigma=c(0.015,0.0015),
+ notfixed_sigma = c(1,0),
+ bpop=c(CL=3.8,V=20,WT_CL=0.75,WT_V=1),
+ d=c(CL=0.05,V=0.05),
+ xt=c(1,2,4,6,8,24),
+ minxt=0,
+ maxxt=24,
+ bUseGrouped_xt=1,
+ a=as.list(rnorm(50, mean = 70, sd = 10))
+ )
ev <- evaluate_design(poped_db_2)
+round(ev$ofv,1)
+#> [1] 41.3
+round(ev$rse)
+#> bpop[1] bpop[2] bpop[3] bpop[4] D[1,1] D[2,2]
+#> 3 3 36 28 21 22
+#> SIGMA[1,1]
+#> 10
Here we see that, given this distribution of weights, the covariate effect parameters (bpop[3] and bpop[4]) would be well estimated.
+However, we are only looking at one sample of 50 individuals. Maybe a better approach is to look at the distribution of RSEs over a number of experiments given the expected weight distribution.
+nsim <- 30
+rse_list <- c()
+for(i in 1:nsim){
+ poped_db_tmp <-
+ create.poped.database(
+ ff_fun=mod_1,
+ fg_fun=par_1,
+ fError_fun=feps.add.prop,
+ groupsize=1,
+ m=50,
+ sigma=c(0.015,0.0015),
+ notfixed_sigma = c(1,0),
+ bpop=c(CL=3.8,V=20,WT_CL=0.75,WT_V=1),
+ d=c(CL=0.05,V=0.05),
+ xt=c( 1,2,4,6,8,24),
+ minxt=0,
+ maxxt=24,
+ bUseGrouped_xt=1,
+ a=as.list(rnorm(50,mean = 70,sd=10)))
+ rse_tmp <- evaluate_design(poped_db_tmp)$rse
+ rse_list <- rbind(rse_list,rse_tmp)
+}
+apply(rse_list,2,quantile)
+#> bpop[1] bpop[2] bpop[3] bpop[4] D[1,1] D[2,2] SIGMA[1,1]
+#> 0% 3.247591 3.317375 23.04270 17.65827 21.02265 21.94696 10.05732
+#> 25% 3.254612 3.324680 28.10215 21.53528 21.02636 21.95360 10.06443
+#> 50% 3.268664 3.338912 30.73872 23.55698 21.02752 21.95586 10.06695
+#> 75% 3.308159 3.379521 33.10813 25.36973 21.02869 21.95784 10.06902
+#> 100% 3.468198 3.542847 39.61174 30.35275 21.03209 21.96797 10.07902
Note, that the variance of the RSE of the covariate effect is in this case strongly correlated with the variance of the weight distribution (not shown).
+See ex.11.PK.prior.R
. This has the covariate isPediatric
to distinguish between adults and pediatrics. Alternatively, DOSE
and TAU
in the first example can be considered as discrete covariates but are not per se estimated but rather optimized.
The full code for this example is available in ex.14.PK.IOV.R
.
The IOV is introduced with bocc[x,y]
in the parameter definition function as a matrix with the first argument x
indicating the index for the IOV variances defined in docc
below, and the second argument y
denoting the occasion. This is used in the example to derive to different clearance values, i.e., CL_OCC_1
and CL_OCC_2
(think of some drug-drug interaction).
sfg <- function(x,a,bpop,b,bocc){
+ parameters=c( CL_OCC_1=bpop[1]*exp(b[1]+bocc[1,1]),
+ CL_OCC_2=bpop[1]*exp(b[1]+bocc[1,2]),
+ V=bpop[2]*exp(b[2]),
+ KA=bpop[3]*exp(b[3]),
+ DOSE=a[1],
+ TAU=a[2])
+ return( parameters )
+}
These parameters can now be used in the model function to define the change in parameters between the occacions (here with the 7th dose in a one-compartment model with first order absorption).
+cppFunction(
+ 'List one_comp_oral_ode(double Time, NumericVector A, NumericVector Pars) {
+ int n = A.size();
+ NumericVector dA(n);
+
+ double CL_OCC_1 = Pars[0];
+ double CL_OCC_2 = Pars[1];
+ double V = Pars[2];
+ double KA = Pars[3];
+ double TAU = Pars[4];
+ double N,CL;
+
+ N = floor(Time/TAU)+1;
+ CL = CL_OCC_1;
+ if(N>6) CL = CL_OCC_2;
+
+ dA[0] = -KA*A[0];
+ dA[1] = KA*A[0] - (CL/V)*A[1];
+ return List::create(dA);
+ }'
+)
+
+ff.ode.rcpp <- function(model_switch, xt, parameters, poped.db){
+ with(as.list(parameters),{
+ A_ini <- c(A1=0, A2=0)
+ times_xt <- drop(xt) #xt[,,drop=T]
+ dose_times = seq(from=0,to=max(times_xt),by=TAU)
+ eventdat <- data.frame(var = c("A1"),
+ time = dose_times,
+ value = c(DOSE), method = c("add"))
+ times <- sort(c(times_xt,dose_times))
+ out <- ode(A_ini, times, one_comp_oral_ode, c(CL_OCC_1,CL_OCC_2,V,KA,TAU),
+ events = list(data = eventdat))#atol=1e-13,rtol=1e-13)
+ y = out[, "A2"]/(V)
+ y=y[match(times_xt,out[,"time"])]
+ y=cbind(y)
+ return(list(y=y,poped.db=poped.db))
+ })
+}
The within-subject variability variances (docc
) are defined in the poped database as a 3-column matrix with one row per IOV-parameter, and the middle column giving the variance values.
poped.db <-
+ create.poped.database(
+ ff_fun=ff.ode.rcpp,
+ fError_fun=feps.add.prop,
+ fg_fun=sfg,
+ bpop=c(CL=3.75,V=72.8,KA=0.25),
+ d=c(CL=0.25^2,V=0.09,KA=0.09),
+ sigma=c(0.04,5e-6),
+ notfixed_sigma=c(0,0),
+ docc = matrix(c(0,0.09,0),nrow = 1),
+ m=2,
+ groupsize=20,
+ xt=c( 1,2,8,240,245),
+ minxt=c(0,0,0,240,240),
+ maxxt=c(10,10,10,248,248),
+ bUseGrouped_xt=1,
+ a=list(c(DOSE=20,TAU=24),c(DOSE=40, TAU=24)),
+ maxa=c(DOSE=200,TAU=24),
+ mina=c(DOSE=0,TAU=24)
+ )
plot_model_prediction(poped.db, model_num_points = 300)
We can visualize the IOV by looking at an example individual. We see the PK profile changes at the 7th dose (red line) due to the change in clearance.
+library(ggplot2)
+set.seed(123)
+plot_model_prediction(poped.db, PRED=F,IPRED=F,
+ separate.groups=T, model_num_points = 300,
+ groupsize_sim = 1,
+ IPRED.lines = T, alpha.IPRED.lines=0.6,
+ sample.times = F
+ ) + geom_vline(xintercept = 24*6,color="red")
ev <- evaluate_design(poped.db)
+round(ev$rse)
+#> bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
+#> 6 9 11 106 43 63
+#> D.occ[1,1]
+#> 79
The full code for this example is available in ex.15.full.covariance.matrix.R
.
The covd
object is used for defining the covariances of the IIV variances (off-diagonal elements of the full variance-covariance matrix).
poped.db_with <-
+ create.poped.database(
+ ff_file="ff",
+ fg_file="sfg",
+ fError_file="feps",
+ bpop=c(CL=0.15, V=8, KA=1.0, Favail=1),
+ notfixed_bpop=c(1,1,1,0),
+ d=c(CL=0.07, V=0.02, KA=0.6),
+ covd = c(.03,.1,.09),
+ sigma=0.01,
+ groupsize=32,
+ xt=c( 0.5,1,2,6,24,36,72,120),
+ minxt=0,
+ maxxt=120,
+ a=70
+ )
What do the covariances mean?
+(IIV <- poped.db_with$parameters$param.pt.val$d)
+#> [,1] [,2] [,3]
+#> [1,] 0.07 0.03 0.10
+#> [2,] 0.03 0.02 0.09
+#> [3,] 0.10 0.09 0.60
+cov2cor(IIV)
+#> [,1] [,2] [,3]
+#> [1,] 1.0000000 0.8017837 0.4879500
+#> [2,] 0.8017837 1.0000000 0.8215838
+#> [3,] 0.4879500 0.8215838 1.0000000
They indicate a correlation of the inter-individual variabilities, here of ca. 0.8 between clearance and volume, as well as between volume and absorption rate.
+library(ggplot2)
+p1 <- plot_model_prediction(poped.db,IPRED=TRUE)+ylim(0,12)
+p2 <- plot_model_prediction(poped.db_with,IPRED=TRUE) +ylim(0,12)
+gridExtra::grid.arrange(p1, p2, nrow = 1)
ev1 <- evaluate_design(poped.db)
+ev2 <- evaluate_design(poped.db_with)
round(ev1$ofv,1)
+#> [1] 52.4
+round(ev1$rse,1)
+#> bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
+#> 4.7 2.8 13.9 25.6 30.3 25.8
+#> SIGMA[1,1]
+#> 11.2
+
+round(ev2$ofv,1)
+#> [1] 85.9
+round(ev2$rse,1)
+#> bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
+#> 4.7 2.8 13.9 25.7 30.5 25.9
+#> D_cov[1] D_cov[2] D_cov[3] SIGMA[1,1]
+#> 30.8 41.5 30.7 11.2
Note, that the precision of all other parameters is barely affected by including the full covariance matrix. This is likely to be different in practice with much more ill-conditioned numerical problems.
+ev1 <- evaluate_design(poped.db, fim.calc.type=0)
+ev2 <-evaluate_design(poped.db_with, fim.calc.type=0)
+
+round(ev1$ofv,1)
+#> [1] 55.5
+round(ev1$rse,1)
+#> bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
+#> 3.6 2.6 4.8 26.3 30.9 26.5
+#> SIGMA[1,1]
+#> 12.4
+
+round(ev2$ofv,1)
+#> [1] 88.2
+round(ev2$rse,1)
+#> bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
+#> 3.8 1.8 4.8 26.5 30.9 26.1
+#> D_cov[1] D_cov[2] D_cov[3] SIGMA[1,1]
+#> 31.0 41.7 31.1 12.3
In this example you will learn how to incorporate prior knowledge to your current study. First the FIM obtained from an experiment in adulta is stored. Then this FIM is added to the current experiment in children. The full code for this example is available in ex.11.PK.prior.R
.
We define here the parameters for one compartment first order absorption model. Of note, isPediatric = x[1]
is the flag to switch between adults and pediatrics, and bpop[5]=pedCL
is the factor to multiply the adult clearance bpop[3]
to obtain the pediatric one.
## -- parameter definition function
+## -- names match parameters in function ff
+## -- note, covariate on clearance for pediatrics (using isPediatric x[1])
+sfg <- function(x,a,bpop,b,bocc){
+ parameters=c(
+ V=bpop[1]*exp(b[1]),
+ KA=bpop[2]*exp(b[2]),
+ CL=bpop[3]*exp(b[3])*bpop[5]^x[1], # add covariate for pediatrics
+ Favail=bpop[4],
+ isPediatric = x[1],
+ DOSE=a[1],
+ TAU=a[2])
+ return( parameters )
+}
Define design and design space for adults (Two arms, 5 time points, isPediatric = 0
). As we want to pool the results, we also have to provide here the pedCL
parameter.
poped.db <-
+ create.poped.database(
+ ff_fun="ff",
+ fg_fun="sfg",
+ fError_fun="feps",
+ bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9,pedCL=0.8),
+ notfixed_bpop=c(1,1,1,0,1),
+ d=c(V=0.09,KA=0.09,CL=0.25^2),
+ sigma=c(0.04,5e-6),
+ notfixed_sigma=c(0,0),
+ m=2,
+ groupsize=20,
+ xt=c( 1,8,10,240,245),
+ bUseGrouped_xt=1,
+ a=list(c(DOSE=20,TAU=24),c(DOSE=40, TAU=24)),
+ x=list(isPediatric = 0)
+ )
Create plot of model without variability
+plot_model_prediction(poped.db, model_num_points = 300)
To store the FIM from the adult design we evaluate the initial design
+(outAdult = evaluate_design(poped.db))
+#> Problems inverting the matrix. Results could be misleading.
+#> $ofv
+#> [1] -Inf
+#>
+#> $fim
+#> [,1] [,2] [,3] [,4] [,5] [,6]
+#> [1,] 0.05854391 -6.815269 -0.01531146 0 0.0000000 0.00000000
+#> [2,] -6.81526942 2963.426688 -1.32113719 0 0.0000000 0.00000000
+#> [3,] -0.01531146 -1.321137 37.50597895 0 0.0000000 0.00000000
+#> [4,] 0.00000000 0.000000 0.00000000 0 0.0000000 0.00000000
+#> [5,] 0.00000000 0.000000 0.00000000 0 1203.3695137 192.31775149
+#> [6,] 0.00000000 0.000000 0.00000000 0 192.3177515 428.81459138
+#> [7,] 0.00000000 0.000000 0.00000000 0 0.2184104 0.01919009
+#> [,7]
+#> [1,] 0.000000e+00
+#> [2,] 0.000000e+00
+#> [3,] 0.000000e+00
+#> [4,] 0.000000e+00
+#> [5,] 2.184104e-01
+#> [6,] 1.919009e-02
+#> [7,] 3.477252e+03
+#>
+#> $rse
+#> bpop[1] bpop[2] bpop[3] bpop[5] D[1,1] D[2,2] D[3,3]
+#> 6.634931 8.587203 4.354792 0.000000 33.243601 55.689432 27.133255
It is obvious that we cannot estimate the pediatric covariate from adult data only; hence the warning message. You can also note the zeros in the 4th column and 4th row of the FIM indicating that pedCL
cannot be estimated from the adult data.
We can evaluate the adult design without warning, by setting the pedCL
parameter to be fixed (i.e., not estimated):
evaluate_design(create.poped.database(poped.db, notfixed_bpop=c(1,1,1,0,0)))
+#> $ofv
+#> [1] 29.70233
+#>
+#> $fim
+#> [,1] [,2] [,3] [,4] [,5]
+#> [1,] 0.05854391 -6.815269 -0.01531146 0.0000000 0.00000000
+#> [2,] -6.81526942 2963.426688 -1.32113719 0.0000000 0.00000000
+#> [3,] -0.01531146 -1.321137 37.50597895 0.0000000 0.00000000
+#> [4,] 0.00000000 0.000000 0.00000000 1203.3695137 192.31775149
+#> [5,] 0.00000000 0.000000 0.00000000 192.3177515 428.81459138
+#> [6,] 0.00000000 0.000000 0.00000000 0.2184104 0.01919009
+#> [,6]
+#> [1,] 0.000000e+00
+#> [2,] 0.000000e+00
+#> [3,] 0.000000e+00
+#> [4,] 2.184104e-01
+#> [5,] 1.919009e-02
+#> [6,] 3.477252e+03
+#>
+#> $rse
+#> bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
+#> 6.634931 8.587203 4.354792 33.243601 55.689432 27.133255
One obtains good estimates for all parameters for adults (<60% RSE for all).
+For pediatrics the covariate isPediatric = 1
. We define one arm, 4 time points only
poped.db.ped <-
+ create.poped.database(
+ ff_fun="ff",
+ fg_fun="sfg",
+ fError_fun="feps",
+ bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9,pedCL=0.8),
+ notfixed_bpop=c(1,1,1,0,1),
+ d=c(V=0.09,KA=0.09,CL=0.25^2),
+ sigma=c(0.04,5e-6),
+ notfixed_sigma=c(0,0),
+ m=1,
+ groupsize=6,
+ xt=c( 1,2,6,240),
+ bUseGrouped_xt=1,
+ a=list(c(DOSE=40,TAU=24)),
+ x=list(isPediatric = 1)
+ )
Create plot of the pediatric model without variability
+plot_model_prediction(poped.db.ped, model_num_points = 300)
Evaluate the design of the pediatrics study alone.
+evaluate_design(poped.db.ped)
+#> Problems inverting the matrix. Results could be misleading.
+#> $ofv
+#> [1] -Inf
+#>
+#> $fim
+#> [,1] [,2] [,3] [,4] [,5]
+#> [1,] 0.007766643 -1.395981 -0.01126202 -0.05279073 0.0000000
+#> [2,] -1.395980934 422.458209 -2.14666933 -10.06251250 0.0000000
+#> [3,] -0.011262023 -2.146669 5.09936874 23.90329099 0.0000000
+#> [4,] -0.052790734 -10.062512 23.90329099 112.04667652 0.0000000
+#> [5,] 0.000000000 0.000000 0.00000000 0.00000000 141.1922923
+#> [6,] 0.000000000 0.000000 0.00000000 0.00000000 53.7923483
+#> [7,] 0.000000000 0.000000 0.00000000 0.00000000 0.7877291
+#> [,6] [,7]
+#> [1,] 0.0000000 0.0000000
+#> [2,] 0.0000000 0.0000000
+#> [3,] 0.0000000 0.0000000
+#> [4,] 0.0000000 0.0000000
+#> [5,] 53.7923483 0.7877291
+#> [6,] 58.0960085 0.3375139
+#> [7,] 0.3375139 428.5254900
+#>
+#> $rse
+#> bpop[1] bpop[2] bpop[3] bpop[5] D[1,1] D[2,2]
+#> 24.7208804 30.8495322 0.5200823 11.4275854 116.2309452 181.1977846
+#> D[3,3]
+#> 77.2918849
Clearly the design has problems on its own.
+We can add the prior information from the adult study and evaluate that design (i.e., pooling adult and pediatric data).
+poped.db.all <- create.poped.database(
+ poped.db.ped,
+ prior_fim = outAdult$fim
+)
+
+(out.all <- evaluate_design(poped.db.all))
+#> $ofv
+#> [1] 34.96368
+#>
+#> $fim
+#> [,1] [,2] [,3] [,4] [,5]
+#> [1,] 0.007766643 -1.395981 -0.01126202 -0.05279073 0.0000000
+#> [2,] -1.395980934 422.458209 -2.14666933 -10.06251250 0.0000000
+#> [3,] -0.011262023 -2.146669 5.09936874 23.90329099 0.0000000
+#> [4,] -0.052790734 -10.062512 23.90329099 112.04667652 0.0000000
+#> [5,] 0.000000000 0.000000 0.00000000 0.00000000 141.1922923
+#> [6,] 0.000000000 0.000000 0.00000000 0.00000000 53.7923483
+#> [7,] 0.000000000 0.000000 0.00000000 0.00000000 0.7877291
+#> [,6] [,7]
+#> [1,] 0.0000000 0.0000000
+#> [2,] 0.0000000 0.0000000
+#> [3,] 0.0000000 0.0000000
+#> [4,] 0.0000000 0.0000000
+#> [5,] 53.7923483 0.7877291
+#> [6,] 58.0960085 0.3375139
+#> [7,] 0.3375139 428.5254900
+#>
+#> $rse
+#> bpop[1] bpop[2] bpop[3] bpop[5] D[1,1] D[2,2] D[3,3]
+#> 6.381388 8.222819 4.354761 12.591940 31.808871 52.858399 25.601551
Clearly, the pooled data leads to much higher precision in parameter estimates compared to either study separately.
+One can also obtain the power for estimating the pediatric difference in clearance (power in estimating bpop[5] as different from 1).
+evaluate_power(poped.db.all, bpop_idx=5, h0=1, out=out.all)
+#> $ofv
+#> [1] 34.96368
+#>
+#> $fim
+#> [,1] [,2] [,3] [,4] [,5]
+#> [1,] 0.007766643 -1.395981 -0.01126202 -0.05279073 0.0000000
+#> [2,] -1.395980934 422.458209 -2.14666933 -10.06251250 0.0000000
+#> [3,] -0.011262023 -2.146669 5.09936874 23.90329099 0.0000000
+#> [4,] -0.052790734 -10.062512 23.90329099 112.04667652 0.0000000
+#> [5,] 0.000000000 0.000000 0.00000000 0.00000000 141.1922923
+#> [6,] 0.000000000 0.000000 0.00000000 0.00000000 53.7923483
+#> [7,] 0.000000000 0.000000 0.00000000 0.00000000 0.7877291
+#> [,6] [,7]
+#> [1,] 0.0000000 0.0000000
+#> [2,] 0.0000000 0.0000000
+#> [3,] 0.0000000 0.0000000
+#> [4,] 0.0000000 0.0000000
+#> [5,] 53.7923483 0.7877291
+#> [6,] 58.0960085 0.3375139
+#> [7,] 0.3375139 428.5254900
+#>
+#> $rse
+#> bpop[1] bpop[2] bpop[3] bpop[5] D[1,1] D[2,2] D[3,3]
+#> 6.381388 8.222819 4.354761 12.591940 31.808871 52.858399 25.601551
+#>
+#> $power
+#> Value RSE power_pred power_want need_rse min_N
+#> bpop[5] 0.8 12.59194 51.01851 80 8.923519 14
We see that to clearly distinguish this parameter that one would need 14 children in the pediatric study (for 80% power at \(\alpha=0.05\)).
+In this example the aim is to evaluate a design incorporating uncertainty around parameter values in the model. The full code for this example is available in ex.2.d.warfarin.ED.R
. This illustration is one of the Warfarin examples from software comparison in: Nyberg et al.2.
Adding 10% uncertainty to all fixed effects (not Favail)
+bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1)
+bpop_vals_ed <-
+ cbind(ones(length(bpop_vals),1)*4, # log-normal distribution
+ bpop_vals,
+ ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value
+bpop_vals_ed["Favail",] <- c(0,1,0)
+bpop_vals_ed
+#> bpop_vals
+#> CL 4 0.15 0.000225
+#> V 4 8.00 0.640000
+#> KA 4 1.00 0.010000
+#> Favail 0 1.00 0.000000
Now bpop_vals_ed
is a matrix and not only a vector and we can define the ED_samp_size=20
either here…
poped.db <-
+ create.poped.database(
+ ff_fun=ff,
+ fg_fun=sfg,
+ fError_fun=feps.add.prop,
+ bpop=bpop_vals_ed,
+ notfixed_bpop=c(1,1,1,0),
+ d=c(CL=0.07, V=0.02, KA=0.6),
+ sigma=c(0.01,0.25),
+ groupsize=32,
+ xt=c( 0.5,1,2,6,24,36,72,120),
+ minxt=0,
+ maxxt=120,
+ a=70,
+ mina=0,
+ maxa=100,
+ ED_samp_size=20)
Or provide the ED_samp_size
as a parameter.
tic();evaluate_design(poped.db,d_switch=FALSE,ED_samp_size=20); toc()
+#> $ofv
+#> [1] 55.42646
+#>
+#> $fim
+#> [,1] [,2] [,3] [,4] [,5] [,6]
+#> [1,] 17739.71944 21.032092 10.292809 0.000000e+00 0.00000 0.00000000
+#> [2,] 21.03209 17.926273 -3.488356 0.000000e+00 0.00000 0.00000000
+#> [3,] 10.29281 -3.488356 51.374424 0.000000e+00 0.00000 0.00000000
+#> [4,] 0.00000 0.000000 0.000000 2.323781e+03 10.41360 0.03723339
+#> [5,] 0.00000 0.000000 0.000000 1.041360e+01 19067.60658 11.75942235
+#> [6,] 0.00000 0.000000 0.000000 3.723339e-02 11.75942 38.84190262
+#> [7,] 0.00000 0.000000 0.000000 7.304572e+02 9671.38879 65.11480364
+#> [8,] 0.00000 0.000000 0.000000 9.029499e+01 265.08323 2.93984016
+#> [,7] [,8]
+#> [1,] 0.0000 0.00000
+#> [2,] 0.0000 0.00000
+#> [3,] 0.0000 0.00000
+#> [4,] 730.4572 90.29499
+#> [5,] 9671.3888 265.08323
+#> [6,] 65.1148 2.93984
+#> [7,] 195403.8694 6605.44753
+#> [8,] 6605.4475 476.08847
+#>
+#> $rse
+#> bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
+#> 5.009423 2.974270 14.046395 29.761798 36.689605 26.751934
+#> SIGMA[1,1] SIGMA[2,2]
+#> 31.352041 25.261525
+#> Elapsed time: 0.141 seconds.
We can see that the result, based on MC sampling, is somewhat variable with so few samples.
+tic();evaluate_design(poped.db,d_switch=FALSE,ED_samp_size=20); toc()
+#> $ofv
+#> [1] 55.4183
+#>
+#> $fim
+#> [,1] [,2] [,3] [,4] [,5] [,6]
+#> [1,] 17642.69415 20.920494 10.274939 0.000000e+00 0.00000 0.00000000
+#> [2,] 20.92049 17.869670 -3.494226 0.000000e+00 0.00000 0.00000000
+#> [3,] 10.27494 -3.494226 51.418805 0.000000e+00 0.00000 0.00000000
+#> [4,] 0.00000 0.000000 0.000000 2.321305e+03 10.48148 0.03749921
+#> [5,] 0.00000 0.000000 0.000000 1.048148e+01 19042.26959 11.78485456
+#> [6,] 0.00000 0.000000 0.000000 3.749921e-02 11.78485 38.83521723
+#> [7,] 0.00000 0.000000 0.000000 7.294105e+02 9672.53494 64.85942554
+#> [8,] 0.00000 0.000000 0.000000 9.058182e+01 265.87291 2.95471273
+#> [,7] [,8]
+#> [1,] 0.00000 0.000000
+#> [2,] 0.00000 0.000000
+#> [3,] 0.00000 0.000000
+#> [4,] 729.41051 90.581818
+#> [5,] 9672.53494 265.872915
+#> [6,] 64.85943 2.954713
+#> [7,] 194460.15973 6610.964912
+#> [8,] 6610.96491 477.245341
+#>
+#> $rse
+#> bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
+#> 5.023172 2.979086 14.040869 29.778573 36.717642 26.754250
+#> SIGMA[1,1] SIGMA[2,2]
+#> 31.487815 25.277769
+#> Elapsed time: 0.123 seconds.
Ds-optimality is a criterion that can be used if one is interested in estimating a subset “s” of the model parameters as precisely as possible. The full code for this example is available in ex.2.e.warfarin.Ds.R
.
For Ds optimality we add the ds_index
option to the create.poped.database function to indicate whether a paramter is interesting (=1) or not (=0). Moreover, we need to set the ofv_calc_type
to 6 for computing the Ds optimality criterion, as it is set to 4 by default (for computing the log of the determiant of FIM). More details are available by running the command ?create.poped.database
.
poped.db <-
+ create.poped.database(
+ ff_fun=ff,
+ fg_fun=sfg,
+ fError_fun=feps.add.prop,
+ bpop=c(CL=0.15, V=8, KA=1.0, Favail=1),
+ notfixed_bpop=c(1,1,1,0),
+ d=c(CL=0.07, V=0.02, KA=0.6),
+ sigma=c(0.01,0.25),
+ groupsize=32,
+ xt=c( 0.5,1,2,6,24,36,72,120),
+ minxt=0,
+ maxxt=120,
+ a=70,
+ mina=0,
+ maxa=100,
+ ds_index=c(0,0,0,1,1,1,1,1), # size is number_of_non_fixed_parameters
+ ofv_calc_type=6) # Ds OFV calculation
evaluate_design(poped.db)
+#> $ofv
+#> [1] 14534520
+#>
+#> $fim
+#> [,1] [,2] [,3] [,4] [,5] [,6]
+#> [1,] 17141.83891 20.838375 10.011000 0.000000e+00 0.000000 0.00000000
+#> [2,] 20.83837 17.268051 -3.423641 0.000000e+00 0.000000 0.00000000
+#> [3,] 10.01100 -3.423641 49.864697 0.000000e+00 0.000000 0.00000000
+#> [4,] 0.00000 0.000000 0.000000 2.324341e+03 9.770352 0.03523364
+#> [5,] 0.00000 0.000000 0.000000 9.770352e+00 19083.877564 11.72131703
+#> [6,] 0.00000 0.000000 0.000000 3.523364e-02 11.721317 38.85137516
+#> [7,] 0.00000 0.000000 0.000000 7.268410e+02 9656.158553 64.78095548
+#> [8,] 0.00000 0.000000 0.000000 9.062739e+01 266.487127 2.94728469
+#> [,7] [,8]
+#> [1,] 0.00000 0.000000
+#> [2,] 0.00000 0.000000
+#> [3,] 0.00000 0.000000
+#> [4,] 726.84097 90.627386
+#> [5,] 9656.15855 266.487127
+#> [6,] 64.78096 2.947285
+#> [7,] 192840.20092 6659.569867
+#> [8,] 6659.56987 475.500111
+#>
+#> $rse
+#> bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
+#> 5.096246 3.031164 14.260384 29.761226 36.681388 26.748640
+#> SIGMA[1,1] SIGMA[2,2]
+#> 32.011719 25.637971
The full code for this example is available in “ex.13.shrinkage.R”.
+ +To evaluate the estimation quality of the individual random effects in the model (the b’s) we use the function shrinkage()
.
shrinkage(poped.db)
+#> # A tibble: 3 x 5
+#> `d[1]` `d[2]` `d[3]` type group
+#> <dbl> <dbl> <dbl> <chr> <chr>
+#> 1 0.504 0.367 0.424 shrink_var grp_1
+#> 2 0.295 0.205 0.241 shrink_sd grp_1
+#> 3 0.710 0.303 0.206 se grp_1
The output shows us the expected shrinkage on the variance scale (\(shrink_{var}=1-var(b_j)/D(j,j)\)) and on the standard deviation scale (\(shrink_{sd}=1-sd(b_j)/sqrt(D(j,j))\)), as well as the standard errors of the \(b_j\) estimates.
+Study 1 and 2 from table 2 in: Gibiansky, L., Gibiansky, E., & Bauer, R. (2012). Comparison of Nonmem 7.2 estimation methods and parallel processing efficiency on a target-mediated drug disposition model. Journal of Pharmacokinetics and Pharmacodynamics, 39(1), 17–35. https://doi.org/10.1007/s10928-011-9228-y↩
Nyberg, J., Bazzoli, C., Ogungbenro, K., Aliev, A., Leonov, S., Duffull, S., Hooker, A.C. and Mentré, F. (2014). Methods and software tools for design evaluation for population pharmacokinetics-pharmacodynamics studies. British Journal of Clinical Pharmacology, 79(1), 1–32. https://doi.org/10.1111/bcp.12352↩
intro-poped.Rmd
There are a number of functions to help you with these tasks. See ?poped
for more information.
Below is an example to introduce the package. There are several other examples, as r-scripts, in the “examples” folder in the PopED installation directory located at:
-system.file("examples", package="PopED")
-Below is an example to introduce the package. The code in the below example, and several other examples, are available as r-scripts in the “examples” folder in the PopED installation directory located at:
+system.file("examples", package="PopED")
You can view a list of the example files using the commands:
+ex_dir <- system.file("examples", package="PopED")
+list.files(ex_dir)
You can then open one of the examples (for example, ex.1.a.PK.1.comp.oral.md.intro.R
, the code found in this vignette) using the following code
file_name <- "ex.1.a.PK.1.comp.oral.md.intro.R"
+ex_file <- system.file("examples",file_name,package="PopED")
+file.copy(ex_file,tempdir(),overwrite = T)
+file.edit(file.path(tempdir(),file_name))
In addition, there is another vignette called “Examples” that explores the new features in each example.
+Here we define a one-compartment pharmacokinetic model with linear absorption using an analytical solution. In this case the solution is applicable for both multiple and single dosing. Note that this function is also predefined in PopED as ff.PK.1.comp.oral.md.CL
.
library(PopED)
library(PopED)
+packageVersion("PopED")
+#> [1] '0.4.0'
ff <- function(model_switch,xt,parameters,poped.db){
with(as.list(parameters),{
N = floor(xt/TAU)+1
@@ -97,7 +122,7 @@
return(list( y=y,poped.db=poped.db))
})
}
Next we define the parameters of this function, in this case log-normal distributions around the parameters (not Favail
). DOSE
and TAU
are defined as a covariates (a
) so that we can optimize these values later.
Next we define the parameters of this function, in this case log-normal distributions around the parameters (except for Favail
). DOSE
and TAU
are defined as covariates (in vector a
) so that we can optimize their values later.
sfg <- function(x,a,bpop,b,bocc){
parameters=c( V=bpop[1]*exp(b[1]),
KA=bpop[2]*exp(b[2]),
@@ -118,12 +143,15 @@
}
We have now defined all aspects of the model.
Now we define the model parameter values, the initial design and design space for optimization.
-In this example, the parameter values are defined for the fixed effects (bpop
), the between-subject variability variances (d
) and the residual variability variances (sigma
). We also fix the parameter Favail
using notfixed_bpop
, since we have only oral dosing and the parameter is not identifiable. Fixing a parameter means that we assume the parameter will not be estimated. In addition, we fix the small additive RUV term, as this term is reflecting the higher error expected at low concentration measurements (limit of quantification measurements) and would typically be calculated from analytical assay methods (for example, the standard deviation of the parameter might be 20% of the limit of quantification).
For the initial design, we define two groups (m=2
) of 20 individuals (groupsize=20
), with doses of 20 mg or 40 mg every 24 hours (a
). The initial design has 5 sample times per individual (xt
). For the design space, which can be searched during optimization, we define a potential dose range of between 0 and 200 mg (mina
and maxa
), and a range of potential sample times between 0 and 10 hours for the first three samples and between 240 and 248 hours for the last two samples (minxt
and maxxt
). Finally, we fix the two groups of subjects to have the sample sample times (bUseGrouped_xt=TRUE
).
In this example, the parameter values are defined for the fixed effects (bpop
), the between-subject variability variances (d
) and the residual variability variances (sigma
). We also fix the parameter Favail
using notfixed_bpop
, since we have only oral dosing and the parameter is not identifiable.
Fixing a parameter means that we assume the parameter will not be estimated (and is know without uncertainty). In addition, we fix the small additive RUV term, as this term is reflecting the higher error expected at low concentration measurements (limit of quantification measurements) and would typically be calculated from analytical assay methods (for example, the standard deviation of the parameter might be 20% of the limit of quantification).
+For the initial design, we define two groups (m=2
) of 20 individuals (groupsize=20
), with doses of 20 mg or 40 mg every 24 hours (a
). The initial design has 5 sample times per individual (xt
).
For the design space, which can be searched during optimization, we define a potential dose range of between 0 and 200 mg (mina
and maxa
), and a range of potential sample times between 0 and 10 hours for the first three samples and between 240 and 248 hours for the last two samples (minxt
and maxxt
).
Finally, we fix the two groups of subjects to have the same sample times (bUseGrouped_xt=TRUE
).
poped.db <- create.poped.database(ff_fun=ff,
fg_fun=sfg,
fError_fun=feps,
@@ -142,148 +170,202 @@
maxxt=c(10,10,10,248,248),
bUseGrouped_xt=TRUE)
First it may make sense to check your model and design to make sure you get what you expect when simulating data. Here we plot the model typical values:
plot_model_prediction(poped.db, model_num_points = 500)
Next, we plot the model typical values prediction intervals taking into account the between-subject variability (you can even investigate the effects of the residual, unexplained, variability with the DV=T
argument):
plot_model_prediction(poped.db, model_num_points=500, IPRED=T)
Next, we plot the model typical values prediction intervals taking into account the between-subject variability (you can even investigate the effects of the residual, unexplained, variability with the DV=TRUE
argument) but without sampling times:
plot_model_prediction(poped.db, model_num_points=500, IPRED=TRUE, sample.times = FALSE)
We can get these predictions numerically as well:
-dat <- model_prediction(poped.db,DV=T)
-head(dat,n=5);tail(dat,n=5)
## ID Time DV IPRED PRED Group Model DOSE TAU
-## 1 1 1 0.04422501 0.05747039 0.05325024 1 1 20 24
-## 2 1 2 0.08522768 0.09828859 0.09204804 1 1 20 24
-## 3 1 8 0.11048943 0.17340393 0.16409609 1 1 20 24
-## 4 1 240 0.17322493 0.22959440 0.12671376 1 1 20 24
-## 5 1 245 0.46941713 0.35619950 0.24980320 1 1 20 24
-## ID Time DV IPRED PRED Group Model DOSE TAU
-## 196 40 1 0.1500322 0.1613167 0.1065005 2 1 40 24
-## 197 40 2 0.2746268 0.2762786 0.1840961 2 1 40 24
-## 198 40 8 0.4568408 0.4497718 0.3281922 2 1 40 24
-## 199 40 240 0.2097838 0.1769645 0.2534275 2 1 40 24
-## 200 40 245 0.6648005 0.5527004 0.4996064 2 1 40 24
+dat <- model_prediction(poped.db,DV=TRUE)
+head(dat,n=5);tail(dat,n=5)
+#> ID Time DV IPRED PRED Group Model DOSE TAU
+#> 1 1 1 0.04422501 0.05747039 0.05325024 1 1 20 24
+#> 2 1 2 0.08522768 0.09828859 0.09204804 1 1 20 24
+#> 3 1 8 0.11048943 0.17340393 0.16409609 1 1 20 24
+#> 4 1 240 0.17322493 0.22959440 0.12671376 1 1 20 24
+#> 5 1 245 0.46941713 0.35619950 0.24980320 1 1 20 24
+#> ID Time DV IPRED PRED Group Model DOSE TAU
+#> 196 40 1 0.1500322 0.1613167 0.1065005 2 1 40 24
+#> 197 40 2 0.2746268 0.2762786 0.1840961 2 1 40 24
+#> 198 40 8 0.4568408 0.4497718 0.3281922 2 1 40 24
+#> 199 40 240 0.2097838 0.1769645 0.2534275 2 1 40 24
+#> 200 40 245 0.6648005 0.5527004 0.4996064 2 1 40 24
Next, we evaluate the initial design
-evaluate_design(poped.db)
## $ofv
-## [1] 39.309
-##
-## $fim
-## [,1] [,2] [,3] [,4] [,5]
-## [1,] 0.05336692 -8.683963 -0.05863412 0.000000 0.000000
-## [2,] -8.68396266 2999.851007 -14.43058560 0.000000 0.000000
-## [3,] -0.05863412 -14.430586 37.15243290 0.000000 0.000000
-## [4,] 0.00000000 0.000000 0.00000000 999.953587 312.240246
-## [5,] 0.00000000 0.000000 0.00000000 312.240246 439.412556
-## [6,] 0.00000000 0.000000 0.00000000 3.202847 2.287838
-## [7,] 0.00000000 0.000000 0.00000000 575.347261 638.581909
-## [,6] [,7]
-## [1,] 0.000000 0.0000
-## [2,] 0.000000 0.0000
-## [3,] 0.000000 0.0000
-## [4,] 3.202847 575.3473
-## [5,] 2.287838 638.5819
-## [6,] 3412.005199 1182.3255
-## [7,] 1182.325475 33864.3226
-##
-## $rse
-## bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
-## 8.215338 10.090955 4.400304 39.844763 60.655110 27.562541
-## SIGMA[1,1]
-## 13.865357
+evaluate_design(poped.db)
+#> $ofv
+#> [1] 39.309
+#>
+#> $fim
+#> [,1] [,2] [,3] [,4] [,5]
+#> [1,] 0.05336692 -8.683963 -0.05863412 0.000000 0.000000
+#> [2,] -8.68396266 2999.851007 -14.43058560 0.000000 0.000000
+#> [3,] -0.05863412 -14.430586 37.15243290 0.000000 0.000000
+#> [4,] 0.00000000 0.000000 0.00000000 999.953587 312.240246
+#> [5,] 0.00000000 0.000000 0.00000000 312.240246 439.412556
+#> [6,] 0.00000000 0.000000 0.00000000 3.202847 2.287838
+#> [7,] 0.00000000 0.000000 0.00000000 575.347261 638.581909
+#> [,6] [,7]
+#> [1,] 0.000000 0.0000
+#> [2,] 0.000000 0.0000
+#> [3,] 0.000000 0.0000
+#> [4,] 3.202847 575.3473
+#> [5,] 2.287838 638.5819
+#> [6,] 3412.005199 1182.3255
+#> [7,] 1182.325475 33864.3226
+#>
+#> $rse
+#> bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
+#> 8.215338 10.090955 4.400304 39.844763 60.655110 27.562541
+#> SIGMA[1,1]
+#> 13.865357
We see that the fixed-effect and residual variability parameters are relatively well estimated with this design, but the between-subject variability parameters are less well estimated.
+We can compare the initial design to a similar design with sparse sampling, i.e. having only 3 time points: xt = c(1,2,245).
+poped.db.new <- create.poped.database(ff_fun=ff,
+ fg_fun=sfg,
+ fError_fun=feps,
+ bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9),
+ notfixed_bpop=c(1,1,1,0),
+ d=c(V=0.09,KA=0.09,CL=0.25^2),
+ sigma=c(0.04,5e-6),
+ notfixed_sigma=c(1,0),
+ m=2,
+ groupsize=20,
+ a=list(c(DOSE=20,TAU=24),c(DOSE=40, TAU=24)),
+ maxa=c(DOSE=200,TAU=24),
+ mina=c(DOSE=0,TAU=24),
+ xt=c( 1,2,245),
+ minxt=c(0,0,240),
+ maxxt=c(10,10,248),
+ bUseGrouped_xt=TRUE)
evaluate_design(poped.db.new)
+#> $ofv
+#> [1] 29.66484
+#>
+#> $fim
+#> [,1] [,2] [,3] [,4] [,5]
+#> [1,] 0.04243232 -10.51432 0.05782431 0.000000 0.000000
+#> [2,] -10.51432135 2666.25466 -14.66678102 0.000000 0.000000
+#> [3,] 0.05782431 -14.66678 21.59743298 0.000000 0.000000
+#> [4,] 0.00000000 0.00000 0.00000000 632.163776 457.737062
+#> [5,] 0.00000000 0.00000 0.00000000 457.737062 347.115999
+#> [6,] 0.00000000 0.00000 0.00000000 3.115099 2.363458
+#> [7,] 0.00000000 0.00000 0.00000000 348.477101 262.369792
+#> [,6] [,7]
+#> [1,] 0.000000 0.0000
+#> [2,] 0.000000 0.0000
+#> [3,] 0.000000 0.0000
+#> [4,] 3.115099 348.4771
+#> [5,] 2.363458 262.3698
+#> [6,] 1153.026981 1979.2314
+#> [7,] 1979.231386 15617.8185
+#>
+#> $rse
+#> bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
+#> 44.120338 51.256239 5.748842 207.941540 280.689945 53.350716
+#> SIGMA[1,1]
+#> 22.795275
The precision on CL (bpop[3]) is similar with the alternative design but the other parameters are less well estimated with the alternative design.
+It is possible to compare the objective function value (ofv) and see that for this dummy example the alternative design (less samples per subject) the ofv is smaller (=worse). This value can also be used to optimize sampling times, doses, and other design features.
+Now we can optimize the sample times of the design1.
-output <- poped_optim(poped.db, opt_xt=T)
summary(output)
## ===============================================================================
-## FINAL RESULTS
-## Optimized Sampling Schedule
-## Group 1: 0.4574 10 10 240 240.9
-## Group 2: 0.4574 10 10 240 240.9
-##
-## OFV = 40.5277
-##
-## Efficiency:
-## ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.1902
-##
-## Expected parameter
-## relative standard error (%RSE):
-## Parameter Values RSE_0 RSE
-## bpop[1] 72.8000 8.22 6.28
-## bpop[2] 0.2500 10.09 7.74
-## bpop[3] 3.7500 4.40 4.29
-## D[1,1] 0.0900 39.84 32.54
-## D[2,2] 0.0900 60.66 50.44
-## D[3,3] 0.0625 27.56 26.44
-## SIGMA[1,1] 0.0400 13.87 14.80
-##
-## Total running time: 20.509 seconds
-plot_model_prediction(output$poped.db)
output <- poped_optim(poped.db, opt_xt=TRUE)
summary(output)
+#> ===============================================================================
+#> FINAL RESULTS
+#> Optimized Sampling Schedule
+#> Group 1: 0.4574 10 10 240 240.9
+#> Group 2: 0.4574 10 10 240 240.9
+#>
+#> OFV = 40.5277
+#>
+#> Efficiency:
+#> ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.1902
+#>
+#> Expected relative standard error
+#> (%RSE, rounded to nearest integer):
+#> Parameter Values RSE_0 RSE
+#> bpop[1] 72.8 8 6
+#> bpop[2] 0.25 10 8
+#> bpop[3] 3.75 4 4
+#> D[1,1] 0.09 40 33
+#> D[2,2] 0.09 61 50
+#> D[3,3] 0.0625 28 26
+#> SIGMA[1,1] 0.04 14 15
+#>
+#> Total running time: 17.731 seconds
+plot_model_prediction(output$poped.db)
We see that there are four distinct sample times for this design. This means that for this model, with these exact parameter values, that the most information from the study to inform the parameter estimation is with these sample times.
-Of course, this means that there are multiple samples at some of these time points. We can explore a more practical design by looking at the loss of efficiency if we spread out sample times in a uniform distribution around these optimal points (\(\pm 30\) minutes).
plot_efficiency_of_windows(output$poped.db,xt_windows=0.5)
Here we see the efficiency (\((|FIM_{optimized}|/|FIM_{initial}|)^{1/npar}\)) drop below 80% in some cases, which is mostly caused by an increase in the D[2,2] parameter uncertainty (BSV on absorption). Smaller windows or different windowing on different samples may be in order here. To investigate see ?plot_efficiency_of_windows
.
Here we see the efficiency (\((|FIM_{optimized}|/|FIM_{initial}|)^{1/npar}\)) drops below 80% in some cases, which is mostly caused by an increase in the D[2,2] parameter uncertainty (BSV on absorption). Smaller windows or different windowing on different samples might be needed. To investigate see ?plot_efficiency_of_windows
.
In the previous example we optimized over a continuous design space (sample times could be optimized to be any value between a lower and an upper limit). We could also limit the search to only “allowed” values, for example, only samples taken on the hour are allowed.
-poped.db.discrete <- create.poped.database(poped.db,discrete_xt = list(0:248))
+poped.db.discrete <- create.poped.database(poped.db,discrete_xt = list(c(0:10,240:248)))
-output_discrete <- poped_optim(poped.db.discrete, opt_xt=T)
-summary(output_discrete)
-## ===============================================================================
-## FINAL RESULTS
-## Optimized Sampling Schedule
-## Group 1: 1 10 10 240 241
-## Group 2: 1 10 10 240 241
-##
-## OFV = 40.3782
-##
-## Efficiency:
-## ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.165
-##
-## Expected parameter
-## relative standard error (%RSE):
-## Parameter Values RSE_0 RSE
-## bpop[1] 72.8000 8.22 6.33
-## bpop[2] 0.2500 10.09 8.01
-## bpop[3] 3.7500 4.40 4.30
-## D[1,1] 0.0900 39.84 32.46
-## D[2,2] 0.0900 60.66 53.33
-## D[3,3] 0.0625 27.56 26.52
-## SIGMA[1,1] 0.0400 13.87 14.68
-##
-## Total running time: 11.359 seconds
-plot_model_prediction(output_discrete$poped.db)
-
+output_discrete <- poped_optim(poped.db.discrete, opt_xt=TRUE)
summary(output_discrete)
+#> ===============================================================================
+#> FINAL RESULTS
+#> Optimized Sampling Schedule
+#> Group 1: 1 10 10 240 241
+#> Group 2: 1 10 10 240 241
+#>
+#> OFV = 40.3782
+#>
+#> Efficiency:
+#> ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.165
+#>
+#> Expected relative standard error
+#> (%RSE, rounded to nearest integer):
+#> Parameter Values RSE_0 RSE
+#> bpop[1] 72.8 8 6
+#> bpop[2] 0.25 10 8
+#> bpop[3] 3.75 4 4
+#> D[1,1] 0.09 40 32
+#> D[2,2] 0.09 61 53
+#> D[3,3] 0.0625 28 27
+#> SIGMA[1,1] 0.04 14 15
+#>
+#> Total running time: 10.473 seconds
+plot_model_prediction(output_discrete$poped.db)
Here we see that the optimization ran somewhat quicker, but gave a less efficient design.
One could also optimize over dose, to see if a different dose could help in parameter estimation .
-output_dose_opt <- poped_optim(output$poped.db, opt_xt=T, opt_a=T)
output_dose_opt <- poped_optim(output$poped.db, opt_xt=TRUE, opt_a=TRUE)
In this case the results are predictable … higher doses give observations with somewhat lower absolute residual variability leading to both groups at the highest allowed dose levels (200 mg in this case).
## [1] 0.01469712
+crit_fcn(output$poped.db)
+#> [1] 0.01469712Now we minimize the cost function
-output_cost <- poped_optim(poped.db, opt_a =T, opt_xt = F,
- ofv_fun=crit_fcn,
- maximize = F)
summary(output_cost)
## ===============================================================================
-## FINAL RESULTS
-##
-## Optimized Covariates:
-## Group 1: 31.5672 : 24
-## Group 2: 55.2426 : 24
-##
-## OFV = 2.53454e-14
-##
-## Efficiency:
-## (ofv_final / ofv_init) = 1.7245e-12
-##
-## Expected parameter
-## relative standard error (%RSE):
-## Parameter Values RSE_0 RSE
-## bpop[1] 72.8000 8.22 8.21
-## bpop[2] 0.2500 10.09 10.07
-## bpop[3] 3.7500 4.40 4.40
-## D[1,1] 0.0900 39.84 39.81
-## D[2,2] 0.0900 60.66 60.48
-## D[3,3] 0.0625 27.56 27.55
-## SIGMA[1,1] 0.0400 13.87 13.80
-##
-## Total running time: 4.274 seconds
-get_rse(output_cost$FIM, output_cost$poped.db)
## bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
-## 8.207404 10.070674 4.399378 39.808012 60.478363 27.549531
-## SIGMA[1,1]
-## 13.800551
-plot_model_prediction(output_cost$poped.db)
output_cost <- poped_optim(poped.db, opt_a = TRUE, opt_xt = FALSE,
+ ofv_fun=crit_fcn,
+ maximize = FALSE)
summary(output_cost)
+#> ===============================================================================
+#> FINAL RESULTS
+#>
+#> Optimized Covariates:
+#> Group 1: 31.5672 : 24
+#> Group 2: 55.2426 : 24
+#>
+#> OFV = 6.59816e-15
+#>
+#> Efficiency:
+#> (ofv_final / ofv_init) = 4.4894e-13
+#>
+#> Expected relative standard error
+#> (%RSE, rounded to nearest integer):
+#> Parameter Values RSE_0 RSE
+#> bpop[1] 72.8 8 8
+#> bpop[2] 0.25 10 10
+#> bpop[3] 3.75 4 4
+#> D[1,1] 0.09 40 40
+#> D[2,2] 0.09 61 60
+#> D[3,3] 0.0625 28 28
+#> SIGMA[1,1] 0.04 14 14
+#>
+#> Total running time: 13.652 seconds
+get_rse(output_cost$FIM, output_cost$poped.db)
+#> bpop[1] bpop[2] bpop[3] D[1,1] D[2,2] D[3,3]
+#> 8.207404 10.070674 4.399378 39.808012 60.478363 27.549531
+#> SIGMA[1,1]
+#> 13.800551
+plot_model_prediction(output_cost$poped.db)
Eric Stroemberg. Contributor.
MATLAB version
Martin Fink. Contributor.
+
Streamlining code, added functionality, vignettes
Giulia Lestini. Contributor.
+
Streamlining code, added functionality, vignettes
Sebastian Ueckert. Author.
MATLAB version
Update speed of FIM calculations (#20, @martin-gmx).
New and improved vignettes (#30, @giulialestini)!
Update RSE calculations so that prior FIM is handled correctly (#22, @martin-gmx).
Simplified code and removed duplicated code (#21, #24 and #32, @martin-gmx).
Added power evaluation script to test the power of a design to identify a prameter different than an assumed value. The function also calculates the number of individuals needed in a design to have a specific power. See ?evaluate_power
for more information (#26, @martin-gmx).
Major overhaul in optimization methods used in poped_optim()
so that generic optimization routines like optim()
can be easily used in optimizing PopED designs.
Updated and added new example scripts in system.file("examples", package="PopED")
(). This includes an example describing how to handle covariate distributions in optimal design, an example on how to incorporate IOV, an example on how to handle shrinkage, an example with a full covariance matrix and an example with a prior FIM (#30, @giulialestini and @martin-gmx).
New ways of handling inverting matricies, should be faster and work better when the matricies are ill-conditioned. See ?inv
for more information (#19, @martin-gmx).
Added function to compute expected shrinkage of a design. See ?shrinkage
for more information.
Updated functionality of IOV calculations.
Updates to optim_ARS()
for when to stop search.
Extended functionality of plot.model.prediction()
(#23, @martin-gmx).
Bug fixing. See https://github.com/andrewhooker/PopED/commits/master for more information.
Exported the summary
method for the results of poped_optim
in the PopED NAMESPACE, so that the method can actually be used! Just use summary(output)
.
Fixed some old bugs that used return
as a varible in functions, a la MATLAB.
Added a vignette to introduce PopED!
Improved optimization with poped_optim
, plus all example scripts now running with poped_optim
.
Update to more easily allow discrete optimization of xt and a variables. See the example scripts.
Added a summary method for the results of poped_optim
. Just use summary(output)
.
changed handling of seed numbers in optimizations.
more robust handling of non-population models
more natural handling of NA values in design vectors
NAMESPACE: removed ggplot2 from “Depends” and added to “Imports”
Added mean line to efficiency plots.
Update to computation and error handling for Laplace approximation to ED objective function.
Added more intuitive cost function input. See examples in ?poped_optim
Various small changes and bug fixes.
Added new optimization methods and tools, see ?poped_optim()
. This function incorporates the new optimization routines optim_ARS()
and optim_LS
which are optimized versions of previous optimization algorithms used in PopED. Both can be run with parallelization. poped_optim()
also incorporates the genetic algorithm from GA::ga()
, which can also be run with parallelization, and the “L-BFGS-B” method from stats::optim()
. poped_optim()
should be more efficient and faster than poped_optimize()
.
Changed the default objective function to be the log of the determinant of the FIM. create.poped.database(ofv_calc_type=4)
Various small changes and bug fixes.
Fixed plot_efficiency_of_windows()
bug that had wrong headers on each subplot.
Fixed bug in plot_model_prediction()
that did not plot the optimized design, but instead the initial design
Reorganized the database created from create.poped.database()
. The output from this function is now a list with 5 sub-lists: design, design_space, model, parameters and settings. Also removed duplicate entries in the database for easier manipulation. This will cause some back compatibility issues when refering to elements in a database.
Added example 10 describing a PKPD design of hepatitis C virus (HCV) kinetics to the system.file("examples",package="PopED")
directory of the PopED installation.
Updated model_prediction() to allow for creation of NONMEM datasets.
+Useful for testing of optimized designs via PsN’s (http://psn.sf.net) SSE tool, for example.
Two new functions create_design() and create_design_space() that allow for design and design space creation without the need for a model or parameter values.
Updated the create.poped.database() function to use create_design() and create_design_space()
Added examples for evaluation and optimization of a one-target quasi-steady-state target mediated drug disposition model (TMDD) to the system.file(“examples”,package=“PopED”) directory of the PopED installation.
Added a 2-compartment, oral absorption, multiple dose example to the system.file(“examples”, package=“PopED”) directory of the PopED installation.
Updated plot_efficiency_of_windows() to allow for the plotting of the RSE of each parameter on the y-axis.
Updated error handing for the Laplace approximation of the ED OFV.
Fixed bug when computing FIM with only one BSV term present in model (calculation gave an error).
Fixed a bug in plot_model_predictions where an error was returned if not all time values in the xt matrix were to be used for the design calculation (ni is different from size(xt,2), see ?create_poped_database).
Various small bug fixes.
Updated package author list
New functionality to compute the ED OFV using the Laplace approximation. This can be orders of magnitude faster than the standard MC integration approach. See ‘?ed_laplace_ofv’ and ‘?evaluate.e.ofv.fim’
Added a general function to compute the FIM and OFV(FIM) for all avaialbale methods in PopED. See ‘?calc_ofv_and_fim’.
Added a general optimization algorithm ‘RS_opt_gen()’ that works for both D-family and E-family optimization.
Added optimization of E-family designs to ‘poped_optimize()’.
Changed distribution tests for package building
Fixed bug where correlations between BSV (between subject variability) terms in the model gave an error when creating a PopED database
Fixed a bug where get_rse failed when a parameter had a value of 3.
The
optimization algorithms run in series, taking as input the output from the
previous method. The stopping rule used is to test if the line search
-algorithm fids a better optimum then its inital value. If so, then the chain
+algorithm fids a better optimum then its initial value. If so, then the chain
of algorithms is run again. If line search is not used then the argument
iter_tot
defines the number of times the chain of algorithms is run.
This function takes information from the PopED database supplied as an
@@ -143,8 +159,8 @@
Doptim(poped.db, ni, xt, model_switch, x, a, bpopdescr, ddescr, maxxt, minxt, - maxa, mina, fmf = 0, dmf = 0, trflag = TRUE, +Doptim(poped.db, ni, xt, model_switch, x, a, bpopdescr, ddescr, maxxt, + minxt, maxa, mina, fmf = 0, dmf = 0, trflag = TRUE, bUseRandomSearch = poped.db$settings$bUseRandomSearch, bUseStochasticGradient = poped.db$settings$bUseStochasticGradient, bUseBFGSMinimizer = poped.db$settings$bUseBFGSMinimizer, @@ -200,7 +216,7 @@Arg
ddescr -Matrix defining the diagnonals of the IIV (same logic as for +
Matrix defining the diagonals of the IIV (same logic as for the
bpopdescr
).@@ -229,7 +245,7 @@ Arg
dmf -+ The inital OFV. If set to zero then it is computed.
The initial OFV. If set to zero then it is computed.
trflag @@ -315,9 +331,8 @@R
See also
Other Optimize:
LEDoptim
, -RS_opt_gen
,RS_opt
, -a_line_search
,bfgsb_min
, -calc_autofocus
, +RS_opt
,a_line_search
, +bfgsb_min
,calc_autofocus
,calc_ofv_and_grad
,mfea
,optim_ARS
,optim_LS
,poped_optim_1
,poped_optim_2
, diff --git a/docs/reference/Dtrace.html b/docs/reference/Dtrace.html index 593d3279..82191ab2 100644 --- a/docs/reference/Dtrace.html +++ b/docs/reference/Dtrace.html @@ -51,7 +51,7 @@- +-Dtrace(fn, it, ni, xtopt, xopt, aopt, gxt, ga, dmf, diff, ixt, ia, itvector, - dmfvector, poped.db, opt_xt = poped.db$settings$optsw[2], - opt_a = poped.db$settings$optsw[4], opt_x = poped.db$settings$optsw[3], +Dtrace(fn, it, ni, xtopt, xopt, aopt, gxt, ga, dmf, diff, ixt, ia, + itvector, dmfvector, poped.db, opt_xt = poped.db$settings$optsw[2], + opt_a = poped.db$settings$optsw[4], + opt_x = poped.db$settings$optsw[3], opt_samps = poped.db$settings$optsw[1], opt_inds = poped.db$settings$optsw[5], rsit = poped.db$settings$rsit, convergence_eps = poped.db$settings$convergence_eps)@@ -121,7 +138,7 @@Arg
it -+ the interation number.
the iteration number.
ni @@ -157,11 +174,11 @@Arg
ixt -+ If xt Gradient Inversion Occured or not.
If xt Gradient Inversion occurred or not.
ia -+ If a Gradient Inversion Occured or not.
If a Gradient Inversion occurred or not.
itvector @@ -189,11 +206,11 @@Arg
opt_samps -+ Are the nuber of sample times per group being optimized?
Are the number of sample times per group being optimized?
opt_inds -+ Are the nuber of individuals per group being optimized?
Are the number of individuals per group being optimized?
rsit @@ -201,7 +218,7 @@Arg
diff --git a/docs/reference/LEDoptim.html b/docs/reference/LEDoptim.html index ec80bfa4..670bd39b 100644 --- a/docs/reference/LEDoptim.html +++ b/docs/reference/LEDoptim.html @@ -32,10 +32,10 @@ - convergence_eps -Stoachstic Gradient convergence value, +
Stochastic Gradient convergence value, (difference in OFV for D-optimal, difference in gradient for ED-optimal)
- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -108,10 +124,10 @@+
Optimization function for D-family, E-family and Laplace approximated ED des
--Optimize the objective fucntion for D-family, E-family and Laplace approximated ED designs. +
Optimize the objective function for D-family, E-family and Laplace approximated ED designs. Right now there is only one optimization algorithm used in this function
-
- +
Adaptive random search. See
RS_opt_gen
.Adaptive random search. See
RS_opt
.This function takes information from the PopED database supplied as an argument. The PopED database supplies information about the the model, parameters, design and methods to use. Some of the arguments coming from the PopED database can be overwritten; @@ -119,13 +135,14 @@
Optimization function for D-family, E-family and Laplace approximated ED des
LEDoptim(poped.db, model_switch = NULL, ni = NULL, xt = NULL, x = NULL, - a = NULL, bpopdescr = NULL, ddescr = NULL, maxxt = NULL, - minxt = NULL, maxa = NULL, mina = NULL, ofv_init = 0, fim_init = 0, - trflag = TRUE, header_flag = TRUE, footer_flag = TRUE, - opt_xt = poped.db$settings$optsw[2], opt_a = poped.db$settings$optsw[4], - opt_x = poped.db$settings$optsw[3], out_file = NULL, d_switch = FALSE, - use_laplace = T, laplace.fim = FALSE, +LEDoptim(poped.db, model_switch = NULL, ni = NULL, xt = NULL, + x = NULL, a = NULL, bpopdescr = NULL, ddescr = NULL, + maxxt = NULL, minxt = NULL, maxa = NULL, mina = NULL, + ofv_init = 0, fim_init = 0, trflag = TRUE, header_flag = TRUE, + footer_flag = TRUE, opt_xt = poped.db$settings$optsw[2], + opt_a = poped.db$settings$optsw[4], + opt_x = poped.db$settings$optsw[3], out_file = NULL, + d_switch = FALSE, use_laplace = T, laplace.fim = FALSE, use_RS = poped.db$settings$bUseRandomSearch, ...)Arguments
@@ -169,7 +186,7 @@Arg
ddescr -Matrix defining the diagnonals of the IIV (same logic as for +
Matrix defining the diagonals of the IIV (same logic as for the
bpopdescr
).@@ -194,7 +211,7 @@ Arg
ofv_init -+ The inital OFV. If set to zero then it is computed.
The initial OFV. If set to zero then it is computed.
fim_init @@ -233,7 +250,7 @@Arg
d_switch +
- -
******START OF CRITERION SPECIFICATION OPTIONS**********
D-family design (1) or ED-familty design (0) (with or without parameter uncertainty)
D-family design (1) or ED-family design (0) (with or without parameter uncertainty)
use_laplace @@ -243,11 +260,11 @@Arg
laplace.fim +is done using the standard MC integration technique, so can be slow. Should an E(FIM) be calculated when computing the Laplace approximated E(OFV). Typically the FIM does not need to be computed and, if desired, this calculation -is done usng the standard MC integration technique, so can be slow.
use_RS -+ should the fucntion use a random search algorithm?
should the function use a random search algorithm?
... @@ -257,8 +274,7 @@Arg
See also
-Other Optimize:
Doptim
, -RS_opt_gen
,RS_opt
, +Other Optimize:
Doptim
,RS_opt
,a_line_search
,bfgsb_min
,calc_autofocus
,calc_ofv_and_grad
,mfea
, diff --git a/docs/reference/LinMatrixH.html b/docs/reference/LinMatrixH.html index 6a4d2a35..babefac4 100644 --- a/docs/reference/LinMatrixH.html +++ b/docs/reference/LinMatrixH.html @@ -52,7 +52,7 @@- +diff --git a/docs/reference/LinMatrixL.html b/docs/reference/LinMatrixL.html index 1eb90cd0..754edbf3 100644 --- a/docs/reference/LinMatrixL.html +++ b/docs/reference/LinMatrixL.html @@ -54,7 +54,7 @@-Examples
-library(PopED) - -############# START ################# -## Create PopED database -## (warfarin model for optimization) -##################################### - -## Warfarin example from software comparison in: -## Nyberg et al., "Methods and software tools for design evaluation -## for population pharmacokinetics-pharmacodynamics studies", -## Br. J. Clin. Pharm., 2014. - -## Optimization using an additive + proportional reidual error -## to avoid sample times at very low concentrations (time 0 or very late samples). - -## find the parameters that are needed to define from the structural model -ff.PK.1.comp.oral.sd.CL#> function(model_switch,xt,parameters,poped.db){ -#> ##-- Model: One comp first order absorption -#> with(as.list(parameters),{ -#> y=xt -#> y=(DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt)) -#> return(list( y= y,poped.db=poped.db)) -#> }) -#> } -#> <environment: namespace:PopED>-## -- parameter definition function -## -- names match parameters in function ff -sfg <- function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) -} - -## -- Define initial design and design space -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=sfg, - fError_fun=feps.add.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=c(0.01,0.25), - groupsize=32, - xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0.01, - maxxt=120, - a=70, - mina=0.01, - maxa=100) - -############# END ################### -## Create PopED database -## (warfarin model for optimization) -##################################### - - -#for the FO approximation -ind=1 -LinMatrixH(model_switch=t(poped.db$design$model_switch[ind,,drop=FALSE]), - xt_ind=t(poped.db$design$xt[ind,,drop=FALSE]), - x=zeros(0,1), - a=t(poped.db$design$a[ind,,drop=FALSE]), - bpop=poped.db$parameters$bpop[,2,drop=FALSE], - b_ind=zeros(poped.db$parameters$NumRanEff,1), - bocc_ind=zeros(poped.db$parameters$NumDocc,1), - poped.db)[["y"]]#> [,1] [,2] -#> [1,] 3.4254357 1 -#> [2,] 5.4711041 1 -#> [3,] 7.3821834 1 -#> [4,] 7.9462805 1 -#> [5,] 5.6858561 1 -#> [6,] 4.5402483 1 -#> [7,] 2.3116966 1 -#> [8,] 0.9398657 1- -- +PopED - 0.3.2.9005 + 0.4.0- - + +diff --git a/docs/reference/LinMatrixLH.html b/docs/reference/LinMatrixLH.html index ec820b91..3c0e4fb7 100644 --- a/docs/reference/LinMatrixLH.html +++ b/docs/reference/LinMatrixLH.html @@ -53,7 +53,7 @@+
- +-PopED - 0.3.2.9005 + 0.4.0- - + +@@ -109,7 +125,8 @@+
Model linearization with respect to epsilon and eta.
LinMatrixLH(model_switch, xt_ind, x, a, bpop, b_ind, bocc_ind, NumEPS, poped.db)+LinMatrixLH(model_switch, xt_ind, x, a, bpop, b_ind, bocc_ind, NumEPS, + poped.db)Arguments
diff --git a/docs/reference/LinMatrixL_occ.html b/docs/reference/LinMatrixL_occ.html index dec8ebe6..f68dbb59 100644 --- a/docs/reference/LinMatrixL_occ.html +++ b/docs/reference/LinMatrixL_occ.html @@ -6,7 +6,7 @@ -
Model linearization with respect to occasion variablity parameters. — LinMatrixL_occ • PopED +Model linearization with respect to occasion variability parameters. — LinMatrixL_occ • PopED @@ -30,9 +30,9 @@ - + - @@ -52,7 +52,7 @@- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -95,20 +111,20 @@+
-Model linearization with respect to occasion variablity parameters.
+Model linearization with respect to occasion variability parameters.
LinMatrixL_occ.Rd
--The function performs a linearization of the model with respect to the occation variability parameter.. +
The function performs a linearization of the model with respect to the occasion variability parameter.. Derivative of model w.r.t. eta_occ, evaluated bocc_ind.
LinMatrixL_occ(model_switch, xt_ind, x, a, bpop, b_ind, bocc_ind, iCurrentOcc, - poped.db)+LinMatrixL_occ(model_switch, xt_ind, x, a, bpop, b_ind, bocc_ind, + iCurrentOcc, poped.db)Arguments
diff --git a/docs/reference/PopED-1.png b/docs/reference/PopED-1.png index ae09cc2b..41185143 100644 Binary files a/docs/reference/PopED-1.png and b/docs/reference/PopED-1.png differ diff --git a/docs/reference/PopED.html b/docs/reference/PopED.html index 376b7d5a..01a2dd23 100644 --- a/docs/reference/PopED.html +++ b/docs/reference/PopED.html @@ -53,7 +53,7 @@
- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -117,10 +133,10 @@+
Details
An initial design (and design space if you want to optimize).
The tasks to perform.
There are a number of functions to help you with these tasks. The user-level functions defined below are -meant to be run with a minimum of arguments (for begininers to advanced users). Many of the other functions in the package +meant to be run with a minimum of arguments (for beginners to advanced users). Many of the other functions in the package (and not listed here) are called by these user-level functions and are often not as user -freindly (developer level or advanced user functions).
+friendly (developer level or advanced user functions).Define a structural model:
ff.PK.1.comp.oral.md.CL
,ff.PK.1.comp.oral.md.KE
, @@ -128,7 +144,7 @@Details
ff.PK.1.comp.oral.sd.KE
,ff.PKPD.1.comp.oral.md.CL.imax
,ff.PKPD.1.comp.sd.CL.emax
. -Defne a residual unexplained variability model (residual error model): +
Define a residual unexplained variability model (residual error model):
diff --git a/docs/reference/PopED_output_summary_RS.txt b/docs/reference/PopED_output_summary_RS.txt index 71696006..2bd9f5bb 100644 --- a/docs/reference/PopED_output_summary_RS.txt +++ b/docs/reference/PopED_output_summary_RS.txt @@ -1,6 +1,6 @@ PopED Optimization Results for the Adaptive Random Search Algorithm - 2018-06-28 12:25:27 + 2018-09-09 21:01:50 ============================================================================== Model description : PopED model @@ -37,11 +37,11 @@ SIGMA[2,2]: 0.25 [ 0.5] ============================================================================== Experiment description (design and design space) -Numer of individuals: 32 +Number of individuals: 32 Number of groups (individuals with same design): 1 -Numer of individuals per group: +Number of individuals per group: Group 1: 32 -Numer of samples per group: +Number of samples per group: Number of discrete experimental variables: 0 Number of model covariates: 1 @@ -64,17 +64,18 @@ Initial OFV = 57.0828 Efficiency criterion [usually defined as OFV^(1/npar)] = 1255.57 -Initial design expected parameter -relative standard error (%RSE) +Initial design +expected relative standard error +(%RSE, rounded to nearest integer) Parameter Values RSE_0 - bpop[1] 0.15 4.84 - bpop[2] 8.00 2.96 - bpop[3] 1.00 6.59 - D[1,1] 0.07 30.20 - D[2,2] 0.02 37.10 - D[3,3] 0.60 27.62 - SIGMA[1,1] 0.01 32.87 - SIGMA[2,2] 0.25 26.03 + bpop[1] 0.15 5 + bpop[2] 8 3 + bpop[3] 1 7 + D[1,1] 0.07 30 + D[2,2] 0.02 37 + D[3,3] 0.6 28 + SIGMA[1,1] 0.01 33 + SIGMA[2,2] 0.25 26 ============================================================================== Optimization Settings @@ -110,7 +111,7 @@ Fisher Information Matrix type: 0 Design family: 1 D-family design (1) or - ED-familty design (0) + ED-family design (0) (with or without parameter uncertainty) ============================================================================== @@ -174,16 +175,16 @@ Efficiency criterion [usually defined as det(FIM)^(1/npar)] = 1255.57 Efficiency: ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1 -Expected parameter -relative standard error (%RSE): - Parameter Values RSE_0 RSE - bpop[1] 0.15 4.84 4.84 - bpop[2] 8.00 2.96 2.96 - bpop[3] 1.00 6.59 6.59 - D[1,1] 0.07 30.20 30.20 - D[2,2] 0.02 37.10 37.10 - D[3,3] 0.60 27.62 27.62 - SIGMA[1,1] 0.01 32.87 32.87 - SIGMA[2,2] 0.25 26.03 26.03 - -Total running time: 0.205 seconds +Expected relative standard error +(%RSE, rounded to nearest integer): + Parameter Values RSE_0 RSE + bpop[1] 0.15 5 5 + bpop[2] 8 3 3 + bpop[3] 1 7 7 + D[1,1] 0.07 0 0 + D[2,2] 0.02 37 37 + D[3,3] 0.6 0 0 + SIGMA[1,1] 0.01 33 33 + SIGMA[2,2] 0.25 26 26 + +Total running time: 0.165 seconds diff --git a/docs/reference/RS_opt.html b/docs/reference/RS_opt.html index 398eedc6..a9a8dab6 100644 --- a/docs/reference/RS_opt.html +++ b/docs/reference/RS_opt.html @@ -6,7 +6,7 @@ -feps.add.prop
,feps.add
,feps.prop
.Optimize the objective function using an adaptive random search algorithm for D-family designs. — RS_opt • PopED +Optimize the objective function using an adaptive random search algorithm for D-family and E-family designs. — RS_opt • PopED @@ -30,9 +30,10 @@ - + -- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -100,14 +117,15 @@+
-Optimize the objective function using an adaptive random search algorithm for D-family designs.
+Optimize the objective function using an adaptive random search algorithm for D-family and E-family designs.
RS_opt.Rd
--Optimize the objective function using an adaptive random search algorithm. +
Optimize the objective function using an adaptive random search algorithm. +Optimization can be performed for both D-family and E-family designs. The function works for both discrete and continuous optimization variables. This function takes information from the PopED database supplied as an argument. The PopED database supplies information about the the model, parameters, design and methods to use. @@ -117,16 +135,20 @@
Optimize the objective function using an adaptive random search algorithm fo
RS_opt(poped.db, ni = NULL, xt = NULL, model_switch = NULL, x = NULL, - a = NULL, bpopdescr = NULL, ddescr = NULL, maxxt = NULL, - minxt = NULL, maxa = NULL, mina = NULL, fmf = 0, dmf = 0, - trflag = TRUE, opt_xt = poped.db$settings$optsw[2], - opt_a = poped.db$settings$optsw[4], opt_x = poped.db$settings$optsw[3], - cfaxt = poped.db$settings$cfaxt, cfaa = poped.db$settings$cfaa, - rsit = poped.db$settings$rsit, +RS_opt(poped.db, ni = NULL, xt = NULL, model_switch = NULL, + x = NULL, a = NULL, bpopdescr = NULL, ddescr = NULL, + maxxt = NULL, minxt = NULL, maxa = NULL, mina = NULL, fmf = 0, + dmf = 0, trflag = TRUE, opt_xt = poped.db$settings$optsw[2], + opt_a = poped.db$settings$optsw[4], + opt_x = poped.db$settings$optsw[3], cfaxt = poped.db$settings$cfaxt, + cfaa = poped.db$settings$cfaa, rsit = poped.db$settings$rsit, rsit_output = poped.db$settings$rsit_output, fim.calc.type = poped.db$settings$iFIMCalculationType, - approx_type = poped.db$settings$iApproximationMethod, iter = 1, ...)+ approx_type = poped.db$settings$iApproximationMethod, iter = NULL, + d_switch = poped.db$settings$d_switch, + use_laplace = poped.db$settings$iEDCalculationType, + laplace.fim = FALSE, header_flag = TRUE, footer_flag = TRUE, + out_file = NULL, compute_inv = TRUE, ...)Arguments
@@ -169,7 +191,7 @@
@@ -249,11 +267,11 @@Arg
ddescr -Matrix defining the diagnonals of the IIV (same logic as for +
Matrix defining the diagonals of the IIV (same logic as for the
bpopdescr
).@@ -198,7 +220,7 @@ Arg
dmf -+ The inital OFV. If set to zero then it is computed.
The initial OFV. If set to zero then it is computed.
trflag @@ -242,7 +264,7 @@Arg
3 = Not currently used.
+(NOTE: NONMEM estimates the variance of the residual unexplained variation by default). 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the resudual unexplained variation by default).
5 = Full FIM parameterized with A,B,C matrices & derivative of variance.
6 = Calculate one model switch at a time, good for large matrices.
@@ -254,7 +276,41 @@ 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.
Arg
+ iter -+ The number of iterations entered into the
blockheader
function.+ The number of iterations entered into the
blockheader_2
function.+ +d_switch ++ +
- +
******START OF CRITERION SPECIFICATION OPTIONS**********
D-family design (1) or ED-family design (0) (with or without parameter uncertainty)
+ +use_laplace ++ Should the Laplace method be used in calculating the expectation of the OFV?
+ +laplace.fim ++ Should an E(FIM) be calculated when computing the Laplace approximated E(OFV). Typically +the FIM does not need to be computed and, if desired, this calculation +is done using the standard MC integration technique, so can be slow.
+ +header_flag ++ Should the header text be printed out?
+ +footer_flag ++ Should the footer text be printed out?
+ +out_file ++ Which file should the output be directed to? A string, a file handle using +
file
or""
will output to the screen.+ compute_inv +should the inverse of the FIM be used to compute expected RSE values? Often not needed +except for diagnostic purposes.
... @@ -275,9 +331,8 @@R
See also
Other Optimize:
Doptim
, -LEDoptim
,RS_opt_gen
, -a_line_search
,bfgsb_min
, -calc_autofocus
, +LEDoptim
,a_line_search
, +bfgsb_min
,calc_autofocus
,calc_ofv_and_grad
,mfea
,optim_ARS
,optim_LS
,poped_optim_1
,poped_optim_2
, @@ -290,7 +345,8 @@Examp ############# START ################# ## Create PopED database -## (warfarin model for optimization) +## (warfarin model for optimization +## with parameter uncertainty) ##################################### ## Warfarin example from software comparison in: @@ -298,8 +354,8 @@
Examp ## for population pharmacokinetics-pharmacodynamics studies", ## Br. J. Clin. Pharm., 2014. -## Optimization using an additive + proportional reidual error -## to avoid sample times at very low concentrations (time 0 or very late samples). +## Optimization using an additive + proportional reidual error +## to avoid sample times at very low concentrations (time 0 or very late samoples). ## find the parameters that are needed to define from the structural model ff.PK.1.comp.oral.sd.CL
#> function(model_switch,xt,parameters,poped.db){ @@ -322,25 +378,37 @@Examp return(parameters) } +# Adding 10% log-normal Uncertainty to fixed effects (not Favail) +bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1) +bpop_vals_ed_ln <- cbind(ones(length(bpop_vals),1)*4, # log-normal distribution + bpop_vals, + ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value +bpop_vals_ed_ln["Favail",] <- c(0,1,0) +bpop_vals_ed_ln
#> bpop_vals +#> CL 4 0.15 0.000225 +#> V 4 8.00 0.640000 +#> KA 4 1.00 0.010000 +#> Favail 0 1.00 0.000000## -- Define initial design and design space poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, fg_fun=sfg, fError_fun=feps.add.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), + bpop=bpop_vals_ed_ln, notfixed_bpop=c(1,1,1,0), d=c(CL=0.07, V=0.02, KA=0.6), sigma=c(0.01,0.25), groupsize=32, xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0.01, + minxt=0, maxxt=120, a=70, - mina=0.01, + mina=0, maxa=100) ############# END ################### ## Create PopED database -## (warfarin model for optimization) +## (warfarin model for optimization +## with parameter uncertainty) ##################################### @@ -352,17 +420,18 @@Examp #> #> Efficiency criterion [usually defined as OFV^(1/npar)] = 1255.57 #> -#> Initial design expected parameter -#> relative standard error (%RSE) +#> Initial design +#> expected relative standard error +#> (%RSE, rounded to nearest integer) #> Parameter Values RSE_0 -#> bpop[1] 0.15 4.84 -#> bpop[2] 8.00 2.96 -#> bpop[3] 1.00 6.59 -#> D[1,1] 0.07 30.20 -#> D[2,2] 0.02 37.10 -#> D[3,3] 0.60 27.62 -#> SIGMA[1,1] 0.01 32.87 -#> SIGMA[2,2] 0.25 26.03 +#> bpop[1] 0.15 5 +#> bpop[2] 8 3 +#> bpop[3] 1 7 +#> D[1,1] 0.07 30 +#> D[2,2] 0.02 37 +#> D[3,3] 0.6 28 +#> SIGMA[1,1] 0.01 33 +#> SIGMA[2,2] 0.25 26 #> #> RS - It. : 3 OFV : 57.0828 #> =============================================================================== @@ -379,23 +448,37 @@
Examp #> Efficiency: #> ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1 #> -#> Expected parameter -#> relative standard error (%RSE): -#> Parameter Values RSE_0 RSE -#> bpop[1] 0.15 4.84 4.84 -#> bpop[2] 8.00 2.96 2.96 -#> bpop[3] 1.00 6.59 6.59 -#> D[1,1] 0.07 30.20 30.20 -#> D[2,2] 0.02 37.10 37.10 -#> D[3,3] 0.60 27.62 27.62 -#> SIGMA[1,1] 0.01 32.87 32.87 -#> SIGMA[2,2] 0.25 26.03 26.03 +#> Expected relative standard error +#> (%RSE, rounded to nearest integer): +#> Parameter Values RSE_0 RSE +#> bpop[1] 0.15 5 5 +#> bpop[2] 8 3 3 +#> bpop[3] 1 7 7 +#> D[1,1] 0.07 0 0 +#> D[2,2] 0.02 37 37 +#> D[3,3] 0.6 0 0 +#> SIGMA[1,1] 0.01 33 33 +#> SIGMA[2,2] 0.25 26 26 #> -#> Total running time: 0.202 seconds
+#> Total running time: 0.165 seconds# NOT RUN { - # More iterations - rs.output <- RS_opt(poped.db) + RS_opt(poped.db) + + RS_opt(poped.db,opt_xt=TRUE,rsit=100,compute_inv=F) + RS_opt(poped.db,opt_xt=TRUE,rsit=20,d_switch=0) + RS_opt(poped.db,opt_xt=TRUE,rsit=10,d_switch=0,use_laplace=T) + RS_opt(poped.db,opt_xt=TRUE,rsit=10,d_switch=0,use_laplace=T,laplace.fim=T) + + ## Different headers and footers of output + RS_opt(poped.db,opt_xt=TRUE,rsit=10,out_file="foo.txt") + output <- RS_opt(poped.db,opt_xt=TRUE,rsit=100,trflag=FALSE) + RS_opt(poped.db,opt_xt=TRUE,rsit=10,out_file="") + RS_opt(poped.db,opt_xt=TRUE,rsit=10,header_flag=FALSE) + RS_opt(poped.db,opt_xt=TRUE,rsit=10,footer_flag=FALSE) + RS_opt(poped.db,opt_xt=TRUE,rsit=10,header_flag=FALSE,footer_flag=FALSE) + RS_opt(poped.db,opt_xt=TRUE,rsit=10,header_flag=FALSE,footer_flag=FALSE,out_file="foo.txt") + RS_opt(poped.db,opt_xt=TRUE,rsit=10,header_flag=FALSE,footer_flag=FALSE,out_file="") # } diff --git a/docs/reference/a_line_search.html b/docs/reference/a_line_search.html index 1a379967..d369d6e2 100644 --- a/docs/reference/a_line_search.html +++ b/docs/reference/a_line_search.html @@ -32,7 +32,7 @@ - @@ -52,7 +52,7 @@- +@@ -102,14 +118,16 @@Optimize using line search
-The function performs a grid search sequatially along +
The function performs a grid search sequentially along design variables. The grid is defined by ls_step_size.
a_line_search(poped.db, out_file = "", bED = FALSE, diff = 0, - fmf_initial = 0, dmf_initial = 0, opt_xt = poped.db$settings$optsw[2], - opt_a = poped.db$settings$optsw[4], opt_x = poped.db$settings$optsw[3], + fmf_initial = 0, dmf_initial = 0, + opt_xt = poped.db$settings$optsw[2], + opt_a = poped.db$settings$optsw[4], + opt_x = poped.db$settings$optsw[3], opt_samps = poped.db$settings$optsw[1], opt_inds = poped.db$settings$optsw[5], ls_step_size = poped.db$settings$ls_step_size)@@ -158,11 +176,11 @@Arg
opt_samps -+ Are the nuber of sample times per group being optimized?
Are the number of sample times per group being optimized?
opt_inds -+ Are the nuber of individuals per group being optimized?
Are the number of individuals per group being optimized?
ls_step_size @@ -185,9 +203,8 @@Value
See also
Other Optimize:
Doptim
, -LEDoptim
,RS_opt_gen
, -RS_opt
,bfgsb_min
, -calc_autofocus
, +LEDoptim
,RS_opt
, +bfgsb_min
,calc_autofocus
,calc_ofv_and_grad
,mfea
,optim_ARS
,optim_LS
,poped_optim_1
,poped_optim_2
, @@ -263,43 +280,43 @@Examp #> OFV(MF) changed from 55.3964 to 55.512 #> group 1 -- xt[7] changed from 90.0025 to 120 #> OFV(MF) changed from 55.512 to 55.5449 +#> Searching xt2 on group 1 +#> group 1 -- xt[2] changed from 1 to 0.01 +#> OFV(MF) changed from 55.5449 to 55.779 +#> group 1 -- xt[2] changed from 0.01 to 90.0025 +#> OFV(MF) changed from 55.779 to 55.8799 +#> group 1 -- xt[2] changed from 90.0025 to 120 +#> OFV(MF) changed from 55.8799 to 55.9016 #> Searching xt5 on group 1 -#> group 1 -- xt[5] changed from 24 to 0.01 -#> OFV(MF) changed from 55.5449 to 55.5464 -#> group 1 -- xt[5] changed from 0.01 to 90.0025 -#> OFV(MF) changed from 55.5464 to 55.6612 -#> group 1 -- xt[5] changed from 90.0025 to 120 -#> OFV(MF) changed from 55.6612 to 55.6755 +#> Searching xt1 on group 1 +#> Searching xt8 on group 1 +#> Searching xt3 on group 1 #> Searching xt6 on group 1 #> group 1 -- xt[6] changed from 36 to 30.0075 -#> OFV(MF) changed from 55.6755 to 55.7488 -#> Searching xt1 on group 1 -#> group 1 -- xt[1] changed from 0.5 to 30.0075 -#> OFV(MF) changed from 55.7488 to 55.857 +#> OFV(MF) changed from 55.9016 to 55.9504 +#> group 1 -- xt[6] changed from 30.0075 to 90.0025 +#> OFV(MF) changed from 55.9504 to 55.9617 #> Searching xt4 on group 1 -#> Searching xt3 on group 1 -#> Searching xt2 on group 1 -#> Searching xt8 on group 1 -#> OFV(MF): 55.857 +#> OFV(MF): 55.9617 #> -#> Best value for OFV(MF) = 55.857 +#> Best value for OFV(MF) = 55.9617 #> #> Best value for xt: -#> Group 1: 1 2 6 30.01 30.01 120 120 120 +#> Group 1: 0.5 2 6 24 90 120 120 120 #> #> Searching a1 on individual/group 1 #> group 1 -- a[1] changed from 70 to 75.0025 -#> OFV(MF) changed from 55.857 to 56.0566 +#> OFV(MF) changed from 55.9617 to 56.1549 #> group 1 -- a[1] changed from 75.0025 to 100 -#> OFV(MF) changed from 56.0566 to 56.6925 -#> OFV(MF): 56.6925 -#> Best value for OFV(MF) = 56.6925 +#> OFV(MF) changed from 56.1549 to 56.7447 +#> OFV(MF): 56.7447 +#> Best value for OFV(MF) = 56.7447 #> #> Best value for a: #> Group 1: 100 #> #> -#> Line search run time: 0.417 seconds +#> Line search run time: 0.414 seconds #> *************************** #>
# NOT RUN { diff --git a/docs/reference/bfgsb_min.html b/docs/reference/bfgsb_min.html index 48160a31..cdf64276 100644 --- a/docs/reference/bfgsb_min.html +++ b/docs/reference/bfgsb_min.html @@ -52,7 +52,7 @@x0 -+ the intial values to optimize
the initial values to optimize
l @@ -150,8 +166,8 @@Value
See also
Other Optimize:
Doptim
, -LEDoptim
,RS_opt_gen
, -RS_opt
,a_line_search
, +LEDoptim
,RS_opt
, +a_line_search
,calc_autofocus
,calc_ofv_and_grad
,mfea
,optim_ARS
,optim_LS
, diff --git a/docs/reference/blockexp.html b/docs/reference/blockexp.html index 96c957b9..5eb89315 100644 --- a/docs/reference/blockexp.html +++ b/docs/reference/blockexp.html @@ -52,7 +52,7 @@- +-PopED - 0.3.2.9005 + 0.4.0- - + +@@ -107,8 +123,10 @@+
Summarize your experiment for optimization routines
blockexp(fn, poped.db, e_flag = FALSE, opt_xt = poped.db$settings$optsw[2], - opt_a = poped.db$settings$optsw[4], opt_x = poped.db$settings$optsw[4], +blockexp(fn, poped.db, e_flag = FALSE, + opt_xt = poped.db$settings$optsw[2], + opt_a = poped.db$settings$optsw[4], + opt_x = poped.db$settings$optsw[4], opt_samps = poped.db$settings$optsw[1], opt_inds = poped.db$settings$optsw[5])@@ -125,7 +143,7 @@Arg
e_flag -+ Shuould output be with uncertainty around parameters?
Should output be with uncertainty around parameters?
opt_xt @@ -141,11 +159,11 @@Arg
opt_samps -+ Are the nuber of sample times per group being optimized?
Are the number of sample times per group being optimized?
opt_inds -+ Are the nuber of individuals per group being optimized?
Are the number of individuals per group being optimized?
Examp #> ============================================================================== #> Experiment description (design and design space) #> -#> Numer of individuals: 32 +#> Number of individuals: 32 #> Number of groups (individuals with same design): 1 -#> Numer of individuals per group: +#> Number of individuals per group: #> Group 1: 32 -#> Numer of samples per group: +#> Number of samples per group: #> Number of discrete experimental variables: 0 #> Number of model covariates: 1 #> diff --git a/docs/reference/blockfinal.html b/docs/reference/blockfinal.html index 3bda47eb..5261478e 100644 --- a/docs/reference/blockfinal.html +++ b/docs/reference/blockfinal.html @@ -51,7 +51,7 @@
- +-PopED - 0.3.2.9005 + 0.4.0- - + +@@ -105,12 +121,13 @@+
Result function for optimization routines
blockfinal(fn, fmf, dmf, groupsize, ni, xt, x, a, model_switch, bpop, d, docc, - sigma, poped.db, opt_xt = poped.db$settings$optsw[2], - opt_a = poped.db$settings$optsw[4], opt_x = poped.db$settings$optsw[3], - fmf_init = NULL, dmf_init = NULL, param_cvs_init = NULL, - compute_inv = TRUE, out_file = NULL, trflag = TRUE, - footer_flag = TRUE, run_time = NULL, ...)+blockfinal(fn, fmf, dmf, groupsize, ni, xt, x, a, model_switch, bpop, d, + docc, sigma, poped.db, opt_xt = poped.db$settings$optsw[2], + opt_a = poped.db$settings$optsw[4], + opt_x = poped.db$settings$optsw[3], fmf_init = NULL, + dmf_init = NULL, param_cvs_init = NULL, compute_inv = TRUE, + out_file = NULL, trflag = TRUE, footer_flag = TRUE, + run_time = NULL, ...)Arguments
@@ -125,11 +142,11 @@
diff --git a/docs/reference/calc_autofocus.html b/docs/reference/calc_autofocus.html index aef5ddfa..6251bbab 100644 --- a/docs/reference/calc_autofocus.html +++ b/docs/reference/calc_autofocus.html @@ -51,7 +51,7 @@Arg
dmf -+ The inital OFV. If set to zero then it is computed.
The initial OFV. If set to zero then it is computed.
groupsize -+ A vector of the numer of individuals in each group.
A vector of the number of individuals in each group.
ni @@ -163,7 +180,7 @@Arg
d -Matrix defining the diagnonals of the IIV (same logic as for the fixed efects +
Matrix defining the diagonals of the IIV (same logic as for the fixed effects matrix bpop to define uncertainty). One can also just supply the parameter values as a
c()
.@@ -173,7 +190,7 @@ Arg
sigma +can also just supply the diagonal parameter values (variances) as a Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagnonal parameter values (variances) as a
c()
.c()
.poped.db @@ -201,7 +218,7 @@Arg
param_cvs_init -+ The inital design parameter RSE values.
The initial design parameter RSE values in percent.
compute_inv @@ -311,7 +328,7 @@Examp opt_xt=TRUE, fmf_init=FIM, dmf_init=dmf, - param_cvs_init=rbind(get_rse(FIM,poped.db,use_percent=FALSE)))
#> =============================================================================== + param_cvs_init=get_rse(FIM,poped.db))#> =============================================================================== #> FINAL RESULTS #> Optimized Sampling Schedule #> Group 1: 0.5 1 2 6 24 36 72 120 @@ -321,19 +338,19 @@Examp #> Efficiency: #> ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = NaN #> -#> Expected parameter -#> relative standard error (%RSE): -#> Parameter Values RSE_0 RSE -#> bpop[1] 0.15 5.10 5.10 -#> bpop[2] 8.00 3.03 3.03 -#> bpop[3] 1.00 14.26 14.26 -#> D[1,1] 0.07 29.76 29.76 -#> D[2,2] 0.02 36.68 36.68 -#> D[3,3] 0.60 26.75 26.75 -#> SIGMA[1,1] 0.01 32.01 32.01 -#> SIGMA[2,2] 0.25 25.64 25.64 +#> Expected relative standard error +#> (%RSE, rounded to nearest integer): +#> Parameter Values RSE_0 RSE +#> bpop[1] 0.15 5 5 +#> bpop[2] 8 3 3 +#> bpop[3] 1 14 14 +#> D[1,1] 0.07 30 30 +#> D[2,2] 0.02 37 37 +#> D[3,3] 0.6 27 27 +#> SIGMA[1,1] 0.01 32 32 +#> SIGMA[2,2] 0.25 26 26 #> -#> Total running time: 1.24 seconds
+#> Total running time: 1.249 secondsdiff --git a/docs/reference/blockheader.html b/docs/reference/blockheader.html index 7d29f4c3..32011d60 100644 --- a/docs/reference/blockheader.html +++ b/docs/reference/blockheader.html @@ -51,7 +51,7 @@- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -107,11 +123,12 @@+
Header function for optimization routines
blockheader(poped.db, name = "Default", iter = NULL, e_flag = !(poped.db$settings$d_switch), - opt_xt = poped.db$settings$optsw[2], opt_a = poped.db$settings$optsw[4], + opt_xt = poped.db$settings$optsw[2], + opt_a = poped.db$settings$optsw[4], opt_x = poped.db$settings$optsw[3], opt_samps = poped.db$settings$optsw[1], - opt_inds = poped.db$settings$optsw[5], fmf = 0, dmf = 0, bpop = NULL, - d = NULL, docc = NULL, sigma = NULL, + opt_inds = poped.db$settings$optsw[5], fmf = 0, dmf = 0, + bpop = NULL, d = NULL, docc = NULL, sigma = NULL, name_header = poped.db$settings$strOutputFileName, file_path = poped.db$settings$strOutputFilePath, out_file = NULL, compute_inv = TRUE, trflag = TRUE, header_flag = TRUE, ...)@@ -134,7 +151,7 @@Arg
e_flag -+ Shuould output be with uncertainty around parameters?
Should output be with uncertainty around parameters?
opt_xt @@ -150,11 +167,11 @@Arg
opt_samps -+ Are the nuber of sample times per group being optimized?
Are the number of sample times per group being optimized?
opt_inds -+ Are the nuber of individuals per group being optimized?
Are the number of individuals per group being optimized?
fmf @@ -162,7 +179,7 @@Arg
dmf -+ The inital OFV. If set to zero then it is computed.
The initial OFV. If set to zero then it is computed.
bpop @@ -176,7 +193,7 @@Arg
d -Matrix defining the diagnonals of the IIV (same logic as for the fixed efects +
Matrix defining the diagonals of the IIV (same logic as for the fixed effects matrix bpop to define uncertainty). One can also just supply the parameter values as a
c()
.@@ -186,7 +203,7 @@ Arg
sigma +can also just supply the diagonal parameter values (variances) as a Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagnonal parameter values (variances) as a
c()
.c()
.name_header @@ -316,17 +333,18 @@Examp #> #> Initial OFV = 1.14386e+24 #> -#> Initial design expected parameter -#> relative standard error (%RSE) +#> Initial design +#> expected relative standard error +#> (%RSE, rounded to nearest integer) #> Parameter Values RSE_0 -#> bpop[1] 0.15 5.10 -#> bpop[2] 8.00 3.03 -#> bpop[3] 1.00 14.26 -#> D[1,1] 0.07 29.76 -#> D[2,2] 0.02 36.68 -#> D[3,3] 0.60 26.75 -#> SIGMA[1,1] 0.01 32.01 -#> SIGMA[2,2] 0.25 25.64 +#> bpop[1] 0.15 5 +#> bpop[2] 8 3 +#> bpop[3] 1 14 +#> D[1,1] 0.07 30 +#> D[2,2] 0.02 37 +#> D[3,3] 0.6 27 +#> SIGMA[1,1] 0.01 32 +#> SIGMA[2,2] 0.25 26 #> #> ============================================================================== #> Optimization of design parameters @@ -351,17 +369,18 @@
Examp #> #> Initial OFV = 1.14386e+24 #> -#> Initial design expected parameter -#> relative standard error (%RSE) +#> Initial design +#> expected relative standard error +#> (%RSE, rounded to nearest integer) #> Parameter Values RSE_0 -#> bpop[1] 0.15 5.10 -#> bpop[2] 8.00 3.03 -#> bpop[3] 1.00 14.26 -#> D[1,1] 0.07 29.76 -#> D[2,2] 0.02 36.68 -#> D[3,3] 0.60 26.75 -#> SIGMA[1,1] 0.01 32.01 -#> SIGMA[2,2] 0.25 25.64 +#> bpop[1] 0.15 5 +#> bpop[2] 8 3 +#> bpop[3] 1 14 +#> D[1,1] 0.07 30 +#> D[2,2] 0.02 37 +#> D[3,3] 0.6 27 +#> SIGMA[1,1] 0.01 32 +#> SIGMA[2,2] 0.25 26 #> #> ============================================================================== #> Optimization of design parameters diff --git a/docs/reference/blockopt.html b/docs/reference/blockopt.html index 3220b292..6b321376 100644 --- a/docs/reference/blockopt.html +++ b/docs/reference/blockopt.html @@ -52,7 +52,7 @@
opt_method -+ If "RS" (random search), "SG" (stochastic gradient) or "DO" (discrete optimization) then specifc output is produced.
If "RS" (random search), "SG" (stochastic gradient) or "DO" (discrete optimization) then specific output is produced.
- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -122,7 +138,7 @@+
Arg
dmf -+ The inital OFV. If set to zero then it is computed.
The initial OFV. If set to zero then it is computed.
varopt @@ -158,7 +174,7 @@Arg
groupsize -+ A vector of the numer of individuals in each group.
A vector of the number of individuals in each group.
xtopt @@ -188,13 +204,13 @@Arg
d -Matrix defining the diagnonals of the IIV (same logic as for the fixed efects +
Matrix defining the diagonals of the IIV (same logic as for the fixed effects matrix bpop to define uncertainty). One can also just supply the parameter values as a
c()
.sigma +can also just supply the diagonal parameter values (variances) as a Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagnonal parameter values (variances) as a
c()
.c()
.docc @@ -216,12 +232,12 @@Value
See also
diff --git a/docs/reference/calc_ofv_and_fim.html b/docs/reference/calc_ofv_and_fim.html index 45b77fa1..6a6c8f1e 100644 --- a/docs/reference/calc_ofv_and_fim.html +++ b/docs/reference/calc_ofv_and_fim.html @@ -54,7 +54,7 @@Other Optimize:
Doptim
, -LEDoptim
,RS_opt_gen
, -RS_opt
,a_line_search
, -bfgsb_min
,calc_ofv_and_grad
, -mfea
,optim_ARS
, -optim_LS
,poped_optim_1
, -poped_optim_2
,poped_optim_3
, +LEDoptim
,RS_opt
, +a_line_search
,bfgsb_min
, +calc_ofv_and_grad
,mfea
, +optim_ARS
,optim_LS
, +poped_optim_1
,poped_optim_2
, +poped_optim_3
,poped_optimize
,poped_optim
- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -115,13 +131,16 @@+
Calculate the Fisher Information Matrix (FIM) and the OFV(FIM) for either po d_switch = poped.db$settings$d_switch, bpopdescr = poped.db$parameters$bpop, ddescr = poped.db$parameters$d, bpop = bpopdescr[, 2, drop = F], d = getfulld(ddescr[, 2, drop = F], - poped.db$parameters$covd), docc_full = getfulld(poped.db$parameters$docc[, - 2, drop = F], poped.db$parameters$covdocc), + poped.db$parameters$covd), + docc_full = getfulld(poped.db$parameters$docc[, 2, drop = F], + poped.db$parameters$covdocc), model_switch = poped.db$design$model_switch, ni = poped.db$design$ni, - xt = poped.db$design$xt, x = poped.db$design$x, a = poped.db$design$a, + xt = poped.db$design$xt, x = poped.db$design$x, + a = poped.db$design$a, fim.calc.type = poped.db$settings$iFIMCalculationType, - use_laplace = poped.db$settings$iEDCalculationType, laplace.fim = FALSE, - ofv_fun = poped.db$settings$ofv_fun, evaluate_fim = TRUE, ...) + use_laplace = poped.db$settings$iEDCalculationType, + laplace.fim = FALSE, ofv_fun = poped.db$settings$ofv_fun, + evaluate_fim = TRUE, ...)
Arguments
@@ -142,7 +161,7 @@
Arg
d_switch +
- -
******START OF CRITERION SPECIFICATION OPTIONS**********
D-family design (1) or ED-familty design (0) (with or without parameter uncertainty)
D-family design (1) or ED-family design (0) (with or without parameter uncertainty)
bpopdescr @@ -158,7 +177,7 @@Arg
ddescr -Matrix defining the diagnonals of the IIV (same logic as for +
Matrix defining the diagonals of the IIV (same logic as for the
bpopdescr
).@@ -173,7 +192,7 @@ Arg
d -Matrix defining the diagnonals of the IIV (same logic as for the fixed efects +
Matrix defining the diagonals of the IIV (same logic as for the fixed effects matrix bpop to define uncertainty). One can also just supply the parameter values as a
c()
.@@ -210,7 +229,7 @@ Arg
3 = Not currently used.
+(NOTE: NONMEM estimates the variance of the residual unexplained variation by default). 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the resudual unexplained variation by default).
5 = Full FIM parameterized with A,B,C matrices & derivative of variance.
6 = Calculate one model switch at a time, good for large matrices.
@@ -224,12 +243,12 @@ 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.
Arg
laplace.fim +is done using the standard MC integration technique, so can be slow. Should an E(FIM) be calculated when computing the Laplace approximated E(OFV). Typically the FIM does not need to be computed and, if desired, this calculation -is done usng the standard MC integration technique, so can be slow.
ofv_fun User defined function used to compute the objective function. The function must have a poped database object as its first -argument and have "..." in its argument list. Can be referenced as a function or as a file name where the funciton defined in the file has the same name as the file. +argument and have "..." in its argument list. Can be referenced as a function or as a file name where the function defined in the file has the same name as the file. e.g. "cost.txt" has a function named "cost" in it.
diff --git a/docs/reference/calc_ofv_and_grad.html b/docs/reference/calc_ofv_and_grad.html index a10e92ec..d4e01118 100644 --- a/docs/reference/calc_ofv_and_grad.html +++ b/docs/reference/calc_ofv_and_grad.html @@ -53,7 +53,7 @@ - +-calc_ofv_and_grad(x, optxt, opta, model_switch, aa, axt, groupsize, ni, xtopto, - xopto, aopto, bpop, d, sigma, docc_full, poped.db, only_fim = FALSE)+calc_ofv_and_grad(x, optxt, opta, model_switch, aa, axt, groupsize, ni, + xtopto, xopto, aopto, bpop, d, sigma, docc_full, poped.db, + only_fim = FALSE)Arguments
@@ -141,7 +158,7 @@
Arg
groupsize -+ A vector of the numer of individuals in each group.
A vector of the number of individuals in each group.
ni @@ -171,13 +188,13 @@Arg
d -Matrix defining the diagnonals of the IIV (same logic as for the fixed efects +
Matrix defining the diagonals of the IIV (same logic as for the fixed effects matrix bpop to define uncertainty). One can also just supply the parameter values as a
c()
.sigma +can also just supply the diagonal parameter values (variances) as a Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagnonal parameter values (variances) as a
c()
.c()
.@@ -302,7 +335,7 @@ docc_full @@ -203,12 +220,12 @@Value
See also
diff --git a/docs/reference/cell.html b/docs/reference/cell.html index 7d0715d8..e7f873f3 100644 --- a/docs/reference/cell.html +++ b/docs/reference/cell.html @@ -51,7 +51,7 @@Other Optimize:
Doptim
, -LEDoptim
,RS_opt_gen
, -RS_opt
,a_line_search
, -bfgsb_min
,calc_autofocus
, -mfea
,optim_ARS
, -optim_LS
,poped_optim_1
, -poped_optim_2
,poped_optim_3
, +LEDoptim
,RS_opt
, +a_line_search
,bfgsb_min
, +calc_autofocus
,mfea
, +optim_ARS
,optim_LS
, +poped_optim_1
,poped_optim_2
, +poped_optim_3
,poped_optimize
,poped_optim
- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -129,9 +145,9 @@+
See a
+Other MATLAB:
diag_matlab
,feval
,fileparts
,isempty
,ones
, -randn
,randperm
, -rand
,size
, -tic
,toc
,zeros
randn
,rand
, +size
,tic
,toc
, +zeros
Examples
diff --git a/docs/reference/convert_variables.html b/docs/reference/convert_variables.html index 317d769e..306b70a5 100644 --- a/docs/reference/convert_variables.html +++ b/docs/reference/convert_variables.html @@ -54,7 +54,7 @@- +PopED - 0.3.2.9005 + 0.4.0- - + +diff --git a/docs/reference/create.poped.database.html b/docs/reference/create.poped.database.html index 618609dc..4e312df2 100644 --- a/docs/reference/create.poped.database.html +++ b/docs/reference/create.poped.database.html @@ -56,7 +56,7 @@+
- +@@ -116,9 +132,9 @@Create a PopED database
create.poped.database(popedInput = list(), ff_file = NULL, - ff_fun = poped.choose(popedInput$model$ff_pointer, NULL), fg_file = NULL, - fg_fun = poped.choose(popedInput$model$fg_pointer, NULL), - fError_file = NULL, + ff_fun = poped.choose(popedInput$model$ff_pointer, NULL), + fg_file = NULL, fg_fun = poped.choose(popedInput$model$fg_pointer, + NULL), fError_file = NULL, fError_fun = poped.choose(popedInput$model$ferror_pointer, NULL), optsw = poped.choose(popedInput$settings$optsw, cbind(0, 0, 0, 0, 0)), xt = poped.choose(popedInput$design[["xt"]], @@ -135,8 +151,10 @@Create a PopED database
minni = poped.choose(popedInput$design_space$minni, NULL), maxtotni = poped.choose(popedInput$design_space$maxtotni, NULL), mintotni = poped.choose(popedInput$design_space$mintotni, NULL), - maxgroupsize = poped.choose(popedInput$design_space$maxgroupsize, NULL), - mingroupsize = poped.choose(popedInput$design_space$mingroupsize, NULL), + maxgroupsize = poped.choose(popedInput$design_space$maxgroupsize, + NULL), + mingroupsize = poped.choose(popedInput$design_space$mingroupsize, + NULL), maxtotgroupsize = poped.choose(popedInput$design_space$maxtotgroupsize, NULL), mintotgroupsize = poped.choose(popedInput$design_space$mintotgroupsize, @@ -149,21 +167,22 @@Create a PopED database
discrete_a = poped.choose(popedInput$design_space$a_space, NULL), bUseGrouped_xt = poped.choose(popedInput$design_space$bUseGrouped_xt, FALSE), G_xt = poped.choose(popedInput$design_space$G_xt, NULL), - bUseGrouped_a = poped.choose(popedInput$design_space$bUseGrouped_a, FALSE), - G_a = poped.choose(popedInput$design_space$G_a, NULL), - bUseGrouped_x = poped.choose(popedInput$design_space$bUseGrouped_x, FALSE), - G_x = poped.choose(popedInput$design_space[["G_x"]], NULL), + bUseGrouped_a = poped.choose(popedInput$design_space$bUseGrouped_a, + FALSE), G_a = poped.choose(popedInput$design_space$G_a, NULL), + bUseGrouped_x = poped.choose(popedInput$design_space$bUseGrouped_x, + FALSE), G_x = poped.choose(popedInput$design_space[["G_x"]], NULL), iFIMCalculationType = poped.choose(popedInput$settings$iFIMCalculationType, 1), iApproximationMethod = poped.choose(popedInput$settings$iApproximationMethod, 0), iFOCENumInd = poped.choose(popedInput$settings$iFOCENumInd, 1000), - prior_fim = poped.choose(popedInput$settings$prior_fim, matrix(0, 0, 1)), - strAutoCorrelationFile = poped.choose(popedInput$model$auto_pointer, ""), - d_switch = poped.choose(popedInput$settings$d_switch, 1), + prior_fim = poped.choose(popedInput$settings$prior_fim, matrix(0, 0, + 1)), + strAutoCorrelationFile = poped.choose(popedInput$model$auto_pointer, + ""), d_switch = poped.choose(popedInput$settings$d_switch, 1), ofv_calc_type = poped.choose(popedInput$settings$ofv_calc_type, 4), ds_index = popedInput$parameters$ds_index, - strEDPenaltyFile = poped.choose(popedInput$settings$strEDPenaltyFile, ""), - ofv_fun = poped.choose(popedInput$settings$ofv_fun, NULL), + strEDPenaltyFile = poped.choose(popedInput$settings$strEDPenaltyFile, + ""), ofv_fun = poped.choose(popedInput$settings$ofv_fun, NULL), iEDCalculationType = poped.choose(popedInput$settings$iEDCalculationType, 0), ED_samp_size = poped.choose(popedInput$settings$ED_samp_size, 45), bLHS = poped.choose(popedInput$settings$bLHS, 1), @@ -173,25 +192,28 @@Create a PopED database
NumDocc = popedInput$parameters$NumDocc, NumOcc = popedInput$parameters$NumOcc, bpop = poped.choose(popedInput$parameters$bpop, - stop("bpop must be defined")), d = poped.choose(popedInput$parameters$d, - NULL), covd = popedInput$parameters$covd, + stop("bpop must be defined")), + d = poped.choose(popedInput$parameters$d, NULL), + covd = popedInput$parameters$covd, sigma = popedInput$parameters$sigma, docc = poped.choose(popedInput$parameters$docc, matrix(0, 0, 3)), - covdocc = poped.choose(popedInput$parameters$covdocc, zeros(1, length(docc[, - 2, drop = F]) * (length(docc[, 2, drop = F]) - 1)/2)), + covdocc = poped.choose(popedInput$parameters$covdocc, zeros(1, + length(docc[, 2, drop = F]) * (length(docc[, 2, drop = F]) - 1)/2)), notfixed_bpop = popedInput$parameters$notfixed_bpop, notfixed_d = popedInput$parameters$notfixed_d, notfixed_covd = popedInput$parameters$notfixed_covd, notfixed_docc = popedInput$parameters$notfixed_docc, notfixed_covdocc = poped.choose(popedInput$parameters$notfixed_covdocc, zeros(1, length(covdocc))), - notfixed_sigma = poped.choose(popedInput$parameters$notfixed_sigma, t(rep(1, - size(sigma, 2)))), + notfixed_sigma = poped.choose(popedInput$parameters$notfixed_sigma, + t(rep(1, size(sigma, 2)))), notfixed_covsigma = poped.choose(popedInput$parameters$notfixed_covsigma, zeros(1, length(notfixed_sigma) * (length(notfixed_sigma) - 1)/2)), - bUseRandomSearch = poped.choose(popedInput$settings$bUseRandomSearch, TRUE), + bUseRandomSearch = poped.choose(popedInput$settings$bUseRandomSearch, + TRUE), bUseStochasticGradient = poped.choose(popedInput$settings$bUseStochasticGradient, - TRUE), bUseLineSearch = poped.choose(popedInput$settings$bUseLineSearch, + TRUE), + bUseLineSearch = poped.choose(popedInput$settings$bUseLineSearch, TRUE), bUseExchangeAlgorithm = poped.choose(popedInput$settings$bUseExchangeAlgorithm, FALSE), @@ -199,8 +221,9 @@Create a PopED database
FALSE), EACriteria = poped.choose(popedInput$settings$EACriteria, 1), strRunFile = poped.choose(popedInput$settings$run_file_pointer, ""), poped_version = poped.choose(popedInput$settings$poped_version, - packageVersion("PopED")), modtit = poped.choose(popedInput$settings$modtit, - "PopED model"), output_file = poped.choose(popedInput$settings$output_file, + packageVersion("PopED")), + modtit = poped.choose(popedInput$settings$modtit, "PopED model"), + output_file = poped.choose(popedInput$settings$output_file, paste("PopED_output", "_summary", sep = "")), output_function_file = poped.choose(popedInput$settings$output_function_file, paste("PopED", "_output_", sep = "")), @@ -229,30 +252,36 @@Create a PopED database
AbsTol = poped.choose(popedInput$settings$AbsTol, 1e-06), RelTol = poped.choose(popedInput$settings$RelTol, 1e-06), iDiffSolverMethod = poped.choose(popedInput$settings$iDiffSolverMethod, - NULL), bUseMemorySolver = poped.choose(popedInput$settings$bUseMemorySolver, + NULL), + bUseMemorySolver = poped.choose(popedInput$settings$bUseMemorySolver, FALSE), rsit = poped.choose(popedInput$settings[["rsit"]], 300), sgit = poped.choose(popedInput$settings[["sgit"]], 150), intrsit = poped.choose(popedInput$settings$intrsit, 250), intsgit = poped.choose(popedInput$settings$intsgit, 50), maxrsnullit = poped.choose(popedInput$settings$maxrsnullit, 50), - convergence_eps = poped.choose(popedInput$settings$convergence_eps, 1e-08), - rslxt = poped.choose(popedInput$settings$rslxt, 10), + convergence_eps = poped.choose(popedInput$settings$convergence_eps, + 1e-08), rslxt = poped.choose(popedInput$settings$rslxt, 10), rsla = poped.choose(popedInput$settings$rsla, 10), cfaxt = poped.choose(popedInput$settings$cfaxt, 0.001), cfaa = poped.choose(popedInput$settings$cfaa, 0.001), - bGreedyGroupOpt = poped.choose(popedInput$settings$bGreedyGroupOpt, FALSE), - EAStepSize = poped.choose(popedInput$settings$EAStepSize, 0.01), - EANumPoints = poped.choose(popedInput$settings$EANumPoints, FALSE), + bGreedyGroupOpt = poped.choose(popedInput$settings$bGreedyGroupOpt, + FALSE), EAStepSize = poped.choose(popedInput$settings$EAStepSize, + 0.01), EANumPoints = poped.choose(popedInput$settings$EANumPoints, + FALSE), EAConvergenceCriteria = poped.choose(popedInput$settings$EAConvergenceCriteria, - 1e-20), bEANoReplicates = poped.choose(popedInput$settings$bEANoReplicates, + 1e-20), + bEANoReplicates = poped.choose(popedInput$settings$bEANoReplicates, FALSE), BFGSConvergenceCriteriaMinStep = NULL, BFGSProjectedGradientTol = poped.choose(popedInput$settings$BFGSProjectedGradientTol, - 1e-04), BFGSTolerancef = poped.choose(popedInput$settings$BFGSTolerancef, - 0.001), BFGSToleranceg = poped.choose(popedInput$settings$BFGSToleranceg, - 0.9), BFGSTolerancex = poped.choose(popedInput$settings$BFGSTolerancex, - 0.1), ED_diff_it = poped.choose(popedInput$settings$ED_diff_it, 30), - ED_diff_percent = poped.choose(popedInput$settings$ED_diff_percent, 10), - line_search_it = poped.choose(popedInput$settings$ls_step_size, 50), + 1e-04), + BFGSTolerancef = poped.choose(popedInput$settings$BFGSTolerancef, + 0.001), + BFGSToleranceg = poped.choose(popedInput$settings$BFGSToleranceg, 0.9), + BFGSTolerancex = poped.choose(popedInput$settings$BFGSTolerancex, 0.1), + ED_diff_it = poped.choose(popedInput$settings$ED_diff_it, 30), + ED_diff_percent = poped.choose(popedInput$settings$ED_diff_percent, + 10), line_search_it = poped.choose(popedInput$settings$ls_step_size, + 50), Doptim_iter = poped.choose(popedInput$settings$iNumSearchIterationsIfNotLineSearch, 1), iCompileOption = poped.choose(popedInput$settings$parallel$iCompileOption, @@ -261,7 +290,8 @@Create a PopED database
1), MCC_Dep = NULL, strExecuteName = poped.choose(popedInput$settings$parallel$strExecuteName, "calc_fim.exe"), - iNumProcesses = poped.choose(popedInput$settings$parallel$iNumProcesses, 2), + iNumProcesses = poped.choose(popedInput$settings$parallel$iNumProcesses, + 2), iNumChunkDesignEvals = poped.choose(popedInput$settings$parallel$iNumChunkDesignEvals, -2), strMatFileInputPrefix = poped.choose(popedInput$settings$parallel$strMatFileInputPrefix, @@ -274,10 +304,13 @@Create a PopED database
0.1), strFunctionInputName = poped.choose(popedInput$settings$parallel$strFunctionInputName, "function_input"), - bParallelRS = poped.choose(popedInput$settings$parallel$bParallelRS, FALSE), - bParallelSG = poped.choose(popedInput$settings$parallel$bParallelSG, FALSE), + bParallelRS = poped.choose(popedInput$settings$parallel$bParallelRS, + FALSE), + bParallelSG = poped.choose(popedInput$settings$parallel$bParallelSG, + FALSE), bParallelMFEA = poped.choose(popedInput$settings$parallel$bParallelMFEA, - FALSE), bParallelLS = poped.choose(popedInput$settings$parallel$bParallelLS, + FALSE), + bParallelLS = poped.choose(popedInput$settings$parallel$bParallelLS, FALSE))Arguments
@@ -292,7 +325,7 @@Arg
ff_file
- -
******START OF MODEL DEFINITION OPTIONS**********
A string giving the function name or filname and path of the structural model. +
A string giving the function name or filename and path of the structural model. The filename and the function name must be the same if giving a filename. e.g.
"ff.PK.1.comp.oral.md.KE"
Arg
fg_file -A string giving the function name or filname and path of the +
@@ -313,7 +346,7 @@ A string giving the function name or filename and path of the parameter model. The filename and the function name must be the same if giving a filename. e.g.
"parameter.model"
Arg
fError_file -A string giving the function name or filname and path of the +
@@ -337,7 +370,7 @@ A string giving the function name or filename and path of the residual error model. The filename and the function name must be the same if giving a filename. e.g.
"feps.prop"
.Arg
Matrix defining the initial sampling schedule. Each row is a group/individual. If only one vector is supplied, e.g.
+have the same initial design.c(1,2,3,4)
, then all groups will -have the same inital design.m @@ -362,7 +395,7 @@Arg
groupsize +If only one number then the number will be the same in every group. Vector defining the size of the different groups (num individuals in each group). -If only one numer then the number will be the same in every group.
ni @@ -488,7 +521,7 @@Arg
iFOCENumInd -+ Num indivduals in each step of FOCE
Num individuals in each step of FOCE
prior_fim @@ -496,14 +529,14 @@Arg
strAutoCorrelationFile -Filname and path, or function name, for the Autocorrelation function, +
Filename and path, or function name, for the Autocorrelation function, empty string means no autocorrelation.
d_switch +
- -
******START OF CRITERION SPECIFICATION OPTIONS**********
D-family design (1) or ED-familty design (0) (with or without parameter uncertainty)
D-family design (1) or ED-family design (0) (with or without parameter uncertainty)
ofv_calc_type @@ -532,7 +565,7 @@Arg
ofv_fun User defined function used to compute the objective function. The function must have a poped database object as its first -argument and have "..." in its argument list. Can be referenced as a function or as a file name where the funciton defined in the file has the same name as the file. +argument and have "..." in its argument list. Can be referenced as a function or as a file name where the function defined in the file has the same name as the file. e.g. "cost.txt" has a function named "cost" in it.
@@ -551,7 +584,7 @@ Arg
strUserDistributionFile -+ Filname and path, or function name, for user defined distributions for E-family designs
Filename and path, or function name, for user defined distributions for E-family designs
nbpop @@ -569,7 +602,7 @@Arg
NumOcc -+ Number of occassions. Typically can be computed from other values and not supplied.
Number of occasions. Typically can be computed from other values and not supplied.
bpop @@ -583,7 +616,7 @@Arg
d -Matrix defining the diagnonals of the IIV (same logic as for the fixed efects +
Matrix defining the diagonals of the IIV (same logic as for the fixed effects matrix bpop to define uncertainty). One can also just supply the parameter values as a
c()
.@@ -594,7 +627,7 @@ Arg
sigma +can also just supply the diagonal parameter values (variances) as a Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagnonal parameter values (variances) as a
c()
.c()
.docc @@ -677,11 +710,11 @@Arg
output_file -+ Filname and path of the output file during search
Filename and path of the output file during search
output_function_file -+ Filname suffix of the result function file
Filename suffix of the result function file
strIterationFileName @@ -690,7 +723,7 @@Arg
user_data -
- +
******START OF Miscelaneous SPECIFICATION OPTIONS**********
******START OF Miscellaneous SPECIFICATION OPTIONS**********
User defined data structure that, for example could be used to send in data to the model
@@ -812,7 +845,7 @@ Arg
convergence_eps -Stoachstic Gradient convergence value, +
Stochastic Gradient convergence value, (difference in OFV for D-optimal, difference in gradient for ED-optimal)
@@ -919,11 +952,11 @@ Arg
strMatFileInputPrefix -+ The prefix of the input mat file to communicate with the excutable
The prefix of the input mat file to communicate with the executable
Mat_Out_Pre -+ The prefix of the output mat file to communicate with the excutable
The prefix of the output mat file to communicate with the executable
strExtraRunOptions diff --git a/docs/reference/create_design.html b/docs/reference/create_design.html index 9a85d6bb..270e367b 100644 --- a/docs/reference/create_design.html +++ b/docs/reference/create_design.html @@ -55,7 +55,7 @@- +-PopED - 0.3.2.9005 + 0.4.0- - + +@@ -113,8 +129,8 @@+
Create design variables for a full description of a design.
create_design(xt, groupsize, m = NULL, x = NULL, a = NULL, ni = NULL, - model_switch = NULL)+create_design(xt, groupsize, m = NULL, x = NULL, a = NULL, + ni = NULL, model_switch = NULL)Arguments
@@ -153,7 +169,7 @@
Arg
Details
-If a value (or a vector/list of values) is supplied that correponds to only one group and the design has +
If a value (or a vector/list of values) is supplied that corresponds to only one group and the design has multiple groups then all groups will have the same value(s). If a matrix is expected then a list of lists can be supplied instead, each list corresponding to a group.
diff --git a/docs/reference/create_design_space.html b/docs/reference/create_design_space.html index b4df52f8..56d7cd74 100644 --- a/docs/reference/create_design_space.html +++ b/docs/reference/create_design_space.html @@ -6,7 +6,7 @@ -Create design variables and a design space for a full decription of an optimization problem. — create_design_space • PopED +Create design variables and a design space for a full description of an optimization problem. — create_design_space • PopED @@ -30,7 +30,7 @@ - +- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -100,7 +116,7 @@+
--@@ -117,13 +133,14 @@Create design variables and a design space for a full decription of an optimization problem.
+Create design variables and a design space for a full description of an optimization problem.
create_design_space.Rd
Create design variables and a design space for a full decription of an optim
create_design_space(design, maxni = NULL, minni = NULL, maxtotni = NULL, - mintotni = NULL, maxgroupsize = NULL, mingroupsize = NULL, - maxtotgroupsize = NULL, mintotgroupsize = NULL, maxxt = NULL, - minxt = NULL, xt_space = NULL, maxa = NULL, mina = NULL, - a_space = NULL, x_space = NULL, use_grouped_xt = FALSE, - grouped_xt = NULL, use_grouped_a = FALSE, grouped_a = NULL, - use_grouped_x = FALSE, grouped_x = NULL, our_zero = NULL)+create_design_space(design, maxni = NULL, minni = NULL, + maxtotni = NULL, mintotni = NULL, maxgroupsize = NULL, + mingroupsize = NULL, maxtotgroupsize = NULL, + mintotgroupsize = NULL, maxxt = NULL, minxt = NULL, + xt_space = NULL, maxa = NULL, mina = NULL, a_space = NULL, + x_space = NULL, use_grouped_xt = FALSE, grouped_xt = NULL, + use_grouped_a = FALSE, grouped_a = NULL, use_grouped_x = FALSE, + grouped_x = NULL, our_zero = NULL)Arguments
@@ -235,7 +252,7 @@
Arg
Details
-If a value (or a vector or a list of values) is supplied that correponds to only one group and the design has +
If a value (or a vector or a list of values) is supplied that corresponds to only one group and the design has multiple groups then all groups will have the same value(s). If a matrix is expected then a list of lists can be supplied instead, each list corresponding to a group.
diff --git a/docs/reference/design_summary.html b/docs/reference/design_summary.html index 023db0e7..ba283e7f 100644 --- a/docs/reference/design_summary.html +++ b/docs/reference/design_summary.html @@ -51,7 +51,7 @@- +PopED - 0.3.2.9005 + 0.4.0- - + +diff --git a/docs/reference/diag_matlab.html b/docs/reference/diag_matlab.html index 76888fd8..dbe3a4a6 100644 --- a/docs/reference/diag_matlab.html +++ b/docs/reference/diag_matlab.html @@ -56,7 +56,7 @@+
- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -136,10 +152,8 @@+
See a
+Other MATLAB:
-cell
,feval
,fileparts
,isempty
,ones
,randn
, -randperm
,rand
, -size
,tic
,toc
, -zeros
Other matrix_manipulation:
test_for_zeros
rand
,size
, +tic
,toc
,zeros
Examples
diff --git a/docs/reference/downsizing_general_design.html b/docs/reference/downsizing_general_design.html index e6623dfd..d61fe861 100644 --- a/docs/reference/downsizing_general_design.html +++ b/docs/reference/downsizing_general_design.html @@ -33,7 +33,7 @@ +variables and rescues the design so that a FIM can be calculated using mftot." /> @@ -52,7 +52,7 @@- +diff --git a/docs/reference/ed_laplace_ofv.html b/docs/reference/ed_laplace_ofv.html index f1d097fb..ca03df8c 100644 --- a/docs/reference/ed_laplace_ofv.html +++ b/docs/reference/ed_laplace_ofv.html @@ -37,7 +37,7 @@ +defined in the PopED database or as arguments to the function." /> @@ -56,7 +56,7 @@-PopED - 0.3.2.9005 + 0.4.0- - + +@@ -103,7 +119,7 @@+
Downsize a general design to a specific design
@@ -137,76 +153,6 @@Function takes a design with potentially empty design -variables and resuces the design so that a FIM can be calculated using
+variables and rescues the design so that a FIM can be calculated usingmftot
.mftot
.See a
create_design
,poped.choose
Examples
-library(PopED) - -############# START ################# -## Create PopED database -## (warfarin model for optimization) -##################################### - -## Warfarin example from software comparison in: -## Nyberg et al., "Methods and software tools for design evaluation -## for population pharmacokinetics-pharmacodynamics studies", -## Br. J. Clin. Pharm., 2014. - -## Optimization using an additive + proportional reidual error -## to avoid sample times at very low concentrations (time 0 or very late samples). - -## find the parameters that are needed to define from the structural model -ff.PK.1.comp.oral.sd.CL#> function(model_switch,xt,parameters,poped.db){ -#> ##-- Model: One comp first order absorption -#> with(as.list(parameters),{ -#> y=xt -#> y=(DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt)) -#> return(list( y= y,poped.db=poped.db)) -#> }) -#> } -#> <environment: namespace:PopED>-## -- parameter definition function -## -- names match parameters in function ff -sfg <- function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) -} - -## -- Define initial design and design space -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=sfg, - fError_fun=feps.add.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=c(0.01,0.25), - groupsize=32, - xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0.01, - maxxt=120, - a=70, - mina=0.01, - maxa=100) - -############# END ################### -## Create PopED database -## (warfarin model for optimization) -##################################### - - -dgd <- downsizing_general_design(poped.db) - -output = mftot(dgd$model_switch,poped.db$design$groupsize, - dgd$ni,dgd$xt,dgd$x,dgd$a, - poped.db$parameters$param.pt.val$bpop, - poped.db$parameters$param.pt.val$d, - poped.db$parameters$param.pt.val$sigma, - poped.db$parameters$param.pt.val$docc, - poped.db) -FIM <- output$ret -det(FIM)#> [1] 1.143859e+24- +-PopED - 0.3.2.9005 + 0.4.0- - + +@@ -110,14 +126,14 @@+
Evaluate the expectation of determinant the Fisher Information Matrix (FIM)
Compute the expectation of the
+defined in the PopED database or as arguments to the function.det(FIM)
using the Laplace approximation to the expectation. Computations are made based on the model, parameters, distributions of parameter uncertainty, design and methods -defined in the PopED database or as arguments to the funciton.ed_laplace_ofv(model_switch, groupsize, ni, xtopto, xopto, aopto, bpopdescr, - ddescr, covd, sigma, docc, poped.db, method = 1, return_gradient = FALSE, - optxt = poped.db$settings$optsw[2], opta = poped.db$settings$optsw[4], - x = c())+ed_laplace_ofv(model_switch, groupsize, ni, xtopto, xopto, aopto, + bpopdescr, ddescr, covd, sigma, docc, poped.db, method = 1, + return_gradient = FALSE, optxt = poped.db$settings$optsw[2], + opta = poped.db$settings$optsw[4], x = c())Arguments
@@ -128,7 +144,7 @@
Arg
groupsize -+ A vector of the numer of individuals in each group.
A vector of the number of individuals in each group.
ni @@ -160,7 +176,7 @@Arg
ddescr -Matrix defining the diagnonals of the IIV (same logic as for +
Matrix defining the diagonals of the IIV (same logic as for the
bpopdescr
).@@ -171,7 +187,7 @@ Arg
sigma +can also just supply the diagonal parameter values (variances) as a Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagnonal parameter values (variances) as a
c()
.c()
.docc @@ -293,7 +309,7 @@Examp ## ED evaluate using LaPlace approximation tic() -output <- evaluate.e.ofv.fim(poped.db.n,use_laplace=TRUE)
#> Error in poped.db$settings$iEDCalculationType <- use_laplace: object 'poped.db.n' not foundtoc()#> Elapsed time: 0.002 seconds.output$E_ofv#> Error in eval(expr, envir, enclos): object 'output' not found#> Error in poped.db$settings$iEDCalculationType <- use_laplace: object 'poped.db.n' not foundtoc()#> Elapsed time: 0.001 seconds.output$E_ofv#> Error in eval(expr, envir, enclos): object 'output' not found# NOT RUN { diff --git a/docs/reference/ed_mftot.html b/docs/reference/ed_mftot.html index 35b727c4..25981481 100644 --- a/docs/reference/ed_mftot.html +++ b/docs/reference/ed_mftot.html @@ -52,7 +52,7 @@- +-PopED - 0.3.2.9005 + 0.4.0- - + +@@ -107,8 +123,8 @@+
Evaluate the expectation of the Fisher Information Matrix (FIM) and the expe
ed_mftot(model_switch, groupsize, ni, xtoptn, xoptn, aoptn, bpopdescr, ddescr, - covd, sigma, docc, poped.db, calc_fim = TRUE)+ed_mftot(model_switch, groupsize, ni, xtoptn, xoptn, aoptn, bpopdescr, + ddescr, covd, sigma, docc, poped.db, calc_fim = TRUE)Arguments
@@ -119,7 +135,7 @@
Arg
groupsize -+ A vector of the numer of individuals in each group.
A vector of the number of individuals in each group.
ni @@ -151,7 +167,7 @@Arg
ddescr -Matrix defining the diagnonals of the IIV (same logic as for +
Matrix defining the diagonals of the IIV (same logic as for the
bpopdescr
).@@ -162,7 +178,7 @@ Arg
sigma +can also just supply the diagonal parameter values (variances) as a Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagnonal parameter values (variances) as a
c()
.c()
.docc @@ -284,7 +300,7 @@Examp sigma=poped.db$parameters$sigma, docc=poped.db$parameters$docc, poped.db)["ED_ofv"]
#> $ED_ofv -#> [1] 55.42294 +#> [1] 55.38781 #>diff --git a/docs/reference/efficiency.html b/docs/reference/efficiency.html index 56991bdb..c72efd05 100644 --- a/docs/reference/efficiency.html +++ b/docs/reference/efficiency.html @@ -51,7 +51,7 @@- +PopED - 0.3.2.9005 + 0.4.0- - + +diff --git a/docs/reference/evaluate.e.ofv.fim.html b/docs/reference/evaluate.e.ofv.fim.html index 9ee26ce1..e3288b3a 100644 --- a/docs/reference/evaluate.e.ofv.fim.html +++ b/docs/reference/evaluate.e.ofv.fim.html @@ -54,7 +54,7 @@+
- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -115,12 +131,13 @@+
Evaluate the expectation of the Fisher Information Matrix (FIM) and the expe bpop = poped.db$parameters$bpop, d = poped.db$parameters$d, covd = poped.db$parameters$covd, docc = poped.db$parameters$docc, sigma = poped.db$parameters$sigma, model_switch = NULL, ni = NULL, - xt = NULL, x = NULL, a = NULL, groupsize = poped.db$design$groupsize, - deriv.type = NULL, bLHS = poped.db$settings$bLHS, + xt = NULL, x = NULL, a = NULL, + groupsize = poped.db$design$groupsize, deriv.type = NULL, + bLHS = poped.db$settings$bLHS, ofv_calc_type = poped.db$settings$ofv_calc_type, ED_samp_size = poped.db$settings$ED_samp_size, - use_laplace = poped.db$settings$iEDCalculationType, laplace.fim = FALSE, - ...) + use_laplace = poped.db$settings$iEDCalculationType, + laplace.fim = FALSE, ...)
Arguments
@@ -139,7 +156,7 @@
Arg
3 = Not currently used.
+(NOTE: NONMEM estimates the variance of the residual unexplained variation by default). 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the resudual unexplained variation by default).
5 = Full FIM parameterized with A,B,C matrices & derivative of variance.
6 = Calculate one model switch at a time, good for large matrices.
@@ -157,7 +174,7 @@ 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.
Arg
d -Matrix defining the diagnonals of the IIV (same logic as for the fixed efects +
Matrix defining the diagonals of the IIV (same logic as for the fixed effects matrix bpop to define uncertainty). One can also just supply the parameter values as a
c()
.@@ -172,7 +189,7 @@ Arg
sigma +can also just supply the diagonal parameter values (variances) as a Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagnonal parameter values (variances) as a
c()
.c()
.model_switch @@ -196,7 +213,7 @@Arg
groupsize -+ A vector of the numer of individuals in each group.
A vector of the number of individuals in each group.
deriv.type @@ -235,7 +252,7 @@Arg
laplace.fim +is done using the standard MC integration technique, so can be slow. Should an E(FIM) be calculated when computing the Laplace approximated E(OFV). Typically the FIM does not need to be computed and, if desired, this calculation -is done usng the standard MC integration technique, so can be slow.
... @@ -337,14 +354,14 @@Examp ## ED evaluate (with very few samples) output <- evaluate.e.ofv.fim(poped.db,ED_samp_size=10) -output$E_ofv
#> [1] 55.42235+output$E_ofv#> [1] 55.42935## API evaluate (with very few samples) output <- evaluate.e.ofv.fim(poped.db,ED_samp_size=10,ofv_calc_type=4) -output$E_ofv#> [1] 55.3025+output$E_ofv#> [1] 55.38759## ED evaluate using Laplace approximation tic() output <- evaluate.e.ofv.fim(poped.db,use_laplace=TRUE) -toc()#> Elapsed time: 1.038 seconds.output$E_ofv#> [1] 1.302806e+24+toc()#> Elapsed time: 1.04 seconds.output$E_ofv#> [1] 1.302806e+24# NOT RUN { ## ED expected value with more precision. ## Compare time and value to Laplace approximation. diff --git a/docs/reference/evaluate.fim.html b/docs/reference/evaluate.fim.html index d420e36f..8a947951 100644 --- a/docs/reference/evaluate.fim.html +++ b/docs/reference/evaluate.fim.html @@ -54,7 +54,7 @@- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -112,9 +128,10 @@+
Evaluate the Fisher Information Matrix (FIM)
evaluate.fim(poped.db, fim.calc.type = NULL, approx.method = NULL, - FOCE.num = NULL, bpop.val = NULL, d_full = NULL, docc_full = NULL, - sigma_full = NULL, model_switch = NULL, ni = NULL, xt = NULL, - x = NULL, a = NULL, groupsize = NULL, deriv.type = NULL, ...)+ FOCE.num = NULL, bpop.val = NULL, d_full = NULL, + docc_full = NULL, sigma_full = NULL, model_switch = NULL, + ni = NULL, xt = NULL, x = NULL, a = NULL, groupsize = NULL, + deriv.type = NULL, ...)Arguments
@@ -133,7 +150,7 @@
Arg
3 = Not currently used.
+(NOTE: NONMEM estimates the variance of the residual unexplained variation by default). 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the resudual unexplained variation by default).
5 = Full FIM parameterized with A,B,C matrices & derivative of variance.
6 = Calculate one model switch at a time, good for large matrices.
@@ -145,7 +162,7 @@ 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.
Arg
FOCE.num -+ Number indivduals in each step of FOCE approximation method
Number individuals in each step of FOCE approximation method
bpop.val @@ -185,7 +202,7 @@Arg
groupsize -+ A vector of the numer of individuals in each group.
A vector of the number of individuals in each group.
deriv.type @@ -276,18 +293,18 @@Examp ## evaluate initial design with the reduced FIM FIM.1 <- evaluate.fim(poped.db)
#> Error in evaluate.fim(poped.db): object 'poped.db' not foundFIM.1#> Error in eval(expr, envir, enclos): object 'FIM.1' not founddet(FIM.1)#> Error in determinant(x, logarithm = TRUE, ...): object 'FIM.1' not found#> Error in size(...): object 'poped.db' not found## evaluate initial design with the full FIM -FIM.0 <- evaluate.fim(poped.db,fim.calc.type=0)#> Error in evaluate.fim(poped.db, fim.calc.type = 0): object 'poped.db' not foundFIM.0#> Error in eval(expr, envir, enclos): object 'FIM.0' not founddet(FIM.0)#> Error in determinant(x, logarithm = TRUE, ...): object 'FIM.0' not found#> Error in poped.db$settings$iFIMCalculationType <- fim.calc.type: object 'poped.db' not found+FIM.0 <- evaluate.fim(poped.db,fim.calc.type=0)#> Error in evaluate.fim(poped.db, fim.calc.type = 0): object 'poped.db' not foundFIM.0#> Error in eval(expr, envir, enclos): object 'FIM.0' not founddet(FIM.0)#> Error in determinant(x, logarithm = TRUE, ...): object 'FIM.0' not found#> Error in size(...): object 'poped.db' not found## evaluate initial design with the reduced FIM ## computing all derivatives with respect to the ## standard deviation of the residual unexplained variation -FIM.4 <- evaluate.fim(poped.db,fim.calc.type=4)#> Error in evaluate.fim(poped.db, fim.calc.type = 4): object 'poped.db' not foundFIM.4#> Error in eval(expr, envir, enclos): object 'FIM.4' not founddet(FIM.4)#> Error in determinant(x, logarithm = TRUE, ...): object 'FIM.4' not found#> Error in poped.db$settings$iFIMCalculationType <- fim.calc.type: object 'poped.db' not found+FIM.4 <- evaluate.fim(poped.db,fim.calc.type=4)#> Error in evaluate.fim(poped.db, fim.calc.type = 4): object 'poped.db' not foundFIM.4#> Error in eval(expr, envir, enclos): object 'FIM.4' not founddet(FIM.4)#> Error in determinant(x, logarithm = TRUE, ...): object 'FIM.4' not found#> Error in size(...): object 'poped.db' not found## evaluate initial design with the full FIM with A,B,C matricies ## should give same answer as fim.calc.type=0 -FIM.5 <- evaluate.fim(poped.db,fim.calc.type=5)#> Error in evaluate.fim(poped.db, fim.calc.type = 5): object 'poped.db' not foundFIM.5#> Error in eval(expr, envir, enclos): object 'FIM.5' not founddet(FIM.5)#> Error in determinant(x, logarithm = TRUE, ...): object 'FIM.5' not found#> Error in poped.db$settings$iFIMCalculationType <- fim.calc.type: object 'poped.db' not found+FIM.5 <- evaluate.fim(poped.db,fim.calc.type=5)#> Error in evaluate.fim(poped.db, fim.calc.type = 5): object 'poped.db' not foundFIM.5#> Error in eval(expr, envir, enclos): object 'FIM.5' not founddet(FIM.5)#> Error in determinant(x, logarithm = TRUE, ...): object 'FIM.5' not found#> Error in size(...): object 'poped.db' not found## evaluate initial design with the reduced FIM with ## A,B,C matricies and derivative of variance ## should give same answer as fim.calc.type=1 (default) -FIM.7 <- evaluate.fim(poped.db,fim.calc.type=7)#> Error in evaluate.fim(poped.db, fim.calc.type = 7): object 'poped.db' not foundFIM.7#> Error in eval(expr, envir, enclos): object 'FIM.7' not founddet(FIM.7)#> Error in determinant(x, logarithm = TRUE, ...): object 'FIM.7' not found#> Error in poped.db$settings$iFIMCalculationType <- fim.calc.type: object 'poped.db' not found+FIM.7 <- evaluate.fim(poped.db,fim.calc.type=7)#> Error in evaluate.fim(poped.db, fim.calc.type = 7): object 'poped.db' not foundFIM.7#> Error in eval(expr, envir, enclos): object 'FIM.7' not founddet(FIM.7)#> Error in determinant(x, logarithm = TRUE, ...): object 'FIM.7' not found#> Error in size(...): object 'poped.db' not found## evaluate FIM and rse with prior FIM.1 poped.db.prior = create.poped.database(poped.db, prior_fim = FIM.1)#> Error in poped.choose(popedInput$settings$poped_version, packageVersion("PopED")): object 'poped.db' not foundFIM.1.prior <- evaluate.fim(poped.db.prior)#> Error in evaluate.fim(poped.db.prior): object 'poped.db.prior' not foundall.equal(FIM.1.prior,FIM.1) # the FIM is only computed from the design in the poped.db#> Error in all.equal(FIM.1.prior, FIM.1): object 'FIM.1.prior' not found#> Error in size(...): object 'poped.db.prior' not founddiff --git a/docs/reference/evaluate_design.html b/docs/reference/evaluate_design.html index 70bcb94d..0911bd98 100644 --- a/docs/reference/evaluate_design.html +++ b/docs/reference/evaluate_design.html @@ -32,7 +32,7 @@ - + @@ -51,7 +51,7 @@- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -101,7 +117,7 @@+
Evaluate a design
-diff --git a/docs/reference/evaluate_power-1.png b/docs/reference/evaluate_power-1.png index c8b69576..a40ea6e5 100644 Binary files a/docs/reference/evaluate_power-1.png and b/docs/reference/evaluate_power-1.png differ diff --git a/docs/reference/evaluate_power-2.png b/docs/reference/evaluate_power-2.png index aa56c97a..a8ecf49f 100644 Binary files a/docs/reference/evaluate_power-2.png and b/docs/reference/evaluate_power-2.png differ diff --git a/docs/reference/evaluate_power.html b/docs/reference/evaluate_power.html index ffe76c21..6acbf233 100644 --- a/docs/reference/evaluate_power.html +++ b/docs/reference/evaluate_power.html @@ -6,8 +6,7 @@ -This tunction evaluates the design defined in a poped database.
+This function evaluates the design defined in a poped database.
Evaluate power of a design for detecting a parameter to be non-zero using the -linear Wald test. — evaluate_power • PopED +Power of a design to estimate a parameter. — evaluate_power • PopED @@ -31,10 +30,11 @@ - + - + @@ -53,7 +53,7 @@- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -96,20 +112,21 @@+
-Evaluate power of a design for detecting a parameter to be non-zero using the -linear Wald test.
+Power of a design to estimate a parameter.
evaluate_power.Rd
--This tunction evaluates the design defined in a poped database.
+Evaluate the power of a design to estimate a parameter value different than +some assumed value (often the assumed value is zero). The power is calculated +using the linear Wald test and the the design is defined in a poped database.
evaluate_power(poped.db, bpopIdx = NULL, fim = NULL, out = NULL, - alpha = 0.05, power = 80, twoSided = TRUE, find_min_n = TRUE, ...)+evaluate_power(poped.db, bpop_idx, h0 = 0, alpha = 0.05, power = 0.8, + twoSided = TRUE, find_min_n = TRUE, fim = NULL, out = NULL, ...)Arguments
@@ -119,35 +136,40 @@
Arg
A poped database
- bpopIdx -+ Indices for unfixed parameters for which power should be -evaluated for being non-zero
bpop_idx +Index for an unfixed population parameter (bpop) for +which the power should be +evaluated for being different than the null hypothesis (h0).
- -fim -- Optional to provide FIM from a previous calculation
- out -+ Optional to provide output from a previous calculation (e.g., -calc_ofv_and_fim, ...)
h0 +The null hypothesized value for the parameter.
alpha -+ Type 1 error (default = 0.05)
Type 1 error.
power -+ Targeted power (default = 80%)
Targeted power.
twoSided -+ Is two-sided test (default = TRUE)
Is this a two-sided test.
+ find_min_n + Should the function compute the minimum n needed (given the current design) to achieve the desired power?
+ +fim ++ Provide the FIM from a previous calculation
+ out +provide output from a previous calculation (e.g., +calc_ofv_and_fim, ...)
... @@ -294,7 +316,7 @@Examp #> D[3,3] D[4,4] SIGMA[1,1] #> 10.2946079 10.3325269 7.0480558 #>
-evaluate_power(poped.db_2,bpopIdx = 4)#> $ofv +evaluate_power(poped.db_2,bpop_idx = 4)#> $ofv #> [1] 74.54742 #> #> $fim @@ -328,8 +350,8 @@Examp #> 10.2946079 10.3325269 7.0480558 #> #> $power -#> Value RSE predPower wantPower needRSE min_N -#> bpop[4] 0.262 29.99483 91.5 80 35.69408 142 +#> Value RSE power_pred power_want need_rse min_N +#> bpop[4] 0.262 29.99483 91.52704 80 35.69408 142 #>
diff --git a/docs/reference/extract_norm_group_fim.html b/docs/reference/extract_norm_group_fim.html index d55cad56..a80f413e 100644 --- a/docs/reference/extract_norm_group_fim.html +++ b/docs/reference/extract_norm_group_fim.html @@ -51,7 +51,7 @@- +PopED - 0.3.2.9005 + 0.4.0- - + +diff --git a/docs/reference/feps.add-1.png b/docs/reference/feps.add-1.png index f3cd6b71..c28ed7ed 100644 Binary files a/docs/reference/feps.add-1.png and b/docs/reference/feps.add-1.png differ diff --git a/docs/reference/feps.add.html b/docs/reference/feps.add.html index 621654fb..03c73942 100644 --- a/docs/reference/feps.add.html +++ b/docs/reference/feps.add.html @@ -55,7 +55,7 @@+
- +PopED - 0.3.2.9005 + 0.4.0- - + +diff --git a/docs/reference/feps.add.prop-1.png b/docs/reference/feps.add.prop-1.png index ca08a39e..5569f6df 100644 Binary files a/docs/reference/feps.add.prop-1.png and b/docs/reference/feps.add.prop-1.png differ diff --git a/docs/reference/feps.add.prop.html b/docs/reference/feps.add.prop.html index f8aa489a..6dc57f91 100644 --- a/docs/reference/feps.add.prop.html +++ b/docs/reference/feps.add.prop.html @@ -55,7 +55,7 @@+
- +PopED - 0.3.2.9005 + 0.4.0- - + +diff --git a/docs/reference/feps.prop-1.png b/docs/reference/feps.prop-1.png index f3cd6b71..c28ed7ed 100644 Binary files a/docs/reference/feps.prop-1.png and b/docs/reference/feps.prop-1.png differ diff --git a/docs/reference/feps.prop.html b/docs/reference/feps.prop.html index ea615435..a6634978 100644 --- a/docs/reference/feps.prop.html +++ b/docs/reference/feps.prop.html @@ -55,7 +55,7 @@+
- +PopED - 0.3.2.9005 + 0.4.0- - + +diff --git a/docs/reference/feval.html b/docs/reference/feval.html index fb63ae3b..47101543 100644 --- a/docs/reference/feval.html +++ b/docs/reference/feval.html @@ -51,7 +51,7 @@+
- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -129,9 +145,9 @@+
See a
+Other MATLAB:
cell
,diag_matlab
,fileparts
,isempty
,ones
, -randn
,randperm
, -rand
,size
, -tic
,toc
,zeros
randn
,rand
, +size
,tic
,toc
, +zeros
Examples
diff --git a/docs/reference/ff.PK.1.comp.oral.md.CL-1.png b/docs/reference/ff.PK.1.comp.oral.md.CL-1.png index ca08a39e..5569f6df 100644 Binary files a/docs/reference/ff.PK.1.comp.oral.md.CL-1.png and b/docs/reference/ff.PK.1.comp.oral.md.CL-1.png differ diff --git a/docs/reference/ff.PK.1.comp.oral.md.CL.html b/docs/reference/ff.PK.1.comp.oral.md.CL.html index cc2e68a2..2cf864af 100644 --- a/docs/reference/ff.PK.1.comp.oral.md.CL.html +++ b/docs/reference/ff.PK.1.comp.oral.md.CL.html @@ -54,7 +54,7 @@- +PopED - 0.3.2.9005 + 0.4.0- - + +diff --git a/docs/reference/ff.PK.1.comp.oral.md.KE-1.png b/docs/reference/ff.PK.1.comp.oral.md.KE-1.png index ca08a39e..5569f6df 100644 Binary files a/docs/reference/ff.PK.1.comp.oral.md.KE-1.png and b/docs/reference/ff.PK.1.comp.oral.md.KE-1.png differ diff --git a/docs/reference/ff.PK.1.comp.oral.md.KE.html b/docs/reference/ff.PK.1.comp.oral.md.KE.html index f4d9f0d2..53eaabac 100644 --- a/docs/reference/ff.PK.1.comp.oral.md.KE.html +++ b/docs/reference/ff.PK.1.comp.oral.md.KE.html @@ -54,7 +54,7 @@+
- +PopED - 0.3.2.9005 + 0.4.0- - + +diff --git a/docs/reference/ff.PK.1.comp.oral.sd.CL-1.png b/docs/reference/ff.PK.1.comp.oral.sd.CL-1.png index f3cd6b71..c28ed7ed 100644 Binary files a/docs/reference/ff.PK.1.comp.oral.sd.CL-1.png and b/docs/reference/ff.PK.1.comp.oral.sd.CL-1.png differ diff --git a/docs/reference/ff.PK.1.comp.oral.sd.CL.html b/docs/reference/ff.PK.1.comp.oral.sd.CL.html index 5b73bb0b..4962e75f 100644 --- a/docs/reference/ff.PK.1.comp.oral.sd.CL.html +++ b/docs/reference/ff.PK.1.comp.oral.sd.CL.html @@ -54,7 +54,7 @@+
- +PopED - 0.3.2.9005 + 0.4.0- - + +diff --git a/docs/reference/ff.PK.1.comp.oral.sd.KE-1.png b/docs/reference/ff.PK.1.comp.oral.sd.KE-1.png index f3cd6b71..c28ed7ed 100644 Binary files a/docs/reference/ff.PK.1.comp.oral.sd.KE-1.png and b/docs/reference/ff.PK.1.comp.oral.sd.KE-1.png differ diff --git a/docs/reference/ff.PK.1.comp.oral.sd.KE.html b/docs/reference/ff.PK.1.comp.oral.sd.KE.html index 6230d25d..3632bf8c 100644 --- a/docs/reference/ff.PK.1.comp.oral.sd.KE.html +++ b/docs/reference/ff.PK.1.comp.oral.sd.KE.html @@ -54,7 +54,7 @@+
- +PopED - 0.3.2.9005 + 0.4.0- - + +diff --git a/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax-1.png b/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax-1.png index 6694aef2..c2e3980d 100644 Binary files a/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax-1.png and b/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax-1.png differ diff --git a/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax.html b/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax.html index e0ced5e4..f09b4e78 100644 --- a/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax.html +++ b/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax.html @@ -6,8 +6,8 @@ -+
Structural model: one-compartment, oral absoprtion, multiple bolus dose, -parameterized using CL driving an inhibitory IMAX model with a direct efect. — ff.PKPD.1.comp.oral.md.CL.imax • PopED +Structural model: one-compartment, oral absorption, multiple bolus dose, +parameterized using CL driving an inhibitory IMAX model with a direct effect. — ff.PKPD.1.comp.oral.md.CL.imax • PopED @@ -31,8 +31,8 @@ - +- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -98,8 +114,8 @@+
-diff --git a/docs/reference/ff.PKPD.1.comp.sd.CL.emax-1.png b/docs/reference/ff.PKPD.1.comp.sd.CL.emax-1.png index c074c6e7..ca11b29e 100644 Binary files a/docs/reference/ff.PKPD.1.comp.sd.CL.emax-1.png and b/docs/reference/ff.PKPD.1.comp.sd.CL.emax-1.png differ diff --git a/docs/reference/ff.PKPD.1.comp.sd.CL.emax.html b/docs/reference/ff.PKPD.1.comp.sd.CL.emax.html index ac4a3ff9..6232d6f6 100644 --- a/docs/reference/ff.PKPD.1.comp.sd.CL.emax.html +++ b/docs/reference/ff.PKPD.1.comp.sd.CL.emax.html @@ -6,7 +6,7 @@ -Structural model: one-compartment, oral absoprtion, multiple bolus dose, -parameterized using CL driving an inhibitory IMAX model with a direct efect.
+Structural model: one-compartment, oral absorption, multiple bolus dose, +parameterized using CL driving an inhibitory IMAX model with a direct effect.
ff.PKPD.1.comp.oral.md.CL.imax.Rd
Structural model: one-compartment, single bolus IV dose, parameterized using CL driving an EMAX model with a direct efect. — ff.PKPD.1.comp.sd.CL.emax • PopED +Structural model: one-compartment, single bolus IV dose, parameterized using CL driving an EMAX model with a direct effect. — ff.PKPD.1.comp.sd.CL.emax • PopED @@ -30,7 +30,7 @@ - +- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -96,7 +112,7 @@+
-diff --git a/docs/reference/fileparts.html b/docs/reference/fileparts.html index 3ea71189..4dc1ea80 100644 --- a/docs/reference/fileparts.html +++ b/docs/reference/fileparts.html @@ -51,7 +51,7 @@Structural model: one-compartment, single bolus IV dose, parameterized using CL driving an EMAX model with a direct efect.
+Structural model: one-compartment, single bolus IV dose, parameterized using CL driving an EMAX model with a direct effect.
ff.PKPD.1.comp.sd.CL.emax.Rd
- +PopED - 0.3.2.9005 + 0.4.0- - + +@@ -133,9 +149,9 @@+
See a
+Other MATLAB:
cell
,diag_matlab
,feval
,isempty
,ones
, -randn
,randperm
, -rand
,size
, -tic
,toc
,zeros
randn
,rand
, +size
,tic
,toc
, +zeros
Examples
diff --git a/docs/reference/getTruncatedNormal.html b/docs/reference/getTruncatedNormal.html index e6e04215..5adb0f04 100644 --- a/docs/reference/getTruncatedNormal.html +++ b/docs/reference/getTruncatedNormal.html @@ -51,7 +51,7 @@- +diff --git a/docs/reference/get_all_params.html b/docs/reference/get_all_params.html index e5095a78..335c0e8c 100644 --- a/docs/reference/get_all_params.html +++ b/docs/reference/get_all_params.html @@ -51,7 +51,7 @@PopED - 0.3.2.9005 + 0.4.0- - + +@@ -128,7 +144,7 @@+
Value
Examples
getTruncatedNormal(mean=3,variance=100)#> [,1] -#> [1,] 6.757687+#> [1,] 5.082729