From b7901aac76df753ec1213cb02bebea055965ee87 Mon Sep 17 00:00:00 2001 From: Ranke Johannes Date: Mon, 30 Oct 2023 17:09:21 +0100 Subject: Update static docs --- docs/articles/web_only/dimethenamid_2018.html | 154 ++++++++++++++------------ 1 file changed, 83 insertions(+), 71 deletions(-) (limited to 'docs/articles/web_only/dimethenamid_2018.html') 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 @@ mkin - 1.2.4 + 1.2.6 @@ -73,6 +73,9 @@
  • 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
  • @@ -135,7 +138,7 @@ from 2018 Ranke

    Last change 1 July 2022, -built on 19 May 2023

    +built on 30 Oct 2023 Source: vignettes/web_only/dimethenamid_2018.rmd @@ -222,12 +225,12 @@ least in some datasets the degradation slows down towards later time points, and that the scatter of the residuals error is smaller for smaller values (panel to the right):

    -plot(mixed(f_parent_mkin_const["SFO", ]))
    +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", ]))
    +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)
    +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)
    +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)

    @@ -358,8 +361,17 @@ implemented in the saemix package, the convergence plots need to be manually checked for every fit. We define control settings that work well for all the parent data fits shown in this vignette.

    -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.

    -
    +
     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")
    @@ -375,19 +387,19 @@ shown below.

    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)
    Kinetic 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
    +SD.k2 0.03296 -2.50524 2.5712 +SD.g 1.10266 0.32354 1.8818

    While the other parameters converge to credible values, the variance of k2 (omega2.k2) converges to a very small value. The printout of the saem.mmkin model shows that the estimated @@ -423,14 +435,14 @@ this model.

    also observe that the estimated variance of k2 becomes very small, while being ill-defined, as illustrated by the excessive confidence interval of 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)
    Kinetic 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
    + 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.7128

    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
    -
    +
     rownames(AIC_parent_saemix) <- c(
       "SFO const", "SFO tc", "DFOP const", "DFOP tc", "DFOP tc more iterations")
     print(AIC_parent_saemix)
    @@ -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.76

    In 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)
        is     gq    lin 
    -665.65 665.68 665.11 
    +665.67 665.74 665.13

    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)
        is     gq    lin 
    -669.77 669.36 670.95 
    +670.09 669.37 671.29
    @@ -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).

    -
    +
     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)
    +kable(AIC_all)
    @@ -577,15 +589,15 @@ iterations second phase, 15 chains).

    - + - - + +
    Degradation model DFOP const NA709.26704.95 705.75
    DFOP tc 671.91665.11665.65665.13665.67
    @@ -612,48 +624,48 @@ satisfactory precision.

    Session Info

    -
    +
    -
    R version 4.3.0 Patched (2023-05-18 r84448)
    +
    R 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   
    + [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.1

    References -- cgit v1.2.1