From 91c5db736a4d3f2290a0cc5698fb4e35ae7bda59 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 18 May 2022 21:26:17 +0200 Subject: Remove outdated comment in FOCUS L vignette, update docs This also adds the first benchmark results obtained on my laptop system --- docs/articles/web_only/FOCUS_Z.html | 50 +++---- .../figure-html/FOCUS_2006_Z_fits_10-1.png | Bin 105896 -> 105896 bytes .../figure-html/FOCUS_2006_Z_fits_11-1.png | Bin 104793 -> 104797 bytes .../figure-html/FOCUS_2006_Z_fits_11a-1.png | Bin 75230 -> 75232 bytes .../figure-html/FOCUS_2006_Z_fits_11b-1.png | Bin 36314 -> 36302 bytes .../figure-html/FOCUS_2006_Z_fits_5-1.png | Bin 80373 -> 80380 bytes .../figure-html/FOCUS_2006_Z_fits_6-1.png | Bin 105210 -> 105229 bytes .../figure-html/FOCUS_2006_Z_fits_9-1.png | Bin 88801 -> 88797 bytes docs/articles/web_only/NAFTA_examples.html | 154 ++++++++++----------- .../NAFTA_examples_files/figure-html/p10-1.png | Bin 79758 -> 79762 bytes .../NAFTA_examples_files/figure-html/p15a-1.png | Bin 76925 -> 76938 bytes .../NAFTA_examples_files/figure-html/p15b-1.png | Bin 78968 -> 78977 bytes .../NAFTA_examples_files/figure-html/p5b-1.png | Bin 80721 -> 80721 bytes .../NAFTA_examples_files/figure-html/p6-1.png | Bin 83052 -> 83052 bytes .../NAFTA_examples_files/figure-html/p7-1.png | Bin 102568 -> 102570 bytes docs/articles/web_only/benchmarks.html | 145 ++++++++++++------- docs/articles/web_only/compiled_models.html | 30 ++-- docs/articles/web_only/dimethenamid_2018.html | 93 +++++++------ docs/articles/web_only/mkin_benchmarks.rda | Bin 0 -> 1273 bytes 19 files changed, 256 insertions(+), 216 deletions(-) create mode 100644 docs/articles/web_only/mkin_benchmarks.rda (limited to 'docs/articles/web_only') diff --git a/docs/articles/web_only/FOCUS_Z.html b/docs/articles/web_only/FOCUS_Z.html index 43508280..0dafb98a 100644 --- a/docs/articles/web_only/FOCUS_Z.html +++ b/docs/articles/web_only/FOCUS_Z.html @@ -105,7 +105,7 @@

Example evaluation of FOCUS dataset Z

Johannes Ranke

-

Last change 16 January 2018 (rebuilt 2022-03-07)

+

Last change 16 January 2018 (rebuilt 2022-05-18)

Source: vignettes/web_only/FOCUS_Z.rmd @@ -234,33 +234,31 @@ quiet = TRUE)
## Warning in mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, parms.ini = m.Z.5$bparms.ode, :
 ## Observations with value of zero were removed from the data
-
## Warning in mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, parms.ini = m.Z.5$bparms.ode, : Optimisation did not converge:
-## false convergence (8)
-
+
 plot_sep(m.Z.FOCUS)

-
+
 summary(m.Z.FOCUS, data = FALSE)$bpar
##             Estimate se_notrans t value     Pr(>t)     Lower      Upper
-## Z0_0       96.838822   1.994274 48.5584 4.0280e-42 92.826981 100.850664
-## k_Z0        2.215393   0.118458 18.7019 1.0413e-23  1.989456   2.466989
-## k_Z1        0.478305   0.028258 16.9266 6.2418e-22  0.424708   0.538666
-## k_Z2        0.451627   0.042139 10.7176 1.6314e-14  0.374339   0.544872
-## k_Z3        0.058692   0.015245  3.8499 1.7803e-04  0.034808   0.098965
-## f_Z2_to_Z3  0.471502   0.058351  8.0805 9.6608e-11  0.357769   0.588274
+## Z0_0       96.838397   1.994270 48.5583 4.0284e-42 92.826435 100.850359
+## k_Z0        2.215406   0.118459 18.7018 1.0416e-23  1.989466   2.467005
+## k_Z1        0.478300   0.028257 16.9267 6.2409e-22  0.424702   0.538662
+## k_Z2        0.451616   0.042137 10.7178 1.6305e-14  0.374328   0.544863
+## k_Z3        0.058693   0.015245  3.8499 1.7803e-04  0.034805   0.098976
+## f_Z2_to_Z3  0.471509   0.058352  8.0804 9.6622e-11  0.357739   0.588317
 ## sigma       3.984431   0.383402 10.3923 4.5575e-14  3.213126   4.755736
-
+
 endpoints(m.Z.FOCUS)
## $ff
 ##   Z2_Z3 Z2_sink 
-##  0.4715  0.5285 
+## 0.47151 0.52849 
 ## 
 ## $distimes
 ##        DT50    DT90
 ## Z0  0.31288  1.0394
-## Z1  1.44917  4.8141
-## Z2  1.53478  5.0984
-## Z3 11.80986 39.2315
+## Z1 1.44919 4.8141 +## Z2 1.53481 5.0985 +## Z3 11.80971 39.2310

This fit corresponds to the final result chosen in Appendix 7 of the FOCUS report. Confidence intervals returned by mkin are based on internally transformed parameters, however.

@@ -268,32 +266,34 @@

As the FOCUS report states, there is a certain tailing of the time course of metabolite Z3. Also, the time course of the parent compound is not fitted very well using the SFO model, as residues at a certain low level remain.

Therefore, an additional model is offered here, using the single first-order reversible binding (SFORB) model for metabolite Z3. As expected, the \(\chi^2\) error level is lower for metabolite Z3 using this model and the graphical fit for Z3 is improved. However, the covariance matrix is not returned.

-
+
 Z.mkin.1 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
                     Z1 = mkinsub("SFO", "Z2", sink = FALSE),
                     Z2 = mkinsub("SFO", "Z3"),
                     Z3 = mkinsub("SFORB"))
## Temporary DLL for differentials generated and loaded
-
+
 m.Z.mkin.1 <- mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, quiet = TRUE)
## Warning in mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
 ## value of zero were removed from the data
-
+
 plot_sep(m.Z.mkin.1)

-
+
 summary(m.Z.mkin.1, data = FALSE)$cov.unscaled
## NULL

Therefore, a further stepwise model building is performed starting from the stage of parent and two metabolites, starting from the assumption that the model fit for the parent compound can be improved by using the SFORB model.

-
+
 Z.mkin.3 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
                     Z1 = mkinsub("SFO", "Z2", sink = FALSE),
                     Z2 = mkinsub("SFO"))
## Temporary DLL for differentials generated and loaded
-
+
 m.Z.mkin.3 <- mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE)
## Warning in mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
 ## value of zero were removed from the data
+
## Warning in mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE): Optimisation did not converge:
+## false convergence (8)
 plot_sep(m.Z.mkin.3)

@@ -359,11 +359,11 @@ ## ## $SFORB ## Z0_b1 Z0_b2 Z3_b1 Z3_b2 -## 2.4471322 0.0075125 0.0800069 0.0000000 +## 2.4471376 0.0075126 0.0800073 0.0000000 ## ## $distimes ## DT50 DT90 DT50back DT50_Z0_b1 DT50_Z0_b2 DT50_Z3_b1 DT50_Z3_b2 -## Z0 0.3043 1.1848 0.35666 0.28325 92.266 NA NA +## Z0 0.3043 1.1848 0.35666 0.28325 92.264 NA NA ## Z1 1.5148 5.0320 NA NA NA NA NA ## Z2 1.6414 5.4526 NA NA NA NA NA ## Z3 NA NA NA NA NA 8.6636 Inf
@@ -398,7 +398,7 @@

-

Site built with pkgdown 2.0.2.

+

Site built with pkgdown 2.0.3.

diff --git a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png index bc6efaf7..229bae82 100644 Binary files a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png and b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png differ diff --git a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png index 55c1b645..e13ad9aa 100644 Binary files a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png and b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png differ diff --git a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png index 8e63cd04..ae160414 100644 Binary files a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png and b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png differ diff --git a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png index 3902e059..23e270d1 100644 Binary files a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png and b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png differ diff --git a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png index d95cac25..77965455 100644 Binary files a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png and b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png differ diff --git a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png index cb333a1c..250d0df5 100644 Binary files a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png and b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png differ diff --git a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png index db807f14..5a01c03e 100644 Binary files a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png and b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png differ diff --git a/docs/articles/web_only/NAFTA_examples.html b/docs/articles/web_only/NAFTA_examples.html index 996e5d49..df1e06db 100644 --- a/docs/articles/web_only/NAFTA_examples.html +++ b/docs/articles/web_only/NAFTA_examples.html @@ -43,7 +43,7 @@ Functions and data
@@ -212,7 +212,7 @@ ## Estimate Pr(>t) Lower Upper ## parent_0 9.84e+01 1.24e-27 97.8078 98.9187 ## k1 1.55e-02 4.10e-04 0.0143 0.0167 -## k2 8.63e-12 5.00e-01 0.0000 Inf +## k2 9.41e-12 5.00e-01 0.0000 Inf ## g 6.89e-01 2.92e-03 0.6626 0.7142 ## sigma 6.48e-01 2.38e-05 0.4147 0.8813 ## @@ -221,7 +221,7 @@ ## DT50 DT90 DT50_rep ## SFO 86.6 2.88e+02 8.66e+01 ## IORE 85.5 7.17e+02 2.16e+02 -## DFOP 83.6 1.32e+11 8.04e+10 +## DFOP 83.6 1.21e+11 7.36e+10 ## ## Representative half-life: ## [1] 215.87
@@ -263,7 +263,7 @@ ## Estimate Pr(>t) Lower Upper ## parent_0 9.66e+01 1.57e-25 95.3476 97.8979 ## k1 2.55e-02 7.33e-06 0.0233 0.0278 -## k2 3.22e-11 5.00e-01 0.0000 Inf +## k2 4.40e-11 5.00e-01 0.0000 Inf ## g 8.61e-01 7.55e-06 0.8314 0.8867 ## sigma 1.46e+00 6.93e-06 0.9661 1.9483 ## @@ -272,7 +272,7 @@ ## DT50 DT90 DT50_rep ## SFO 38.6 1.28e+02 3.86e+01 ## IORE 34.0 1.77e+02 5.32e+01 -## DFOP 34.1 1.01e+10 2.15e+10 +## DFOP 34.1 7.43e+09 1.58e+10 ## ## Representative half-life: ## [1] 53.17
@@ -314,7 +314,7 @@ ## Estimate Pr(>t) Lower Upper ## parent_0 9.89e+01 9.44e-49 95.4640 102.2573 ## k1 1.81e-02 1.75e-01 0.0116 0.0281 -## k2 3.63e-10 5.00e-01 0.0000 Inf +## k2 2.81e-10 5.00e-01 0.0000 Inf ## g 6.06e-01 2.19e-01 0.4826 0.7178 ## sigma 7.40e+00 2.97e-15 6.0201 8.7754 ## @@ -323,7 +323,7 @@ ## DT50 DT90 DT50_rep ## SFO 94.3 3.13e+02 9.43e+01 ## IORE 96.7 1.51e+03 4.55e+02 -## DFOP 96.4 3.77e+09 1.91e+09 +## DFOP 96.4 4.87e+09 2.46e+09 ## ## Representative half-life: ## [1] 454.55
@@ -434,7 +434,7 @@ ## DT50 DT90 DT50_rep ## SFO 16.9 5.63e+01 1.69e+01 ## IORE 11.6 3.37e+02 1.01e+02 -## DFOP 10.5 1.38e+12 7.69e+11 +## DFOP 10.5 1.38e+12 7.68e+11 ## ## Representative half-life: ## [1] 101.43
@@ -445,17 +445,12 @@
 p9b <- nafta(NAFTA_SOP_Attachment[["p9b"]])
-
## Warning in sqrt(diag(covar)): NaNs produced
-
## Warning in sqrt(diag(covar_notrans)): NaNs produced
-
## Warning in sqrt(1/diag(V)): NaNs produced
-
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
-## doubtful
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
## The half-life obtained from the IORE model may be used
-
+
 plot(p9b)

-
+
 print(p9b)
## Sums of squares:
 ##      SFO     IORE     DFOP 
@@ -482,8 +477,8 @@
 ##          Estimate   Pr(>t)   Lower   Upper
 ## parent_0  94.7123 1.61e-16 93.1355 96.2891
 ## k1         0.0389 1.08e-04  0.0266  0.0569
-## k2         0.0389 2.23e-04  0.0255  0.0592
-## g          0.5256      NaN      NA      NA
+## k2         0.0389 2.24e-04  0.0255  0.0592
+## g          0.5256 5.00e-01  0.0000  1.0000
 ## sigma      1.5957 2.50e-04  0.9135  2.2779
 ## 
 ## 
@@ -500,7 +495,7 @@
 

Example on page 10

-
+
 p10 <- nafta(NAFTA_SOP_Attachment[["p10"]])
## Warning in sqrt(diag(covar)): NaNs produced
## Warning in sqrt(1/diag(V)): NaNs produced
@@ -508,10 +503,10 @@ ## doubtful
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
## The half-life obtained from the IORE model may be used
-
+
 plot(p10)

-
+
 print(p10)
## Sums of squares:
 ##      SFO     IORE     DFOP 
@@ -537,8 +532,8 @@
 ## $DFOP
 ##          Estimate   Pr(>t)   Lower    Upper
 ## parent_0 101.7315 1.41e-09 91.6534 111.8097
-## k1         0.0495 6.58e-03  0.0303   0.0809
-## k2         0.0495 2.60e-03  0.0410   0.0598
+## k1         0.0495 6.32e-03  0.0241   0.1018
+## k2         0.0495 2.41e-03  0.0272   0.0901
 ## g          0.4487 5.00e-01      NA       NA
 ## sigma      8.0152 2.50e-04  4.5886  11.4418
 ## 
@@ -560,14 +555,14 @@
 

Example on page 11

-
+
 p11 <- nafta(NAFTA_SOP_Attachment[["p11"]])
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
## The half-life obtained from the IORE model may be used
-
+
 plot(p11)

-
+
 print(p11)
## Sums of squares:
 ##      SFO     IORE     DFOP 
@@ -594,7 +589,7 @@
 ##          Estimate   Pr(>t)    Lower    Upper
 ## parent_0 1.05e+02 9.47e-13  99.9990 109.1224
 ## k1       4.41e-02 5.95e-03   0.0296   0.0658
-## k2       9.94e-13 5.00e-01   0.0000      Inf
+## k2       9.93e-13 5.00e-01   0.0000      Inf
 ## g        3.22e-01 1.45e-03   0.2814   0.3650
 ## sigma    3.22e+00 3.52e-04   1.8410   4.5906
 ## 
@@ -606,7 +601,7 @@
 ## DFOP 3.07e+11 1.93e+12 6.98e+11
 ## 
 ## Representative half-life:
-## [1] 41148170
+## [1] 41148171

In this case, the DFOP fit reported for PestDF resulted in a negative value for the slower rate constant, which is not possible in mkin. The other results are in agreement.

@@ -617,21 +612,19 @@

Example on page 12, upper panel

-
+
 p12a <- nafta(NAFTA_SOP_Attachment[["p12a"]])
## Warning in summary.mkinfit(x): Could not calculate correlation; no covariance
+## matrix
+
+## Warning in summary.mkinfit(x): Could not calculate correlation; no covariance
 ## matrix
-
## Warning in sqrt(diag(covar)): NaNs produced
-
## Warning in sqrt(diag(covar_notrans)): NaNs produced
-
## Warning in sqrt(1/diag(V)): NaNs produced
-
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
-## doubtful
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
## The half-life obtained from the IORE model may be used
-
+
 plot(p12a)

-
+
 print(p12a)
## Sums of squares:
 ##      SFO     IORE     DFOP 
@@ -655,12 +648,12 @@
 ## sigma             3.965     NA    NA    NA
 ## 
 ## $DFOP
-##          Estimate   Pr(>t)   Lower   Upper
-## parent_0  100.521 2.74e-10 92.2366 108.805
-## k1          0.124 2.53e-05  0.0908   0.170
-## k2          0.124 2.52e-02  0.0456   0.339
-## g           0.793      NaN      NA      NA
-## sigma       7.048 2.50e-04  4.0349  10.061
+##          Estimate Pr(>t) Lower Upper
+## parent_0  100.521     NA    NA    NA
+## k1          0.124     NA    NA    NA
+## k2          0.124     NA    NA    NA
+## g           0.793     NA    NA    NA
+## sigma       7.048     NA    NA    NA
 ## 
 ## 
 ## DTx values:
@@ -675,18 +668,17 @@
 

Example on page 12, lower panel

-
+
 p12b <- nafta(NAFTA_SOP_Attachment[["p12b"]])
## Warning in qt(alpha/2, rdf): NaNs produced
## Warning in qt(1 - alpha/2, rdf): NaNs produced
-
## Warning in sqrt(diag(covar_notrans)): NaNs produced
## Warning in pt(abs(tval), rdf, lower.tail = FALSE): NaNs produced
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
## The half-life obtained from the IORE model may be used
-
+
 plot(p12b)

-
+
 print(p12b)
## Sums of squares:
 ##      SFO     IORE     DFOP 
@@ -730,14 +722,18 @@
 

Example on page 13

-
+
 p13 <- nafta(NAFTA_SOP_Attachment[["p13"]])
+
## Warning in sqrt(diag(covar)): NaNs produced
+
## Warning in sqrt(1/diag(V)): NaNs produced
+
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
## The half-life obtained from the IORE model may be used
-
+
 plot(p13)

-
+
 print(p13)
## Sums of squares:
 ##      SFO     IORE     DFOP 
@@ -763,9 +759,9 @@
 ## $DFOP
 ##          Estimate Pr(>t)    Lower    Upper
 ## parent_0 92.73500     NA 8.95e+01 95.92118
-## k1        0.00258     NA 4.14e-04  0.01611
-## k2        0.00258     NA 1.74e-03  0.00383
-## g         0.16452     NA 0.00e+00  1.00000
+## k1        0.00258     NA 4.24e-04  0.01573
+## k2        0.00258     NA 1.76e-03  0.00379
+## g         0.16452     NA       NA       NA
 ## sigma     3.41172     NA 2.02e+00  4.79960
 ## 
 ## 
@@ -782,7 +778,7 @@
 

DT50 not observed in the study and DFOP problems in PestDF

-
+
 p14 <- nafta(NAFTA_SOP_Attachment[["p14"]])
## Warning in sqrt(diag(covar)): NaNs produced
## Warning in sqrt(1/diag(V)): NaNs produced
@@ -790,10 +786,10 @@ ## doubtful
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
## The half-life obtained from the IORE model may be used
-
+
 plot(p14)

-
+
 print(p14)
## Sums of squares:
 ##      SFO     IORE     DFOP 
@@ -820,7 +816,7 @@
 ##          Estimate   Pr(>t)    Lower    Upper
 ## parent_0 1.00e+02 2.96e-28 99.40280 101.2768
 ## k1       9.53e-03 1.20e-01  0.00638   0.0143
-## k2       6.08e-12 5.00e-01  0.00000      Inf
+## k2       5.03e-12 5.00e-01  0.00000      Inf
 ## g        3.98e-01 2.19e-01  0.30481   0.4998
 ## sigma    1.17e+00 7.68e-06  0.77406   1.5610
 ## 
@@ -829,7 +825,7 @@
 ##          DT50     DT90 DT50_rep
 ## SFO  2.48e+02 8.25e+02 2.48e+02
 ## IORE 4.34e+02 2.22e+04 6.70e+03
-## DFOP 3.05e+10 2.95e+11 1.14e+11
+## DFOP 3.69e+10 3.57e+11 1.38e+11
 ## 
 ## Representative half-life:
 ## [1] 6697.44
@@ -838,14 +834,18 @@

N is less than 1 and DFOP fraction parameter is below zero

-
+
 p15a <- nafta(NAFTA_SOP_Attachment[["p15a"]])
+
## Warning in sqrt(diag(covar)): NaNs produced
+
## Warning in sqrt(1/diag(V)): NaNs produced
+
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
## The half-life obtained from the IORE model may be used
-
+
 plot(p15a)

-
+
 print(p15a)
## Sums of squares:
 ##      SFO     IORE     DFOP 
@@ -871,9 +871,9 @@
 ## $DFOP
 ##          Estimate   Pr(>t)    Lower    Upper
 ## parent_0 97.96751 2.85e-13 94.21913 101.7159
-## k1        0.00952 6.28e-02  0.00250   0.0363
-## k2        0.00952 1.27e-04  0.00646   0.0140
-## g         0.21241 5.00e-01  0.00000   1.0000
+## k1        0.00952 6.28e-02  0.00260   0.0349
+## k2        0.00952 1.27e-04  0.00652   0.0139
+## g         0.21241 5.00e-01       NA       NA
 ## sigma     4.18778 2.50e-04  2.39747   5.9781
 ## 
 ## 
@@ -885,18 +885,14 @@
 ## 
 ## Representative half-life:
 ## [1] 41.33
-
+
 p15b <- nafta(NAFTA_SOP_Attachment[["p15b"]])
-
## Warning in sqrt(diag(covar)): NaNs produced
-
## Warning in sqrt(1/diag(V)): NaNs produced
-
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
-## doubtful
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
## The half-life obtained from the IORE model may be used
-
+
 plot(p15b)

-
+
 print(p15b)
## Sums of squares:
 ##       SFO      IORE      DFOP 
@@ -916,15 +912,15 @@
 ##                Estimate   Pr(>t)    Lower  Upper
 ## parent_0          99.83 1.81e-16 97.51349 102.14
 ## k__iore_parent     0.38 3.22e-01  0.00352  41.05
-## N_parent           0.00 5.00e-01 -1.07696   1.08
+## N_parent           0.00 5.00e-01 -1.07695   1.08
 ## sigma              2.21 2.57e-04  1.23245   3.19
 ## 
 ## $DFOP
 ##          Estimate Pr(>t)    Lower    Upper
 ## parent_0 1.01e+02     NA 9.82e+01 1.04e+02
-## k1       4.86e-03     NA 8.63e-04 2.73e-02
+## k1       4.86e-03     NA 8.62e-04 2.74e-02
 ## k2       4.86e-03     NA 3.21e-03 7.35e-03
-## g        1.88e-01     NA       NA       NA
+## g        1.88e-01     NA 0.00e+00 1.00e+00
 ## sigma    2.76e+00     NA 1.58e+00 3.94e+00
 ## 
 ## 
@@ -941,16 +937,16 @@
 

The DFOP fraction parameter is greater than 1

-
+
 p16 <- nafta(NAFTA_SOP_Attachment[["p16"]])
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
## The representative half-life of the IORE model is longer than the one corresponding
## to the terminal degradation rate found with the DFOP model.
## The representative half-life obtained from the DFOP model may be used
-
+
 plot(p16)

-
+
 print(p16)
## Sums of squares:
 ##      SFO     IORE     DFOP 
@@ -1026,7 +1022,7 @@
 
 

-

Site built with pkgdown 2.0.2.

+

Site built with pkgdown 2.0.3.

diff --git a/docs/articles/web_only/NAFTA_examples_files/figure-html/p10-1.png b/docs/articles/web_only/NAFTA_examples_files/figure-html/p10-1.png index 75611a70..a53c48b2 100644 Binary files a/docs/articles/web_only/NAFTA_examples_files/figure-html/p10-1.png and b/docs/articles/web_only/NAFTA_examples_files/figure-html/p10-1.png differ diff --git a/docs/articles/web_only/NAFTA_examples_files/figure-html/p15a-1.png b/docs/articles/web_only/NAFTA_examples_files/figure-html/p15a-1.png index b6faeff9..fb211a8e 100644 Binary files a/docs/articles/web_only/NAFTA_examples_files/figure-html/p15a-1.png and b/docs/articles/web_only/NAFTA_examples_files/figure-html/p15a-1.png differ diff --git a/docs/articles/web_only/NAFTA_examples_files/figure-html/p15b-1.png b/docs/articles/web_only/NAFTA_examples_files/figure-html/p15b-1.png index 6b9ba98c..9aedbf16 100644 Binary files a/docs/articles/web_only/NAFTA_examples_files/figure-html/p15b-1.png and b/docs/articles/web_only/NAFTA_examples_files/figure-html/p15b-1.png differ diff --git a/docs/articles/web_only/NAFTA_examples_files/figure-html/p5b-1.png b/docs/articles/web_only/NAFTA_examples_files/figure-html/p5b-1.png index db90244b..034eed46 100644 Binary files a/docs/articles/web_only/NAFTA_examples_files/figure-html/p5b-1.png and b/docs/articles/web_only/NAFTA_examples_files/figure-html/p5b-1.png differ diff --git a/docs/articles/web_only/NAFTA_examples_files/figure-html/p6-1.png b/docs/articles/web_only/NAFTA_examples_files/figure-html/p6-1.png index a33372e8..86cd9755 100644 Binary files a/docs/articles/web_only/NAFTA_examples_files/figure-html/p6-1.png and b/docs/articles/web_only/NAFTA_examples_files/figure-html/p6-1.png differ diff --git a/docs/articles/web_only/NAFTA_examples_files/figure-html/p7-1.png b/docs/articles/web_only/NAFTA_examples_files/figure-html/p7-1.png index d64ea98d..10225504 100644 Binary files a/docs/articles/web_only/NAFTA_examples_files/figure-html/p7-1.png and b/docs/articles/web_only/NAFTA_examples_files/figure-html/p7-1.png differ diff --git a/docs/articles/web_only/benchmarks.html b/docs/articles/web_only/benchmarks.html index 2eea3cb2..058d43fa 100644 --- a/docs/articles/web_only/benchmarks.html +++ b/docs/articles/web_only/benchmarks.html @@ -43,7 +43,7 @@ Functions and data
## Temporary DLL for differentials generated and loaded
-FOCUS_D <- subset(FOCUS_2006_D, value != 0)
+FOCUS_D <- subset(FOCUS_2006_D, value != 0)

We can compare the performance of the Eigenvalue based solution against the compiled version and the R implementation of the differential equations using the benchmark package. In the output of below code, the warnings about zero being removed from the FOCUS D dataset are suppressed. Since mkin version 0.9.49.11, an analytical solution is also implemented, which is included in the tests below.

 if (require(rbenchmark)) {
-  b.1 <- benchmark(
+  b.1 <- benchmark(
     "deSolve, not compiled" = mkinfit(SFO_SFO, FOCUS_D,
        solution_type = "deSolve",
        use_compiled = FALSE, quiet = TRUE),
@@ -162,11 +162,7 @@
 } else {
   print("R package rbenchmark is not available")
 }
-
##                    test replications relative elapsed
-## 4            analytical            1    1.000   0.216
-## 3     deSolve, compiled            1    1.708   0.369
-## 2      Eigenvalue based            1    1.866   0.403
-## 1 deSolve, not compiled            1   34.009   7.346
+
## [1] "R package rbenchmark is not available"

We see that using the compiled model is by more than a factor of 10 faster than using deSolve without compiled code.

@@ -179,7 +175,7 @@ parent = mkinsub("FOMC", "m1"), m1 = mkinsub( "SFO")) - b.2 <- benchmark( + b.2 <- benchmark( "deSolve, not compiled" = mkinfit(FOMC_SFO, FOCUS_D, use_compiled = FALSE, quiet = TRUE), "deSolve, compiled" = mkinfit(FOMC_SFO, FOCUS_D, quiet = TRUE), @@ -191,16 +187,14 @@ factor_FOMC_SFO <- NA print("R package benchmark is not available") }
-
## Temporary DLL for differentials generated and loaded
-
##                    test replications relative elapsed
-## 2     deSolve, compiled            1    1.000   0.533
-## 1 deSolve, not compiled            1   25.146  13.403
-

Here we get a performance benefit of a factor of 25 using the version of the differential equation model compiled from C code!

+
## Loading required package: rbenchmark
+
## [1] "R package benchmark is not available"
+

Here we get a performance benefit of a factor of NA using the version of the differential equation model compiled from C code!

This vignette was built with mkin 1.1.0 on

-
## R version 4.1.2 (2021-11-01)
+
## R version 4.2.0 (2022-04-22)
 ## Platform: x86_64-pc-linux-gnu (64-bit)
 ## Running under: Debian GNU/Linux 11 (bullseye)
-
## CPU model: AMD Ryzen 7 1700 Eight-Core Processor
+
## CPU model: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
@@ -221,7 +215,7 @@

-

Site built with pkgdown 2.0.2.

+

Site built with pkgdown 2.0.3.

diff --git a/docs/articles/web_only/dimethenamid_2018.html b/docs/articles/web_only/dimethenamid_2018.html index 09aa5150..7650f06f 100644 --- a/docs/articles/web_only/dimethenamid_2018.html +++ b/docs/articles/web_only/dimethenamid_2018.html @@ -105,7 +105,7 @@

Example evaluations of the dimethenamid data from 2018

Johannes Ranke

-

Last change 7 March 2022, built on 16 Mar 2022

+

Last change 7 March 2022, built on 18 May 2022

Source: vignettes/web_only/dimethenamid_2018.rmd @@ -178,7 +178,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 OK: No warnings C: Optimisation did not converge: @@ -231,32 +231,41 @@ f_parent_nlme_dfop_tc 3 10 671.91 702.34 -325.96 2 vs 3 134.69 <.0001

The saemix package provided the first Open Source implementation of the Stochastic Approximation to the Expectation Maximisation (SAEM) algorithm. SAEM fits of degradation models can be conveniently performed using an interface to the saemix package available in current development versions of the mkin package.

The corresponding SAEM fits of the four combinations of degradation and error models are fitted below. As there is no convergence criterion 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.0
+  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)
 saemix_control_10k <- saemixControl(nbiter.saemix = c(10000, 300), nb.chains = 15,
     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")

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:
@@ -277,21 +286,23 @@ 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.65974  1.9831
-SD.DMTA_0  1.64787  0.45779  2.8379
+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.50143  2.5673
-SD.g       1.10266  0.32371  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 standard deviation of k2 across the population of soils (SD.k2) is ill-defined, indicating overparameterisation of this model.

When the DFOP model is fitted with the two-component error model, we 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")
+ control = saemix_control_moreiter, transformations = "saemix")
+
Likelihood cannot be computed by Importance Sampling.
+
+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:
@@ -307,21 +318,21 @@ 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 9.82e+01 96.27937 100.1783 +k1 6.41e-02 0.03333 0.0948 +k2 8.56e-03 0.00608 0.0110 +g 9.55e-01 0.91440 0.9947 +a.1 1.07e+00 0.86542 1.2647 +b.1 2.96e-02 0.02258 0.0367 +SD.DMTA_0 2.04e+00 0.40629 3.6678 +SD.k1 5.98e-01 0.25796 0.9373 +SD.k2 5.28e-04 -58.93251 58.9336 +SD.g 1.04e+00 0.36509 1.7083

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 an error message. This is related to the variance of k2 approximating zero and has been submitted as a bug to the saemix package, as the algorithm does not converge in this case.

An alternative way to fit DFOP in combination with the two-component error model is to use the model formulation with transformed parameters as used per default in mkin. When using this option, convergence is slower, but eventually the algorithm stops as well with the same error 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,
@@ -329,7 +340,7 @@ SD.g       1.05725   0.3808   1.7337
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)
@@ -337,10 +348,10 @@ SD.g 1.05725 0.3808 1.7337
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.72 663.63 +DFOP tc more iterations NaN NaN

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(
@@ -350,9 +361,9 @@ DFOP tc more iterations 665.88 663.80
) print(AIC_parent_saemix_methods)
    is     gq    lin 
-665.65 665.68 665.11 
+665.72 665.88 665.15

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. In order to illustrate that the comparison of the three method depends on the degree of convergence obtained in the fit, the same comparison is shown below for the fit using the defaults for the number of iterations and the number of MCMC chains.

-
+
 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)
@@ -363,14 +374,14 @@ DFOP tc more iterations 665.88 663.80
) print(AIC_parent_saemix_methods_defaults)
    is     gq    lin 
-668.27 718.36 666.49 
+668.91 663.61 667.40

Comparison

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). Note that

-
+
 AIC_all <- data.frame(
   check.names = FALSE,
   "Degradation model" = c("SFO", "SFO", "DFOP", "DFOP"),
@@ -395,7 +406,7 @@ DFOP tc more iterations 665.88 663.80
SFO const 796.60 -796.60 +794.17 796.38 @@ -409,15 +420,15 @@ DFOP tc more iterations 665.88 663.80
DFOP const NA -671.98 +704.95 705.75 DFOP tc 671.91 -665.11 -665.65 +665.15 +665.72 @@ -464,7 +475,7 @@ DFOP tc more iterations 665.88 663.80

-

Site built with pkgdown 2.0.2.

+

Site built with pkgdown 2.0.3.

diff --git a/docs/articles/web_only/mkin_benchmarks.rda b/docs/articles/web_only/mkin_benchmarks.rda new file mode 100644 index 00000000..e26caf64 Binary files /dev/null and b/docs/articles/web_only/mkin_benchmarks.rda differ -- cgit v1.2.1