From b7901aac76df753ec1213cb02bebea055965ee87 Mon Sep 17 00:00:00 2001
From: Ranke Johannes Last change 16 January 2018
-(rebuilt 2023-05-19)
+(rebuilt 2023-10-30)
Source: vignettes/web_only/FOCUS_Z.rmd
FOCUS_Z.rmd
26 February 2019 (rebuilt
-2023-05-19)
+2023-10-30)
Source: vignettes/web_only/NAFTA_examples.rmd
NAFTA_examples.rmd
Last change 17 February 2023
-(rebuilt 2023-05-19)
+(rebuilt 2023-10-30)
Source: vignettes/web_only/benchmarks.rmd
benchmarks.rmd
Constant variance (t1) and two-component error model (t2) for four models fitted to two datasets, i.e. eight fits for each test.
-OS | CPU | @@ -433,6 +444,22 @@ models fitted to two datasets, i.e. eight fits for each test.1.386 | 1.960 | ||
---|---|---|---|---|---|
Linux | +Intel(R) Xeon(R) Gold 6134 CPU @ 3.20GHz | +4.3.1 | +1.2.5 | +2.369 | +3.632 | +
Linux | +Intel(R) Xeon(R) Gold 6134 CPU @ 3.20GHz | +4.3.1 | +1.2.6 | +2.856 | +4.960 | +
OS | CPU | @@ -669,6 +705,24 @@ for each test.2.080 | 1.106 | |||
---|---|---|---|---|---|---|
Linux | +Intel(R) Xeon(R) Gold 6134 CPU @ 3.20GHz | +4.3.1 | +1.2.5 | +1.823 | +5.555 | +2.404 | +
Linux | +Intel(R) Xeon(R) Gold 6134 CPU @ 3.20GHz | +4.3.1 | +1.2.6 | +1.761 | +5.405 | +2.462 | +
Constant variance (t6 and t7), two-component error model (t8 and t9), and variance by variable (t10 and t11) for one model fitted to one dataset, i.e. one fit for each test.
-OS | @@ -992,6 +1046,30 @@ dataset, i.e. one fit for each test.0.712 | 0.948 | |||||||
---|---|---|---|---|---|---|---|---|---|
Linux | +Intel(R) Xeon(R) Gold 6134 CPU @ 3.20GHz | +4.3.1 | +1.2.5 | +0.798 | +1.096 | +1.217 | +3.173 | +1.634 | +2.271 | +
Linux | +Intel(R) Xeon(R) Gold 6134 CPU @ 3.20GHz | +4.3.1 | +1.2.6 | +0.813 | +1.136 | +1.220 | +3.114 | +1.598 | +2.255 | +
vignettes/web_only/compiled_models.rmd
compiled_models.rmd
mkinmod()
function
checks for presence of a compiler using
-pkgbuild::has_compiler()
pkgbuild::has_compiler()
In previous versions, it used Sys.which("gcc")
for this
check.
On Linux, you need to have the essential build tools like make and @@ -213,10 +216,10 @@ solution is also implemented, which is included in the tests below.
print("R package rbenchmark is not available") }## test replications relative elapsed
-## 4 analytical 1 1.000 0.099
-## 3 deSolve, compiled 1 1.303 0.129
-## 2 Eigenvalue based 1 1.697 0.168
-## 1 deSolve, not compiled 1 21.475 2.126
+## 4 analytical 1 1.000 0.213
+## 3 deSolve, compiled 1 1.418 0.302
+## 2 Eigenvalue based 1 2.000 0.426
+## 1 deSolve, not compiled 1 23.535 5.013
We see that using the compiled model is by more than a factor of 10 faster than using deSolve without compiled code.
@@ -247,15 +250,15 @@ compiled code is available. }## Temporary DLL for differentials generated and loaded
## test replications relative elapsed
-## 2 deSolve, compiled 1 1.000 0.165
-## 1 deSolve, not compiled 1 22.673 3.741
-Here we get a performance benefit of a factor of 23 using the version +## 2 deSolve, compiled 1 1.000 0.492 +## 1 deSolve, not compiled 1 20.398 10.036 +
Here we get a performance benefit of a factor of 20 using the version of the differential equation model compiled from C code!
-This vignette was built with mkin 1.2.4 on
-## R version 4.3.0 Patched (2023-05-18 r84448)
+This vignette was built with mkin 1.2.6 on
+## R version 4.3.1 (2023-06-16)
## Platform: x86_64-pc-linux-gnu (64-bit)
-## Running under: Debian GNU/Linux 12 (bookworm)
-## CPU model: AMD Ryzen 9 7950X 16-Core Processor
+## Running under: Ubuntu 22.04.3 LTS
+## CPU model: Intel(R) Xeon(R) Gold 6134 CPU @ 3.20GHz
diff --git a/docs/articles/web_only/dimethenamid_2018.html b/docs/articles/web_only/dimethenamid_2018.html
index a89631a2..1cffd561 100644
--- a/docs/articles/web_only/dimethenamid_2018.html
+++ b/docs/articles/web_only/dimethenamid_2018.html
@@ -33,7 +33,7 @@
@@ -73,6 +73,9 @@
vignettes/web_only/dimethenamid_2018.rmd
dimethenamid_2018.rmd
plot(mixed(f_parent_mkin_const["SFO", ]))
Using biexponential decline (DFOP) results in a slightly more random scatter of the residuals:
+plot(mixed(f_parent_mkin_const["DFOP", ]))
The population curve (bold line) in the above plot results from taking the mean of the individual transformed parameters, i.e. of log k1 @@ -239,7 +242,7 @@ dominates the average. This is alleviated if only rate constants that pass the t-test for significant difference from zero (on the untransformed scale) are considered in the averaging:
+plot(mixed(f_parent_mkin_const["DFOP", ]), test_log_parms = TRUE)
While this is visually much more satisfactory, such an average procedure could introduce a bias, as not all results from the individual @@ -251,7 +254,7 @@ degradation model and the error model (see below).
predicted residues is reduced by using the two-component error model: +plot(mixed(f_parent_mkin_tc["DFOP", ]), test_log_parms = TRUE)
However, note that in the case of using this error model, the fits to the Flaach and BBA 2.3 datasets appear to be ill-defined, indicated by @@ -263,7 +266,7 @@ Status of individual fits: dataset model Calke Borstel Flaach BBA 2.2 BBA 2.3 Elliot - DFOP OK OK C OK C OK + DFOP OK OK OK OK C OK C: Optimisation did not converge: iteration limit reached without convergence (10) @@ -319,7 +322,7 @@ indicates that this difference is significant as the p-value is below
Model df AIC BIC logLik Test L.Ratio p-value
f_parent_nlme_sfo_const 1 5 796.60 811.82 -393.30
f_parent_nlme_sfo_tc 2 6 798.60 816.86 -393.30 1 vs 2 0.00 0.998
-f_parent_nlme_dfop_tc 3 10 671.91 702.34 -325.96 2 vs 3 134.69 <.0001
+f_parent_nlme_dfop_tc 3 10 671.91 702.34 -325.95 2 vs 3 134.69 <.0001
In addition to these fits, attempts were also made to include correlations between random effects by using the log Cholesky parameterisation of the matrix specifying them. The code used for these @@ -341,7 +344,7 @@ effects does not improve the fits.
The selected model (DFOP with two-component error) fitted to the data assuming no correlations between random effects is shown below.
-plot(f_parent_nlme_dfop_tc)
plot(f_parent_nlme_dfop_tc)
-library(saemix)
-saemix_control <- saemixControl(nbiter.saemix = c(800, 300), nb.chains = 15,
+library(saemix)
Loading required package: npde
+Package saemix, version 3.2
+ please direct bugs, questions and feedback to emmanuelle.comets@inserm.fr
+
+Attaching package: 'saemix'
+The following objects are masked from 'package:npde':
+
+ kurtosis, skewness
+
+saemix_control <- saemixControl(nbiter.saemix = c(800, 300), nb.chains = 15,
print = FALSE, save = FALSE, save.graphs = FALSE, displayProgress = FALSE)
saemix_control_moreiter <- saemixControl(nbiter.saemix = c(1600, 300), nb.chains = 15,
print = FALSE, save = FALSE, save.graphs = FALSE, displayProgress = FALSE)
@@ -367,7 +379,7 @@ well for all the parent data fits shown in this vignette.
print = FALSE, save = FALSE, save.graphs = FALSE, displayProgress = FALSE)
The convergence plot for the SFO model using constant variance is shown below.
-+@@ -375,19 +387,19 @@ shown below.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")
Obviously the selected number of iterations is sufficient to reach convergence. This can also be said for the SFO fit using the two-component error model.
-+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")
When fitting the DFOP model with constant variance (see below), parameter convergence is not as unambiguous.
-+-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")
+print(f_parent_saemix_dfop_const)
+SD.k2 0.03296 -2.50524 2.5712 +SD.g 1.10266 0.32354 1.8818Kinetic nonlinear mixed-effects model fit by SAEM Structural model: @@ -408,11 +420,11 @@ DMTA_0 97.99583 96.50079 99.4909 k1 0.06377 0.03432 0.0932 k2 0.00848 0.00444 0.0125 g 0.95701 0.91313 1.0009 -a.1 1.82141 1.65122 1.9916 -SD.DMTA_0 1.64787 0.45772 2.8380 +a.1 1.82141 1.60516 2.0377 +SD.DMTA_0 1.64787 0.45729 2.8384 SD.k1 0.57439 0.24731 0.9015 -SD.k2 0.03296 -2.50195 2.5679 -SD.g 1.10266 0.32369 1.8816
While the other parameters converge to credible values, the variance of k2 (
also observe that the estimated variance of k2 becomes very small, while being ill-defined, as illustrated by the excessive confidence interval ofomega2.k2
) converges to a very small value. The printout of thesaem.mmkin
model shows that the estimated @@ -423,14 +435,14 @@ this model.SD.k2
. -+-f_parent_saemix_dfop_tc <- mkin::saem(f_parent_mkin_tc["DFOP", ], quiet = TRUE, control = saemix_control, transformations = "saemix") f_parent_saemix_dfop_tc_moreiter <- mkin::saem(f_parent_mkin_tc["DFOP", ], quiet = TRUE, control = saemix_control_moreiter, transformations = "saemix") plot(f_parent_saemix_dfop_tc$so, plot.type = "convergence")
+print(f_parent_saemix_dfop_tc)
+ estimate lower upper +DMTA_0 98.24165 96.29190 100.1914 +k1 0.06421 0.03352 0.0949 +k2 0.00866 0.00617 0.0111 +g 0.95340 0.91218 0.9946 +a.1 1.06463 0.86503 1.2642 +b.1 0.02964 0.02259 0.0367 +SD.DMTA_0 2.03611 0.40416 3.6681 +SD.k1 0.59534 0.25692 0.9338 +SD.k2 0.00042 -73.01372 73.0146 +SD.g 1.04234 0.37189 1.7128Kinetic nonlinear mixed-effects model fit by SAEM Structural model: @@ -446,17 +458,17 @@ Likelihood computed by importance sampling 666 664 -323 Fitted parameters: - estimate lower upper -DMTA_0 98.27617 96.3088 100.2436 -k1 0.06437 0.0337 0.0950 -k2 0.00880 0.0063 0.0113 -g 0.95249 0.9100 0.9949 -a.1 1.06161 0.8625 1.2607 -b.1 0.02967 0.0226 0.0367 -SD.DMTA_0 2.06075 0.4187 3.7028 -SD.k1 0.59357 0.2561 0.9310 -SD.k2 0.00292 -10.2960 10.3019 -SD.g 1.05725 0.3808 1.7337
Doubling the number of iterations in the first phase of the algorithm leads to a slightly lower likelihood, and therefore to slightly higher AIC and BIC values. With even more iterations, the algorithm stops with @@ -472,7 +484,7 @@ message.
The four combinations (SFO/const, SFO/tc, DFOP/const and DFOP/tc) and the version with increased iterations can be compared using the model comparison function of the saemix package:
-+AIC_parent_saemix <- saemix::compare.saemix( f_parent_saemix_sfo_const$so, f_parent_saemix_sfo_tc$so, @@ -480,7 +492,7 @@ comparison function of the saemix package: f_parent_saemix_dfop_tc$so, f_parent_saemix_dfop_tc_moreiter$so)
-Likelihoods calculated by importance sampling
+ @@ -488,13 +500,13 @@ comparison function of the saemix package: SFO const 796.38 795.34 SFO tc 798.38 797.13 DFOP const 705.75 703.88 -DFOP tc 665.65 663.57 -DFOP tc more iterations 665.88 663.80+DFOP tc 665.67 663.59 +DFOP tc more iterations 665.85 663.76In order to check the influence of the likelihood calculation algorithms implemented in saemix, the likelihood from Gaussian quadrature is added to the best fit, and the AIC values obtained from the three methods are compared.
-+f_parent_saemix_dfop_tc$so <- saemix::llgq.saemix(f_parent_saemix_dfop_tc$so) AIC_parent_saemix_methods <- c( @@ -504,7 +516,7 @@ the three methods are compared. ) print(AIC_parent_saemix_methods)
+665.67 665.74 665.13is gq lin -665.65 665.68 665.11
The AIC values based on importance sampling and Gaussian quadrature are very similar. Using linearisation is known to be less accurate, but still gives a similar value.
@@ -518,7 +530,7 @@ iterations makes a lot of difference. When using the LAPACK version coming with Debian Bullseye, the AIC based on Gaussian quadrature is almost the same as the one obtained with the other methods, also when using defaults for the fit. -+f_parent_saemix_dfop_tc_defaults <- mkin::saem(f_parent_mkin_tc["DFOP", ]) f_parent_saemix_dfop_tc_defaults$so <- saemix::llgq.saemix(f_parent_saemix_dfop_tc_defaults$so) @@ -529,7 +541,7 @@ using defaults for the fit. ) print(AIC_parent_saemix_methods_defaults)
+670.09 669.37 671.29is gq lin -669.77 669.36 670.95
@@ -538,7 +550,7 @@ using defaults for the fit.The following table gives the AIC values obtained with both backend packages using the same control parameters (800 iterations burn-in, 300 iterations second phase, 15 chains).
-++kable(AIC_all)AIC_all <- data.frame( check.names = FALSE, "Degradation model" = c("SFO", "SFO", "DFOP", "DFOP"), @@ -549,7 +561,7 @@ iterations second phase, 15 chains). saemix_is = 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, method = "is") ) -kable(AIC_all)
@@ -612,48 +624,48 @@ satisfactory precision.
Degradation model @@ -577,15 +589,15 @@ iterations second phase, 15 chains).DFOP const NA -709.26 +704.95 705.75 DFOP tc 671.91 -665.11 -665.65 +665.13 +665.67 @@ -73,6 +73,9 @@Session Info
-+ -R version 4.3.0 Patched (2023-05-18 r84448) +
+ [1] sass_0.4.7 utf8_1.2.3 generics_0.1.3 stringi_1.7.12 + [5] lattice_0.21-9 digest_0.6.33 magrittr_2.0.3 evaluate_0.22 + [9] grid_4.3.1 fastmap_1.1.1 rprojroot_2.0.3 jsonlite_1.8.7 +[13] mclust_6.0.0 gridExtra_2.3 purrr_1.0.1 fansi_1.0.4 +[17] scales_1.2.1 codetools_0.2-19 textshaping_0.3.6 jquerylib_0.1.4 +[21] cli_3.6.1 rlang_1.1.1 munsell_0.5.0 cachem_1.0.8 +[25] yaml_2.3.7 tools_4.3.1 parallel_4.3.1 memoise_2.0.1 +[29] dplyr_1.1.2 colorspace_2.1-0 ggplot2_3.4.2 vctrs_0.6.3 +[33] R6_2.5.1 zoo_1.8-12 lifecycle_1.0.3 stringr_1.5.0 +[37] fs_1.6.3 MASS_7.3-60 ragg_1.2.5 pkgconfig_2.0.3 +[41] desc_1.4.2 pkgdown_2.0.7 bslib_0.5.1 pillar_1.9.0 +[45] gtable_0.3.3 glue_1.6.2 systemfonts_1.0.4 xfun_0.40 +[49] tibble_3.2.1 lmtest_0.9-40 tidyselect_1.2.0 rstudioapi_0.15.0 +[53] htmltools_0.5.6.1 rmarkdown_2.23 compiler_4.3.1R version 4.3.1 (2023-06-16) Platform: x86_64-pc-linux-gnu (64-bit) -Running under: Debian GNU/Linux 12 (bookworm) +Running under: Ubuntu 22.04.3 LTS Matrix products: default -BLAS: /home/jranke/svn/R/r-patched/build/lib/libRblas.so -LAPACK: /usr/lib/x86_64-linux-gnu/openblas-serial/liblapack.so.3; LAPACK version 3.11.0 +BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 +LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0 locale: - [1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C - [3] LC_TIME=C LC_COLLATE=de_DE.UTF-8 - [5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8 - [7] LC_PAPER=de_DE.UTF-8 LC_NAME=C + [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C + [3] LC_TIME=C LC_COLLATE=en_US.UTF-8 + [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 + [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C -[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C +[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C -time zone: Europe/Berlin +time zone: Europe/Zurich tzcode source: system (glibc) attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: -[1] nlme_3.1-162 mkin_1.2.4 knitr_1.42 +[1] saemix_3.2 npde_3.3 nlme_3.1-163 mkin_1.2.6 knitr_1.44 loaded via a namespace (and not attached): - [1] sass_0.4.6 utf8_1.2.3 generics_0.1.3 saemix_3.2 - [5] stringi_1.7.12 lattice_0.21-8 digest_0.6.31 magrittr_2.0.3 - [9] evaluate_0.21 grid_4.3.0 fastmap_1.1.1 rprojroot_2.0.3 -[13] jsonlite_1.8.4 DBI_1.1.3 mclust_6.0.0 gridExtra_2.3 -[17] purrr_1.0.1 fansi_1.0.4 scales_1.2.1 textshaping_0.3.6 -[21] jquerylib_0.1.4 cli_3.6.1 rlang_1.1.1 munsell_0.5.0 -[25] cachem_1.0.8 yaml_2.3.7 tools_4.3.0 parallel_4.3.0 -[29] memoise_2.0.1 dplyr_1.1.2 colorspace_2.1-0 ggplot2_3.4.2 -[33] vctrs_0.6.2 R6_2.5.1 zoo_1.8-12 lifecycle_1.0.3 -[37] stringr_1.5.0 fs_1.6.2 ragg_1.2.5 pkgconfig_2.0.3 -[41] desc_1.4.2 pkgdown_2.0.7 bslib_0.4.2 pillar_1.9.0 -[45] gtable_0.3.3 glue_1.6.2 systemfonts_1.0.4 xfun_0.39 -[49] tibble_3.2.1 lmtest_0.9-40 tidyselect_1.2.0 npde_3.3 -[53] htmltools_0.5.5 rmarkdown_2.21 compiler_4.3.0
@@ -73,6 +73,9 @@References diff --git a/docs/articles/web_only/multistart.html b/docs/articles/web_only/multistart.html index b9224bb0..dff087e4 100644 --- a/docs/articles/web_only/multistart.html +++ b/docs/articles/web_only/multistart.html @@ -33,7 +33,7 @@
Testing hierarchical pathway kinetics with residue data on dimethenamid and dimethenamid-P ++ Testing covariate modelling in hierarchical parent degradation kinetics with residue data on mesotrione + Testing hierarchical pathway kinetics with residue data on cyantraniliprole @@ -134,7 +137,7 @@ RankeLast change 20 April 2023 -(rebuilt 2023-05-19)
+(rebuilt 2023-10-30) Source:vignettes/web_only/multistart.rmd
diff --git a/docs/articles/web_only/multistart_files/figure-html/unnamed-chunk-3-1.png b/docs/articles/web_only/multistart_files/figure-html/unnamed-chunk-3-1.png index f41dc889..8be6ba61 100644 Binary files a/docs/articles/web_only/multistart_files/figure-html/unnamed-chunk-3-1.png and b/docs/articles/web_only/multistart_files/figure-html/unnamed-chunk-3-1.png differ diff --git a/docs/articles/web_only/multistart_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/web_only/multistart_files/figure-html/unnamed-chunk-4-1.png index 9e206791..bc518c0c 100644 Binary files a/docs/articles/web_only/multistart_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/web_only/multistart_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/articles/web_only/multistart_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/web_only/multistart_files/figure-html/unnamed-chunk-5-1.png index c8e918cd..9ecdf4c9 100644 Binary files a/docs/articles/web_only/multistart_files/figure-html/unnamed-chunk-5-1.png and b/docs/articles/web_only/multistart_files/figure-html/unnamed-chunk-5-1.png differ diff --git a/docs/articles/web_only/saem_benchmarks.html b/docs/articles/web_only/saem_benchmarks.html index a9637876..095a37e2 100644 --- a/docs/articles/web_only/saem_benchmarks.html +++ b/docs/articles/web_only/saem_benchmarks.html @@ -33,7 +33,7 @@multistart.rmd
Testing hierarchical pathway kinetics with residue data on dimethenamid and dimethenamid-P ++ Testing covariate modelling in hierarchical parent degradation kinetics with residue data on mesotrione + Testing hierarchical pathway kinetics with residue data on cyantraniliprole @@ -134,7 +137,7 @@ RankeLast change 17 February 2023 -(rebuilt 2023-05-19)
+(rebuilt 2023-10-30) Source:vignettes/web_only/saem_benchmarks.rmd
@@ -190,7 +193,7 @@ explanation of the following preprocessing.saem_benchmarks.rmd
+ sfo_tc, dfop_tc, sforb_tc, hs_tc) |> kable(, digits = 1)anova( sfo_const, dfop_const, sforb_const, hs_const, - sfo_tc, dfop_tc, sforb_tc, hs_tc) |> kable(, digits = 1)