From b8bce66adc60673d02b7f74d986f7bfca0e9a9bb Mon Sep 17 00:00:00 2001 From: Matthew Fidler Date: Thu, 12 Sep 2024 15:11:11 -0500 Subject: [PATCH] Imply Ds optimality when using important/unimportant flagging --- R/poped.R | 4 ++++ inst/poped/ex.2.d.warfarin.ED.babelmixr2.R | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/R/poped.R b/R/poped.R index 87a6bdc9..f032ad66 100644 --- a/R/poped.R +++ b/R/poped.R @@ -2566,6 +2566,10 @@ popedControl <- function(stickyRecalcN=4, grad_all_switch <- match.arg(grad_all_switch) grad_all_switch <- c("central"=1, "complex"=0)[grad_all_switch] } + if (missing(ofv_calc_type) && (!missing(important) || !missing(unimportant))) { + .minfo("Using Ds-optimality for PopED") + ofv_calc_type <- "Ds" + } if (!checkmate::testIntegerish(ofv_calc_type, len=1, lower=1, upper=7)) { ofv_calc_type <- match.arg(ofv_calc_type) ofv_calc_type <- c("lnD"=4, "d"=1, "a"=2, "Ds"=6, "inverse"=7)[ofv_calc_type] diff --git a/inst/poped/ex.2.d.warfarin.ED.babelmixr2.R b/inst/poped/ex.2.d.warfarin.ED.babelmixr2.R index c367528c..f4431e78 100644 --- a/inst/poped/ex.2.d.warfarin.ED.babelmixr2.R +++ b/inst/poped/ex.2.d.warfarin.ED.babelmixr2.R @@ -69,11 +69,20 @@ babel.db <- create.poped.database(babel.db, bpop=bpop_vals_ed, ## increase ED_samp_size for a more accurate calculation tic();evaluate_design(babel.db,d_switch=FALSE,ED_samp_size=20); toc() +## Note that this is a simulation procedure so each time you run it +## you may get different results + +## Also note that babelmixr2 values are similar + +## $rse +## CL V KA d_CL d_V d_KA SIGMA[1,1] SIGMA[2,2] +## 4.991010 2.977982 14.014207 29.802546 36.711408 26.754059 31.477157 25.297312 + ## optimization with line search search output_ls <- poped_optim(babel.db, opt_xt=T, parallel=T, method = "LS", d_switch=F, ED_samp_size=20) -## Fixme: -## laplace does not seem to work with babelmixr2 +## laplace does not seem to work with babelmixr2 or example: +## See ## ED: E(det(FIM)) using Laplace approximation ## deterministic calculation, relatively fast