From c41381a961263c28d60976e68923157916c78b15 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 16 Sep 2021 15:31:13 +0200 Subject: Adapt and improve the dimethenamid vignette Adapt to the corrected data and unify control parameters for saemix and nlmixr with saem. Update docs --- vignettes/web_only/.build.timestamp | 0 vignettes/web_only/dimethenamid_2018.R | 116 ++++++++++ vignettes/web_only/dimethenamid_2018.html | 250 +++++++++++---------- vignettes/web_only/dimethenamid_2018.rmd | 248 ++++++++++---------- .../figure-html/f_parent_mkin_dfop_const-1.png | Bin 60693 -> 58963 bytes .../f_parent_mkin_dfop_const_test-1.png | Bin 60929 -> 59123 bytes .../figure-html/f_parent_mkin_dfop_tc_test-1.png | Bin 62234 -> 60654 bytes .../figure-html/f_parent_mkin_sfo_const-1.png | Bin 58445 -> 57222 bytes .../f_parent_nlmixr_saem_dfop_const-1.png | Bin 92167 -> 87338 bytes .../figure-html/f_parent_nlmixr_saem_dfop_tc-1.png | Bin 76934 -> 81506 bytes .../f_parent_nlmixr_saem_sfo_const-1.png | Bin 62426 -> 72547 bytes .../figure-html/f_parent_nlmixr_saem_sfo_tc-1.png | Bin 70230 -> 73363 bytes .../figure-html/f_parent_saemix_dfop_const-1.png | Bin 41208 -> 38179 bytes .../f_parent_saemix_dfop_const_moreiter-1.png | Bin 39456 -> 0 bytes .../figure-html/f_parent_saemix_dfop_tc-1.png | Bin 31646 -> 30583 bytes .../f_parent_saemix_dfop_tc_moreiter-1.png | Bin 32077 -> 0 bytes .../figure-html/f_parent_saemix_sfo_const-1.png | Bin 35758 -> 34645 bytes .../figure-html/f_parent_saemix_sfo_tc-1.png | Bin 30708 -> 28683 bytes .../f_parent_saemix_sfo_tc_moreiter-1.png | Bin 30416 -> 0 bytes .../figure-html/plot_parent_nlme-1.png | Bin 60491 -> 59533 bytes 20 files changed, 384 insertions(+), 230 deletions(-) delete mode 100644 vignettes/web_only/.build.timestamp create mode 100644 vignettes/web_only/dimethenamid_2018.R delete mode 100644 vignettes/web_only/dimethenamid_2018_files/figure-html/f_parent_saemix_dfop_const_moreiter-1.png delete mode 100644 vignettes/web_only/dimethenamid_2018_files/figure-html/f_parent_saemix_dfop_tc_moreiter-1.png delete mode 100644 vignettes/web_only/dimethenamid_2018_files/figure-html/f_parent_saemix_sfo_tc_moreiter-1.png (limited to 'vignettes/web_only') diff --git a/vignettes/web_only/.build.timestamp b/vignettes/web_only/.build.timestamp deleted file mode 100644 index e69de29b..00000000 diff --git a/vignettes/web_only/dimethenamid_2018.R b/vignettes/web_only/dimethenamid_2018.R new file mode 100644 index 00000000..2c01bc14 --- /dev/null +++ b/vignettes/web_only/dimethenamid_2018.R @@ -0,0 +1,116 @@ +## ---- include = FALSE--------------------------------------------------------- +require(knitr) +options(digits = 5) +opts_chunk$set( + comment = "", + tidy = FALSE, + cache = TRUE +) + +## ----saemix_control----------------------------------------------------------- +library(saemix) +saemix_control <- saemixControl(nbiter.saemix = c(800, 200), nb.chains = 15, + print = FALSE, save = FALSE, save.graphs = FALSE, displayProgress = FALSE) + +## ----f_parent_saemix_sfo_const, results = 'hide', dependson = "saemix_control"---- +f_parent_saemix_sfo_const <- mkin::saem(f_parent_mkin_const["SFO", ], quiet = TRUE, + control = saemix_control, transformations = "saemix") +plot(f_parent_saemix_sfo_const$so, plot.type = "convergence") + +## ----f_parent_saemix_sfo_tc, results = 'hide', dependson = "saemix_control"---- +f_parent_saemix_sfo_tc <- mkin::saem(f_parent_mkin_tc["SFO", ], quiet = TRUE, + control = saemix_control, transformations = "saemix") +plot(f_parent_saemix_sfo_tc$so, plot.type = "convergence") + +## ----f_parent_saemix_dfop_const, results = 'hide', dependson = "saemix_control"---- +f_parent_saemix_dfop_const <- mkin::saem(f_parent_mkin_const["DFOP", ], quiet = TRUE, + control = saemix_control, transformations = "saemix") +plot(f_parent_saemix_dfop_const$so, plot.type = "convergence") + +## ----f_parent_saemix_dfop_tc, results = 'hide', dependson = "saemix_control"---- +f_parent_saemix_dfop_tc <- mkin::saem(f_parent_mkin_tc["DFOP", ], quiet = TRUE, + control = saemix_control, transformations = "saemix") +plot(f_parent_saemix_dfop_tc$so, plot.type = "convergence") + +## ----AIC_parent_saemix-------------------------------------------------------- +compare.saemix( + f_parent_saemix_sfo_const$so, + f_parent_saemix_sfo_tc$so, + f_parent_saemix_dfop_const$so, + f_parent_saemix_dfop_tc$so) + +## ----AIC_parent_saemix_methods------------------------------------------------ +f_parent_saemix_dfop_tc$so <- + llgq.saemix(f_parent_saemix_dfop_tc$so) +AIC(f_parent_saemix_dfop_tc$so) +AIC(f_parent_saemix_dfop_tc$so, method = "gq") +AIC(f_parent_saemix_dfop_tc$so, method = "lin") + +## ----f_parent_nlmixr_focei, results = "hide", message = FALSE, warning = FALSE---- +library(nlmixr) +f_parent_nlmixr_focei_sfo_const <- nlmixr(f_parent_mkin_const["SFO", ], est = "focei") +f_parent_nlmixr_focei_sfo_tc <- nlmixr(f_parent_mkin_tc["SFO", ], est = "focei") +f_parent_nlmixr_focei_dfop_const <- nlmixr(f_parent_mkin_const["DFOP", ], est = "focei") +f_parent_nlmixr_focei_dfop_tc<- nlmixr(f_parent_mkin_tc["DFOP", ], est = "focei") + +## ----AIC_parent_nlmixr_focei-------------------------------------------------- +aic_nlmixr_focei <- sapply( + list(f_parent_nlmixr_focei_sfo_const$nm, f_parent_nlmixr_focei_sfo_tc$nm, + f_parent_nlmixr_focei_dfop_const$nm, f_parent_nlmixr_focei_dfop_tc$nm), + AIC) + +## ----AIC_parent_nlme_rep------------------------------------------------------ +aic_nlme <- sapply( + list(f_parent_nlme_sfo_const, NA, f_parent_nlme_sfo_tc, f_parent_nlme_dfop_tc), + function(x) if (is.na(x[1])) NA else AIC(x)) +aic_nlme_nlmixr_focei <- data.frame( + "Degradation model" = c("SFO", "SFO", "DFOP", "DFOP"), + "Error model" = rep(c("constant variance", "two-component"), 2), + "AIC (nlme)" = aic_nlme, + "AIC (nlmixr with FOCEI)" = aic_nlmixr_focei, + check.names = FALSE +) + +## ----nlmixr_saem_control------------------------------------------------------ +nlmixr_saem_control <- saemControl(logLik = TRUE, + nBurn = 800, nEm = 200, nmc = 15) + +## ----f_parent_nlmixr_saem_sfo_const, results = "hide", warning = FALSE, message = FALSE, dependson = "nlmixr_saem_control"---- +f_parent_nlmixr_saem_sfo_const <- nlmixr(f_parent_mkin_const["SFO", ], est = "saem", + control = nlmixr_saem_control) +traceplot(f_parent_nlmixr_saem_sfo_const$nm) + +## ----f_parent_nlmixr_saem_sfo_tc, results = "hide", warning = FALSE, message = FALSE, dependson = "nlmixr_saem_control"---- +f_parent_nlmixr_saem_sfo_tc <- nlmixr(f_parent_mkin_tc["SFO", ], est = "saem", + control = nlmixr_saem_control) +traceplot(f_parent_nlmixr_saem_sfo_tc$nm) + +## ----f_parent_nlmixr_saem_dfop_const, results = "hide", warning = FALSE, message = FALSE, dependson = "nlmixr_saem_control"---- +f_parent_nlmixr_saem_dfop_const <- nlmixr(f_parent_mkin_const["DFOP", ], est = "saem", + control = nlmixr_saem_control) +traceplot(f_parent_nlmixr_saem_dfop_const$nm) + +## ----f_parent_nlmixr_saem_dfop_tc, results = "hide", warning = FALSE, message = FALSE, dependson = "nlmixr_saem_control"---- +f_parent_nlmixr_saem_dfop_tc <- nlmixr(f_parent_mkin_tc["DFOP", ], est = "saem", + control = nlmixr_saem_control) +traceplot(f_parent_nlmixr_saem_dfop_tc$nm) + +## ----AIC_parent_nlmixr_saem--------------------------------------------------- +AIC(f_parent_nlmixr_saem_sfo_const$nm, f_parent_nlmixr_saem_sfo_tc$nm, + f_parent_nlmixr_saem_dfop_const$nm, f_parent_nlmixr_saem_dfop_tc$nm) + +## ----AIC_all------------------------------------------------------------------ +AIC_all <- data.frame( + check.names = FALSE, + "Degradation model" = c("SFO", "SFO", "DFOP", "DFOP"), + "Error model" = c("const", "tc", "const", "tc"), + nlme = c(AIC(f_parent_nlme_sfo_const), AIC(f_parent_nlme_sfo_tc), NA, AIC(f_parent_nlme_dfop_tc)), + nlmixr_focei = sapply(list(f_parent_nlmixr_focei_sfo_const$nm, f_parent_nlmixr_focei_sfo_tc$nm, + f_parent_nlmixr_focei_dfop_const$nm, f_parent_nlmixr_focei_dfop_tc$nm), AIC), + saemix = sapply(list(f_parent_saemix_sfo_const$so, f_parent_saemix_sfo_tc$so, + f_parent_saemix_dfop_const$so, f_parent_saemix_dfop_tc$so), AIC), + nlmixr_saem = sapply(list(f_parent_nlmixr_saem_sfo_const$nm, f_parent_nlmixr_saem_sfo_tc$nm, + f_parent_nlmixr_saem_dfop_const$nm, f_parent_nlmixr_saem_dfop_tc$nm), AIC) +) +kable(AIC_all) + diff --git a/vignettes/web_only/dimethenamid_2018.html b/vignettes/web_only/dimethenamid_2018.html index df8200eb..aa1905da 100644 --- a/vignettes/web_only/dimethenamid_2018.html +++ b/vignettes/web_only/dimethenamid_2018.html @@ -27,11 +27,8 @@ document.addEventListener('DOMContentLoaded', function(e) { } }); -