poped_optimize {PopED} | R Documentation |
Retired optimization module for PopED
Description
This function is an older version of poped_optim
. Please use poped_optim
unless you have a specific reason to use this function instead.
Usage
poped_optimize(
poped.db,
ni = NULL,
xt = NULL,
model_switch = NULL,
x = NULL,
a = NULL,
bpop = NULL,
d = 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],
opt_samps = poped.db$settings$optsw[1],
opt_inds = poped.db$settings$optsw[5],
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,
ofv_calc_type = poped.db$settings$ofv_calc_type,
approx_type = poped.db$settings$iApproximationMethod,
bUseExchangeAlgorithm = poped.db$settings$bUseExchangeAlgorithm,
iter = 1,
d_switch = poped.db$settings$d_switch,
ED_samp_size = poped.db$settings$ED_samp_size,
bLHS = poped.db$settings$bLHS,
use_laplace = poped.db$settings$iEDCalculationType,
...
)
Arguments
poped.db |
A PopED database. |
ni |
A vector of the number of samples in each group. |
xt |
A matrix of sample times. Each row is a vector of sample times for a group. |
model_switch |
A matrix that is the same size as xt, specifying which model each sample belongs to. |
x |
A matrix for the discrete design variables. Each row is a group. |
a |
A matrix of covariates. Each row is a group. |
bpop |
Matrix defining the fixed effects, per row (row number = parameter_number) we should have:
Can also just supply the parameter values as a vector |
d |
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 |
maxxt |
Matrix or single value defining the maximum value for each xt sample. If a single value is supplied then all xt values are given the same maximum value. |
minxt |
Matrix or single value defining the minimum value for each xt sample. If a single value is supplied then all xt values are given the same minimum value |
maxa |
Vector defining the max value for each covariate. If a single value is supplied then all a values are given the same max value |
mina |
Vector defining the min value for each covariate. If a single value is supplied then all a values are given the same max value |
fmf |
The initial value of the FIM. If set to zero then it is computed. |
dmf |
The initial OFV. If set to zero then it is computed. |
trflag |
Should the optimization be output to the screen and to a file? |
opt_xt |
Should the sample times be optimized? |
opt_a |
Should the continuous design variables be optimized? |
opt_x |
Should the discrete design variables be optimized? |
opt_samps |
Are the number of sample times per group being optimized? |
opt_inds |
Are the number of individuals per group being optimized? |
cfaxt |
First step factor for sample times |
cfaa |
Stochastic Gradient search first step factor for covariates |
rsit |
Number of Random search iterations |
rsit_output |
Number of iterations in random search between screen output |
fim.calc.type |
The method used for calculating the FIM. Potential values:
|
ofv_calc_type |
OFV calculation type for FIM
|
approx_type |
Approximation method for model, 0=FO, 1=FOCE, 2=FOCEI, 3=FOI. |
bUseExchangeAlgorithm |
Use Exchange algorithm (1=TRUE, 0=FALSE) |
iter |
The number of iterations entered into the |
d_switch |
D-family design (1) or ED-family design (0) (with or without parameter uncertainty) |
ED_samp_size |
Sample size for E-family sampling |
bLHS |
How to sample from distributions in E-family calculations. 0=Random Sampling, 1=LatinHyperCube – |
use_laplace |
Should the Laplace method be used in calculating the expectation of the OFV? |
... |
arguments passed to other functions. See |
Details
This function optimized the objective function. 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. Some of the arguments coming from the PopED database can be overwritten; if they are supplied then they are used instead of the arguments from the PopED database.
References
M. Foracchia, A.C. Hooker, P. Vicini and A. Ruggeri, "PopED, a software fir optimal experimental design in population kinetics", Computer Methods and Programs in Biomedicine, 74, 2004.
J. Nyberg, S. Ueckert, E.A. Stroemberg, S. Hennig, M.O. Karlsson and A.C. Hooker, "PopED: An extended, parallelized, nonlinear mixed effects models optimal design tool", Computer Methods and Programs in Biomedicine, 108, 2012.
See Also
Other Optimize:
Doptim()
,
LEDoptim()
,
RS_opt()
,
a_line_search()
,
bfgsb_min()
,
calc_autofocus()
,
calc_ofv_and_grad()
,
mfea()
,
optim_ARS()
,
optim_LS()
,
poped_optim_1()
,
poped_optim_2()
,
poped_optim_3()
,
poped_optim()
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
## -- 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(prop=0.01,add=0.25),
groupsize=32,
xt=c( 0.5,1,2,6,24,36,72,120),
minxt=0.01,
maxxt=120,
a=c(DOSE=70),
mina=c(DOSE=0.01),
maxa=c(DOSE=100))
############# END ###################
## Create PopED database
## (warfarin model for optimization)
#####################################
##############
# D-family Optimization
##############
# below are a number of ways to optimize the problem
# RS+SG+LS optimization of DOSE and sample times
# optimization with just a few iterations
# only to check that things are working
out_1 <- poped_optimize(poped.db,opt_a=TRUE,opt_xt=TRUE,
rsit=2,sgit=2,ls_step_size=2,
iter_max=1,out_file = "")
## Not run:
# RS+SG+LS optimization of sample times
# (longer run time than above but more likely to reach a maximum)
output <- poped_optimize(poped.db,opt_xt=T)
get_rse(output$fmf,output$poped.db)
plot_model_prediction(output$poped.db)
# MFEA optimization with only integer times allowed
mfea.output <- poped_optimize(poped.db,opt_xt=1,
bUseExchangeAlgorithm=1,
EAStepSize=1)
get_rse(mfea.output$fmf,mfea.output$poped.db)
plot_model_prediction(mfea.output$poped.db)
# Examine efficiency of sampling windows
plot_efficiency_of_windows(mfea.output$poped.db,xt_windows=0.5)
plot_efficiency_of_windows(mfea.output$poped.db,xt_windows=1)
# Random search (just a few samples here)
rs.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,rsit=20,
bUseRandomSearch= 1,
bUseStochasticGradient = 0,
bUseBFGSMinimizer = 0,
bUseLineSearch = 0)
get_rse(rs.output$fmf,rs.output$poped.db)
# line search, DOSE and sample time optimization
ls.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,
bUseRandomSearch= 0,
bUseStochasticGradient = 0,
bUseBFGSMinimizer = 0,
bUseLineSearch = 1,
ls_step_size=10)
# Stochastic gradient search, DOSE and sample time optimization
sg.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,
bUseRandomSearch= 0,
bUseStochasticGradient = 1,
bUseBFGSMinimizer = 0,
bUseLineSearch = 0,
sgit=20)
# BFGS search, DOSE and sample time optimization
bfgs.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,
bUseRandomSearch= 0,
bUseStochasticGradient = 0,
bUseBFGSMinimizer = 1,
bUseLineSearch = 0)
##############
# E-family Optimization
##############
# 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
## -- Define initial design and design space
poped.db <- create.poped.database(ff_file="ff.PK.1.comp.oral.sd.CL",
fg_file="sfg",
fError_file="feps.add.prop",
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,
maxxt=120,
a=70,
mina=0,
maxa=100)
# ED optimization using Random search (just a few samples here)
output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,rsit=10,d_switch=0)
get_rse(output$fmf,output$poped.db)
# ED with laplace approximation,
# optimization using Random search (just a few samples here)
output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,rsit=10,
d_switch=0,use_laplace=TRUE,laplace.fim=TRUE)
get_rse(output$fmf,output$poped.db)
## End(Not run)