From 6211f3ef4995657798686d8d4ab43ed9406e8a08 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 12 May 2020 16:34:00 +0200 Subject: Update vignettes and docs --- docs/articles/web_only/FOCUS_Z.html | 285 ++++++++++----------- .../figure-html/FOCUS_2006_Z_fits_1-1.png | Bin 85185 -> 88629 bytes .../figure-html/FOCUS_2006_Z_fits_10-1.png | Bin 128361 -> 133233 bytes .../figure-html/FOCUS_2006_Z_fits_11-1.png | Bin 127413 -> 132503 bytes .../figure-html/FOCUS_2006_Z_fits_11a-1.png | Bin 95903 -> 99562 bytes .../figure-html/FOCUS_2006_Z_fits_11b-1.png | Bin 22086 -> 22624 bytes .../figure-html/FOCUS_2006_Z_fits_2-1.png | Bin 85869 -> 88629 bytes .../figure-html/FOCUS_2006_Z_fits_3-1.png | Bin 85461 -> 88213 bytes .../figure-html/FOCUS_2006_Z_fits_5-1.png | Bin 102008 -> 104162 bytes .../figure-html/FOCUS_2006_Z_fits_6-1.png | Bin 128536 -> 133001 bytes .../figure-html/FOCUS_2006_Z_fits_7-1.png | Bin 128135 -> 132462 bytes .../figure-html/FOCUS_2006_Z_fits_9-1.png | Bin 108179 -> 110760 bytes docs/articles/web_only/NAFTA_examples.html | 281 +++++++++----------- .../NAFTA_examples_files/figure-html/p7-1.png | Bin 66710 -> 66709 bytes docs/articles/web_only/benchmarks.html | 189 +++++++------- docs/articles/web_only/compiled_models.html | 172 ++++++------- 16 files changed, 432 insertions(+), 495 deletions(-) (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 14234785..0c34d77d 100644 --- a/docs/articles/web_only/FOCUS_Z.html +++ b/docs/articles/web_only/FOCUS_Z.html @@ -6,19 +6,19 @@ Example evaluation of FOCUS dataset Z • mkin - - - - + + + + + - - + - +
@@ -87,12 +94,12 @@
@@ -104,71 +111,71 @@

The data

The following code defines the example dataset from Appendix 7 to the FOCUS kinetics report (FOCUS Work Group on Degradation Kinetics 2014, 354).

-
library(mkin, quietly = TRUE)
-LOD = 0.5
-FOCUS_2006_Z = data.frame(
-  t = c(0, 0.04, 0.125, 0.29, 0.54, 1, 2, 3, 4, 7, 10, 14, 21,
-        42, 61, 96, 124),
-  Z0 = c(100, 81.7, 70.4, 51.1, 41.2, 6.6, 4.6, 3.9, 4.6, 4.3, 6.8,
-         2.9, 3.5, 5.3, 4.4, 1.2, 0.7),
-  Z1 = c(0, 18.3, 29.6, 46.3, 55.1, 65.7, 39.1, 36, 15.3, 5.6, 1.1,
-         1.6, 0.6, 0.5 * LOD, NA, NA, NA),
-  Z2 = c(0, NA, 0.5 * LOD, 2.6, 3.8, 15.3, 37.2, 31.7, 35.6, 14.5,
-         0.8, 2.1, 1.9, 0.5 * LOD, NA, NA, NA),
-  Z3 = c(0, NA, NA, NA, NA, 0.5 * LOD, 9.2, 13.1, 22.3, 28.4, 32.5,
-         25.2, 17.2, 4.8, 4.5, 2.8, 4.4))
-
-FOCUS_2006_Z_mkin <- mkin_wide_to_long(FOCUS_2006_Z)
+
library(mkin, quietly = TRUE)
+LOD = 0.5
+FOCUS_2006_Z = data.frame(
+  t = c(0, 0.04, 0.125, 0.29, 0.54, 1, 2, 3, 4, 7, 10, 14, 21,
+        42, 61, 96, 124),
+  Z0 = c(100, 81.7, 70.4, 51.1, 41.2, 6.6, 4.6, 3.9, 4.6, 4.3, 6.8,
+         2.9, 3.5, 5.3, 4.4, 1.2, 0.7),
+  Z1 = c(0, 18.3, 29.6, 46.3, 55.1, 65.7, 39.1, 36, 15.3, 5.6, 1.1,
+         1.6, 0.6, 0.5 * LOD, NA, NA, NA),
+  Z2 = c(0, NA, 0.5 * LOD, 2.6, 3.8, 15.3, 37.2, 31.7, 35.6, 14.5,
+         0.8, 2.1, 1.9, 0.5 * LOD, NA, NA, NA),
+  Z3 = c(0, NA, NA, NA, NA, 0.5 * LOD, 9.2, 13.1, 22.3, 28.4, 32.5,
+         25.2, 17.2, 4.8, 4.5, 2.8, 4.4))
+
+FOCUS_2006_Z_mkin <- mkin_wide_to_long(FOCUS_2006_Z)

Parent and one metabolite

The next step is to set up the models used for the kinetic analysis. As the simultaneous fit of parent and the first metabolite is usually straightforward, Step 1 (SFO for parent only) is skipped here. We start with the model 2a, with formation and decline of metabolite Z1 and the pathway from parent directly to sink included (default in mkin).

-
Z.2a <- mkinmod(Z0 = mkinsub("SFO", "Z1"),
-                Z1 = mkinsub("SFO"))
+
Z.2a <- mkinmod(Z0 = mkinsub("SFO", "Z1"),
+                Z1 = mkinsub("SFO"))
## Successfully compiled differential equation model from auto-generated C code.
-
m.Z.2a <- mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE)
-
## Warning in mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE): Observations
-## with value of zero were removed from the data
-
plot_sep(m.Z.2a)
+
m.Z.2a <- mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE)
+
## Warning in mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
+## value of zero were removed from the data
+
plot_sep(m.Z.2a)

-
summary(m.Z.2a, data = FALSE)$bpar
-
##             Estimate se_notrans    t value     Pr(>t)    Lower    Upper
-## Z0_0      9.7015e+01   3.393176 2.8591e+01 6.4352e-21 91.66556 102.3642
-## k_Z0_sink 7.2231e-10   0.225254 3.2067e-09 5.0000e-01  0.00000      Inf
-## k_Z0_Z1   2.2360e+00   0.159134 1.4051e+01 1.1369e-13  1.95303   2.5600
-## k_Z1_sink 4.8212e-01   0.065454 7.3658e+00 5.1186e-08  0.40341   0.5762
-## sigma     4.8041e+00   0.637618 7.5345e+00 3.4431e-08  3.52677   6.0815
+
summary(m.Z.2a, data = FALSE)$bpar
+
##            Estimate se_notrans t value     Pr(>t)    Lower    Upper
+## Z0_0       97.01488   3.301084 29.3888 3.2971e-21 91.66556 102.3642
+## k_Z0        2.23601   0.207078 10.7979 3.3309e-11  1.95303   2.5600
+## k_Z1        0.48212   0.063265  7.6207 2.8154e-08  0.40341   0.5762
+## f_Z0_to_Z1  1.00000   0.094764 10.5525 5.3560e-11  0.00000   1.0000
+## sigma       4.80411   0.635638  7.5579 3.2592e-08  3.52677   6.0815

As obvious from the parameter summary (the component of the summary), the kinetic rate constant from parent compound Z to sink is very small and the t-test for this parameter suggests that it is not significantly different from zero. This suggests, in agreement with the analysis in the FOCUS kinetics report, to simplify the model by removing the pathway to sink.

A similar result can be obtained when formation fractions are used in the model formulation:

- +
Z.2a.ff <- mkinmod(Z0 = mkinsub("SFO", "Z1"),
+                   Z1 = mkinsub("SFO"),
+                   use_of_ff = "max")
## Successfully compiled differential equation model from auto-generated C code.
-
m.Z.2a.ff <- mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE)
-
## Warning in mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE): Observations
-## with value of zero were removed from the data
-
plot_sep(m.Z.2a.ff)
+
m.Z.2a.ff <- mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE)
+
## Warning in mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
+## value of zero were removed from the data
+
plot_sep(m.Z.2a.ff)

-
summary(m.Z.2a.ff, data = FALSE)$bpar
+
summary(m.Z.2a.ff, data = FALSE)$bpar
##            Estimate se_notrans t value     Pr(>t)    Lower    Upper
 ## Z0_0       97.01488   3.301084 29.3888 3.2971e-21 91.66556 102.3642
 ## k_Z0        2.23601   0.207078 10.7979 3.3309e-11  1.95303   2.5600
-## k_Z1        0.48212   0.063265  7.6207 2.8155e-08  0.40341   0.5762
+## k_Z1        0.48212   0.063265  7.6207 2.8154e-08  0.40341   0.5762
 ## f_Z0_to_Z1  1.00000   0.094764 10.5525 5.3560e-11  0.00000   1.0000
 ## sigma       4.80411   0.635638  7.5579 3.2592e-08  3.52677   6.0815

Here, the ilr transformed formation fraction fitted in the model takes a very large value, and the backtransformed formation fraction from parent Z to Z1 is practically unity. Here, the covariance matrix used for the calculation of confidence intervals is not returned as the model is overparameterised.

A simplified model is obtained by removing the pathway to the sink.

In the following, we use the parameterisation with formation fractions in order to be able to compare with the results in the FOCUS guidance, and as it makes it easier to use parameters obtained in a previous fit when adding a further metabolite.

-
Z.3 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
-               Z1 = mkinsub("SFO"), use_of_ff = "max")
+
Z.3 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
+               Z1 = mkinsub("SFO"), use_of_ff = "max")
## Successfully compiled differential equation model from auto-generated C code.
-
m.Z.3 <- mkinfit(Z.3, FOCUS_2006_Z_mkin, quiet = TRUE)
+
m.Z.3 <- mkinfit(Z.3, FOCUS_2006_Z_mkin, quiet = TRUE)
## Warning in mkinfit(Z.3, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
 ## value of zero were removed from the data
-
plot_sep(m.Z.3)
+
plot_sep(m.Z.3)

-
summary(m.Z.3, data = FALSE)$bpar
+
summary(m.Z.3, data = FALSE)$bpar
##       Estimate se_notrans t value     Pr(>t)    Lower    Upper
 ## Z0_0  97.01488   2.597342  37.352 2.0106e-24 91.67597 102.3538
 ## k_Z0   2.23601   0.146904  15.221 9.1477e-15  1.95354   2.5593
@@ -180,52 +187,51 @@
 

Metabolites Z2 and Z3

As suggested in the FOCUS report, the pathway to sink was removed for metabolite Z1 as well in the next step. While this step appears questionable on the basis of the above results, it is followed here for the purpose of comparison. Also, in the FOCUS report, it is assumed that there is additional empirical evidence that Z1 quickly and exclusively hydrolyses to Z2.

-
Z.5 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
-               Z1 = mkinsub("SFO", "Z2", sink = FALSE),
-               Z2 = mkinsub("SFO"), use_of_ff = "max")
+
Z.5 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
+               Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+               Z2 = mkinsub("SFO"), use_of_ff = "max")
## Successfully compiled differential equation model from auto-generated C code.
-
m.Z.5 <- mkinfit(Z.5, FOCUS_2006_Z_mkin, quiet = TRUE)
+
m.Z.5 <- mkinfit(Z.5, FOCUS_2006_Z_mkin, quiet = TRUE)
## Warning in mkinfit(Z.5, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
 ## value of zero were removed from the data
-
plot_sep(m.Z.5)
+
plot_sep(m.Z.5)

Finally, metabolite Z3 is added to the model. We use the optimised differential equation parameter values from the previous fit in order to accelerate the optimization.

-
Z.FOCUS <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
-                   Z1 = mkinsub("SFO", "Z2", sink = FALSE),
-                   Z2 = mkinsub("SFO", "Z3"),
-                   Z3 = mkinsub("SFO"),
-                   use_of_ff = "max")
+
Z.FOCUS <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
+                   Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+                   Z2 = mkinsub("SFO", "Z3"),
+                   Z3 = mkinsub("SFO"),
+                   use_of_ff = "max")
## Successfully compiled differential equation model from auto-generated C code.
- -
## 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
-
plot_sep(m.Z.FOCUS)
+
m.Z.FOCUS <- mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin,
+                     parms.ini = m.Z.5$bparms.ode,
+                     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
+
summary(m.Z.FOCUS, data = FALSE)$bpar
##             Estimate se_notrans t value     Pr(>t)     Lower      Upper
-## Z0_0       96.838607   1.994273 48.5584 4.0283e-42 92.826626 100.850589
-## k_Z0        2.215405   0.118459 18.7018 1.0415e-23  1.989465   2.467003
-## k_Z1        0.478300   0.028257 16.9267 6.2408e-22  0.424701   0.538662
-## k_Z2        0.451618   0.042138 10.7177 1.6308e-14  0.374328   0.544867
-## k_Z3        0.058693   0.015246  3.8498 1.7806e-04  0.034805   0.098978
-## f_Z2_to_Z3  0.471508   0.058352  8.0804 9.6648e-11  0.357735   0.588320
+## Z0_0       96.838721   1.994275 48.5584 4.0283e-42 92.826878 100.850563
+## k_Z0        2.215400   0.118459 18.7019 1.0414e-23  1.989462   2.466998
+## k_Z1        0.478301   0.028257 16.9267 6.2411e-22  0.424705   0.538662
+## k_Z2        0.451623   0.042138 10.7176 1.6313e-14  0.374336   0.544867
+## k_Z3        0.058694   0.015246  3.8499 1.7804e-04  0.034809   0.098967
+## f_Z2_to_Z3  0.471510   0.058352  8.0804 9.6640e-11  0.357775   0.588283
 ## sigma       3.984431   0.383402 10.3923 4.5575e-14  3.213126   4.755736
-
endpoints(m.Z.FOCUS)
+
endpoints(m.Z.FOCUS)
## $ff
 ##   Z2_Z3 Z2_sink 
 ## 0.47151 0.52849 
 ## 
-## $SFORB
-## logical(0)
-## 
 ## $distimes
 ##        DT50    DT90
 ## Z0  0.31288  1.0394
 ## Z1  1.44919  4.8141
-## Z2  1.53481  5.0985
-## Z3 11.80965 39.2308
+## Z2 1.53479 5.0985 +## Z3 11.80955 39.2305

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.

@@ -233,87 +239,85 @@ Using the SFORB model

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"))
+
Z.mkin.1 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
+                    Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+                    Z2 = mkinsub("SFO", "Z3"),
+                    Z3 = mkinsub("SFORB"))
## Successfully compiled differential equation model from auto-generated C code.
-
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)
+
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
+
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"))
+
Z.mkin.3 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
+                    Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+                    Z2 = mkinsub("SFO"))
## Successfully compiled differential equation model from auto-generated C code.
-
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
-
plot_sep(m.Z.mkin.3)
+
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
+
plot_sep(m.Z.mkin.3)

This results in a much better representation of the behaviour of the parent compound Z0.

Finally, Z3 is added as well. These models appear overparameterised (no covariance matrix returned) if the sink for Z1 is left in the models.

-
Z.mkin.4 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
-                    Z1 = mkinsub("SFO", "Z2", sink = FALSE),
-                    Z2 = mkinsub("SFO", "Z3"),
-                    Z3 = mkinsub("SFO"))
+
Z.mkin.4 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
+                    Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+                    Z2 = mkinsub("SFO", "Z3"),
+                    Z3 = mkinsub("SFO"))
## Successfully compiled differential equation model from auto-generated C code.
- +
m.Z.mkin.4 <- mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin,
+                      parms.ini = m.Z.mkin.3$bparms.ode,
+                      quiet = TRUE)
## Warning in mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin, parms.ini = m.Z.mkin.
 ## 3$bparms.ode, : Observations with value of zero were removed from the data
-
plot_sep(m.Z.mkin.4)
+
plot_sep(m.Z.mkin.4)

The error level of the fit, but especially of metabolite Z3, can be improved if the SFORB model is chosen for this metabolite, as this model is capable of representing the tailing of the metabolite decline phase.

-
Z.mkin.5 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
-                    Z1 = mkinsub("SFO", "Z2", sink = FALSE),
-                    Z2 = mkinsub("SFO", "Z3"),
-                    Z3 = mkinsub("SFORB"))
+
Z.mkin.5 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
+                    Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+                    Z2 = mkinsub("SFO", "Z3"),
+                    Z3 = mkinsub("SFORB"))
## Successfully compiled differential equation model from auto-generated C code.
- +
m.Z.mkin.5 <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin,
+                      parms.ini = m.Z.mkin.4$bparms.ode[1:4],
+                      quiet = TRUE)
## Warning in mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, parms.ini = m.Z.mkin.
-## 4$bparms.ode[1:4], : Observations with value of zero were removed from the
-## data
-
plot_sep(m.Z.mkin.5)
+## 4$bparms.ode[1:4], : Observations with value of zero were removed from the data +
plot_sep(m.Z.mkin.5)

The summary view of the backtransformed parameters shows that we get no confidence intervals due to overparameterisation. As the optimized is excessively small, it seems reasonable to fix it to zero.

- +
m.Z.mkin.5a <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin,
+                       parms.ini = c(m.Z.mkin.5$bparms.ode[1:7],
+                                     k_Z3_bound_free = 0),
+                       fixed_parms = "k_Z3_bound_free",
+                       quiet = TRUE)
## Warning in mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, parms.ini = c(m.Z.mkin.
-## 5$bparms.ode[1:7], : Observations with value of zero were removed from the
-## data
-
plot_sep(m.Z.mkin.5a)
+## 5$bparms.ode[1:7], : Observations with value of zero were removed from the data +
plot_sep(m.Z.mkin.5a)

As expected, the residual plots for Z0 and Z3 are more random than in the case of the all SFO model for which they were shown above. In conclusion, the model is proposed as the best-fit model for the dataset from Appendix 7 of the FOCUS report.

A graphical representation of the confidence intervals can finally be obtained.

-
mkinparplot(m.Z.mkin.5a)
+
mkinparplot(m.Z.mkin.5a)

The endpoints obtained with this model are

-
endpoints(m.Z.mkin.5a)
+
endpoints(m.Z.mkin.5a)
## $ff
-##   Z0_free_Z1        Z1_Z2      Z2_sink   Z2_Z3_free Z3_free_sink 
-##      1.00000      1.00000      0.46344      0.53656      1.00000 
+## Z0_free   Z2_Z3 Z2_sink Z3_free 
+## 1.00000 0.53656 0.46344 1.00000 
 ## 
 ## $SFORB
 ##     Z0_b1     Z0_b2     Z3_b1     Z3_b2 
-## 2.4471381 0.0075124 0.0800075 0.0000000 
+## 2.4471358 0.0075126 0.0800073 0.0000000 
 ## 
 ## $distimes
 ##      DT50   DT90 DT50_Z0_b1 DT50_Z0_b2 DT50_Z3_b1 DT50_Z3_b2
-## Z0 0.3043 1.1848    0.28325     92.267         NA         NA
+## Z0 0.3043 1.1848    0.28325     92.265         NA         NA
 ## Z1 1.5148 5.0320         NA         NA         NA         NA
 ## Z2 1.6414 5.4526         NA         NA         NA         NA
-## Z3     NA     NA         NA         NA     8.6635        Inf
+## Z3 NA NA NA NA 8.6636 Inf

It is clear the degradation rate of Z3 towards the end of the experiment is very low as DT50_Z3_b2 (the second Eigenvalue of the system of two differential equations representing the SFORB system for Z3, corresponding to the slower rate constant of the DFOP model) is reported to be infinity. However, this appears to be a feature of the data.

@@ -328,20 +332,11 @@
- @@ -352,7 +347,7 @@
-

Site built with pkgdown 1.4.1.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png index 76826836..23d051ce 100644 Binary files a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png and b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png differ 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 25249a9a..d3702fb6 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 f9c28e5a..4a6fce4f 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 6926c367..dd6537b7 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 7764f4e2..b986c30b 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_2-1.png b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png index c84e21f1..23d051ce 100644 Binary files a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png and b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png differ diff --git a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png index 38805220..6e9f4efa 100644 Binary files a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png and b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-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 e1cbf084..146acea9 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 30f6a0b7..47d806c0 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_7-1.png b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png index 891d95e1..7db8b07d 100644 Binary files a/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png and b/docs/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-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 ea4f89e6..0c698299 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 fecbe3b1..411341b8 100644 --- a/docs/articles/web_only/NAFTA_examples.html +++ b/docs/articles/web_only/NAFTA_examples.html @@ -6,19 +6,19 @@ Evaluation of example datasets from Attachment 1 to the US EPA SOP for the NAFTA guidance • mkin - - - - + + + + + - - + - +
@@ -87,12 +94,12 @@
@@ -112,12 +119,12 @@

Example on page 5, upper panel

-
p5a <- nafta(NAFTA_SOP_Attachment[["p5a"]])
+
p5a <- nafta(NAFTA_SOP_Attachment[["p5a"]])
## 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(p5a)
+
plot(p5a)

-
print(p5a)
+
print(p5a)
## Sums of squares:
 ##       SFO      IORE      DFOP 
 ## 465.21753  56.27506  32.06401 
@@ -143,7 +150,7 @@
 ##          Estimate   Pr(>t)   Lower    Upper
 ## parent_0 9.99e+01 1.41e-26 98.8116 101.0810
 ## k1       2.67e-02 5.05e-06  0.0243   0.0295
-## k2       2.86e-12 5.00e-01  0.0000      Inf
+## k2       2.17e-12 5.00e-01  0.0000      Inf
 ## g        6.47e-01 3.67e-06  0.6248   0.6677
 ## sigma    1.27e+00 8.91e-06  0.8395   1.6929
 ## 
@@ -152,7 +159,7 @@
 ##      DT50     DT90 DT50_rep
 ## SFO  67.7 2.25e+02 6.77e+01
 ## IORE 58.2 1.07e+03 3.22e+02
-## DFOP 55.5 4.42e+11 2.42e+11
+## DFOP 55.5 5.83e+11 3.20e+11
 ## 
 ## Representative half-life:
 ## [1] 321.51
@@ -160,12 +167,12 @@

Example on page 5, lower panel

-
p5b <- nafta(NAFTA_SOP_Attachment[["p5b"]])
+
p5b <- nafta(NAFTA_SOP_Attachment[["p5b"]])
## 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(p5b)
+
plot(p5b)

-
print(p5b)
+
print(p5b)
## Sums of squares:
 ##      SFO     IORE     DFOP 
 ## 94.81123 10.10936  7.55871 
@@ -191,7 +198,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       1.16e-11 5.00e-01  0.0000     Inf
+## k2       1.04e-11 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
 ## 
@@ -200,7 +207,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 9.80e+10 5.98e+10
+## DFOP 83.6 1.09e+11 6.67e+10
 ## 
 ## Representative half-life:
 ## [1] 215.87
@@ -208,12 +215,12 @@

Example on page 6

-
p6 <- nafta(NAFTA_SOP_Attachment[["p6"]])
+
p6 <- nafta(NAFTA_SOP_Attachment[["p6"]])
## 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(p6)
+
plot(p6)

-
print(p6)
+
print(p6)
## Sums of squares:
 ##       SFO      IORE      DFOP 
 ## 188.45361  51.00699  42.46931 
@@ -239,7 +246,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       4.90e-11 5.00e-01  0.0000     Inf
+## k2       3.88e-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
 ## 
@@ -248,7 +255,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 6.66e+09 1.41e+10
+## DFOP 34.1 8.42e+09 1.79e+10
 ## 
 ## Representative half-life:
 ## [1] 53.17
@@ -256,12 +263,12 @@

Example on page 7

-
p7 <- nafta(NAFTA_SOP_Attachment[["p7"]])
+
p7 <- nafta(NAFTA_SOP_Attachment[["p7"]])
## 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(p7)
+
plot(p7)

-
print(p7)
+
print(p7)
## Sums of squares:
 ##      SFO     IORE     DFOP 
 ## 3661.661 3195.030 3174.145 
@@ -287,7 +294,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       1.97e-10 5.00e-01  0.0000      Inf
+## k2       2.30e-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
 ## 
@@ -296,7 +303,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 6.97e+09 3.52e+09
+## DFOP 96.4 5.95e+09 3.01e+09
 ## 
 ## Representative half-life:
 ## [1] 454.55
@@ -309,12 +316,12 @@

Example on page 8

For this dataset, the IORE fit does not converge when the default starting values used by mkin for the IORE model are used. Therefore, a lower value for the rate constant is used here.

-
p8 <- nafta(NAFTA_SOP_Attachment[["p8"]], parms.ini = c(k__iore_parent_sink = 1e-3))
+
p8 <- nafta(NAFTA_SOP_Attachment[["p8"]], parms.ini = c(k__iore_parent_sink = 1e-3))
## 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(p8)
+
plot(p8)

-
print(p8)
+
print(p8)
## Sums of squares:
 ##       SFO      IORE      DFOP 
 ## 1996.9408  444.9237  547.5616 
@@ -361,12 +368,12 @@
 

Example on page 9, upper panel

-
p9a <- nafta(NAFTA_SOP_Attachment[["p9a"]])
+
p9a <- nafta(NAFTA_SOP_Attachment[["p9a"]])
## 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(p9a)
+
plot(p9a)

-
print(p9a)
+
print(p9a)
## Sums of squares:
 ##       SFO      IORE      DFOP 
 ## 839.35238  88.57064   9.93363 
@@ -392,7 +399,7 @@
 ##          Estimate   Pr(>t)  Lower  Upper
 ## parent_0 9.85e+01 2.54e-20 97.390 99.672
 ## k1       1.38e-01 3.52e-05  0.131  0.146
-## k2       6.02e-13 5.00e-01  0.000    Inf
+## k2       6.69e-13 5.00e-01  0.000    Inf
 ## g        6.52e-01 8.13e-06  0.642  0.661
 ## sigma    7.88e-01 6.13e-02  0.481  1.095
 ## 
@@ -401,7 +408,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 2.07e+12 1.15e+12
+## DFOP 10.5 1.86e+12 1.04e+12
 ## 
 ## Representative half-life:
 ## [1] 101.43
@@ -410,17 +417,12 @@

Example on page 9, lower panel

-
p9b <- nafta(NAFTA_SOP_Attachment[["p9b"]])
-
## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
-
## Warning in sqrt(diag(covar_notrans)): NaNs wurden erzeugt
-
## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
-
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite
-## result is doubtful
+
p9b <- nafta(NAFTA_SOP_Attachment[["p9b"]])
## 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)
+
plot(p9b)

-
print(p9b)
+
print(p9b)
## Sums of squares:
 ##      SFO     IORE     DFOP 
 ## 35.64867 23.22334 35.64867 
@@ -447,7 +449,7 @@
 ## parent_0  94.7123 1.61e-16 93.1355 96.2891
 ## k1         0.0389 1.43e-06  0.0312  0.0485
 ## k2         0.0389 6.67e-03  0.0186  0.0812
-## g          0.7742      NaN      NA      NA
+## g          0.7742 5.00e-01  0.0000  1.0000
 ## sigma      1.5957 2.50e-04  0.9135  2.2779
 ## 
 ## 
@@ -464,12 +466,12 @@
 

Example on page 10

-
p10 <- nafta(NAFTA_SOP_Attachment[["p10"]])
+
p10 <- nafta(NAFTA_SOP_Attachment[["p10"]])
## 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)
+
plot(p10)

-
print(p10)
+
print(p10)
## Sums of squares:
 ##      SFO     IORE     DFOP 
 ## 899.4089 336.4348 899.4089 
@@ -492,12 +494,12 @@
 ## sigma                   4.90 1.77e-04  2.837   6.968
 ## 
 ## $DFOP
-##          Estimate   Pr(>t)   Lower    Upper
-## parent_0 101.7315 1.41e-09 91.6534 111.8097
-## k1         0.0495 6.42e-04  0.0301   0.0814
-## k2         0.0495 1.66e-02  0.0200   0.1225
-## g          0.6634 5.00e-01  0.0000   1.0000
-## sigma      8.0152 2.50e-04  4.5886  11.4418
+##          Estimate   Pr(>t)   Lower   Upper
+## parent_0 101.7315 1.41e-09 91.6534 111.810
+## k1         0.0495 6.48e-04  0.0303   0.081
+## k2         0.0495 1.67e-02  0.0201   0.122
+## g          0.6634 5.00e-01  0.0000   1.000
+## sigma      8.0152 2.50e-04  4.5886  11.442
 ## 
 ## 
 ## DTx values:
@@ -517,12 +519,12 @@
 

Example on page 11

-
p11 <- nafta(NAFTA_SOP_Attachment[["p11"]])
+
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)
+
plot(p11)

-
print(p11)
+
print(p11)
## Sums of squares:
 ##      SFO     IORE     DFOP 
 ## 579.6805 204.7932 144.7783 
@@ -560,7 +562,7 @@
 ## DFOP 4.21e+11 2.64e+12 9.56e+11
 ## 
 ## Representative half-life:
-## [1] 41148169
+## [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.

@@ -571,14 +573,14 @@

Example on page 12, upper panel

-
p12a <- nafta(NAFTA_SOP_Attachment[["p12a"]])
-
## Warning in summary.mkinfit(x): Could not calculate correlation; no
-## covariance matrix
+
p12a <- nafta(NAFTA_SOP_Attachment[["p12a"]])
+
## Warning in summary.mkinfit(x): Could not calculate correlation; no covariance
+## matrix
## 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)
+
plot(p12a)

-
print(p12a)
+
print(p12a)
## Sums of squares:
 ##      SFO     IORE     DFOP 
 ## 695.4440 220.0685 695.4440 
@@ -603,8 +605,8 @@
 ## $DFOP
 ##          Estimate   Pr(>t)   Lower   Upper
 ## parent_0  100.521 2.74e-10 92.2366 108.805
-## k1          0.124 5.74e-06  0.0958   0.161
-## k2          0.124 6.61e-02  0.0319   0.484
+## k1          0.124 5.75e-06  0.0958   0.161
+## k2          0.124 6.72e-02  0.0319   0.484
 ## g           0.877 5.00e-01  0.0000   1.000
 ## sigma       7.048 2.50e-04  4.0349  10.061
 ## 
@@ -621,20 +623,20 @@
 

Example on page 12, lower panel

-
p12b <- nafta(NAFTA_SOP_Attachment[["p12b"]])
+
p12b <- nafta(NAFTA_SOP_Attachment[["p12b"]])
## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
## Warning in qt(alpha/2, rdf): NaNs wurden erzeugt
## Warning in qt(1 - alpha/2, rdf): NaNs wurden erzeugt
## Warning in sqrt(diag(covar_notrans)): NaNs wurden erzeugt
## Warning in pt(abs(tval), rdf, lower.tail = FALSE): NaNs wurden erzeugt
## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
-
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite
-## result is doubtful
+
## 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(p12b)
+
plot(p12b)

-
print(p12b)
+
print(p12b)
## Sums of squares:
 ##      SFO     IORE     DFOP 
 ## 58.90242 19.06353 58.90242 
@@ -677,16 +679,12 @@
 

Example on page 13

-
p13 <- nafta(NAFTA_SOP_Attachment[["p13"]])
-
## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
-
## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
-
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite
-## result is doubtful
+
p13 <- nafta(NAFTA_SOP_Attachment[["p13"]])
## 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)
+
plot(p13)

-
print(p13)
+
print(p13)
## Sums of squares:
 ##      SFO     IORE     DFOP 
 ## 174.5971 142.3951 174.5971 
@@ -711,9 +709,9 @@
 ## $DFOP
 ##          Estimate   Pr(>t)    Lower    Upper
 ## parent_0 92.73500 9.25e-15 8.95e+01 9.59e+01
-## k1        0.00258 4.28e-01 1.70e-08 3.92e+02
+## k1        0.00258 4.28e-01 1.45e-08 4.61e+02
 ## k2        0.00258 3.69e-08 2.20e-03 3.03e-03
-## g         0.00442 5.00e-01       NA       NA
+## g         0.00442 5.00e-01 0.00e+00 1.00e+00
 ## sigma     3.41172 1.35e-04 2.02e+00 4.80e+00
 ## 
 ## 
@@ -730,16 +728,16 @@
 

DT50 not observed in the study and DFOP problems in PestDF

-
p14 <- nafta(NAFTA_SOP_Attachment[["p14"]])
+
p14 <- nafta(NAFTA_SOP_Attachment[["p14"]])
## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
-
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite
-## result is doubtful
+
## 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(p14)
+
plot(p14)

-
print(p14)
+
print(p14)
## Sums of squares:
 ##      SFO     IORE     DFOP 
 ## 48.43249 28.67746 27.26248 
@@ -765,7 +763,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       7.29e-12 5.00e-01  0.00000      Inf
+## k2       7.70e-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
 ## 
@@ -774,7 +772,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 2.54e+10 2.46e+11 9.51e+10
+## DFOP 2.41e+10 2.33e+11 9.00e+10
 ## 
 ## Representative half-life:
 ## [1] 6697.44
@@ -783,17 +781,16 @@

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

-
p15a <- nafta(NAFTA_SOP_Attachment[["p15a"]])
+
p15a <- nafta(NAFTA_SOP_Attachment[["p15a"]])
## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
-
## Warning in sqrt(diag(covar_notrans)): NaNs wurden erzeugt
## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
-
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite
-## result is doubtful
+
## 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)
+
plot(p15a)

-
print(p15a)
+
print(p15a)
## Sums of squares:
 ##      SFO     IORE     DFOP 
 ## 245.5248 135.0132 245.5248 
@@ -816,12 +813,12 @@
 ## sigma                  3.105 1.78e-04  1.795  4.416
 ## 
 ## $DFOP
-##          Estimate   Pr(>t)    Lower    Upper
-## parent_0 97.96752 2.85e-13 94.21914 101.7159
-## k1        0.00952 6.80e-02  0.00277   0.0327
-## k2        0.00952 3.82e-06  0.00902   0.0100
-## g         0.17247      NaN       NA       NA
-## sigma     4.18778 2.50e-04  2.39747   5.9781
+##          Estimate Pr(>t)    Lower    Upper
+## parent_0 97.96752     NA 94.21914 101.7159
+## k1        0.00952     NA  0.00241   0.0377
+## k2        0.00952     NA  0.00747   0.0121
+## g         0.17247     NA       NA       NA
+## sigma     4.18778     NA  2.39747   5.9781
 ## 
 ## 
 ## DTx values:
@@ -832,16 +829,16 @@
 ## 
 ## Representative half-life:
 ## [1] 41.33
-
p15b <- nafta(NAFTA_SOP_Attachment[["p15b"]])
+
p15b <- nafta(NAFTA_SOP_Attachment[["p15b"]])
## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
-
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite
-## result is doubtful
+
## 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)
+
plot(p15b)

-
print(p15b)
+
print(p15b)
## Sums of squares:
 ##       SFO      IORE      DFOP 
 ## 106.91629  68.55574 106.91629 
@@ -858,18 +855,18 @@
 ## 
 ## $IORE
 ##                     Estimate   Pr(>t)    Lower  Upper
-## parent_0               99.83 1.81e-16 97.51349 102.14
+## parent_0               99.83 1.81e-16 97.51348 102.14
 ## k__iore_parent_sink     0.38 3.22e-01  0.00352  41.05
-## N_parent                0.00 5.00e-01 -1.07695   1.08
+## N_parent                0.00 5.00e-01 -1.07696   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 6.75e-04 3.49e-02
-## k2       4.86e-03     NA 3.37e-03 6.99e-03
+## parent_0 1.01e+02     NA 98.24464 1.04e+02
+## k1       4.86e-03     NA  0.00068 3.47e-02
+## k2       4.86e-03     NA  0.00338 6.99e-03
 ## g        1.50e-01     NA       NA       NA
-## sigma    2.76e+00     NA 1.58e+00 3.94e+00
+## sigma    2.76e+00     NA  1.58208 3.94e+00
 ## 
 ## 
 ## DTx values:
@@ -885,14 +882,14 @@
 

The DFOP fraction parameter is greater than 1

-
p16 <- nafta(NAFTA_SOP_Attachment[["p16"]])
+
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)
+
plot(p16)

-
print(p16)
+
print(p16)
## Sums of squares:
 ##      SFO     IORE     DFOP 
 ## 3831.804 2062.008 1550.980 
@@ -917,7 +914,7 @@
 ## $DFOP
 ##          Estimate   Pr(>t)   Lower  Upper
 ## parent_0  88.5333 7.40e-18 79.9836 97.083
-## k1        18.5561 5.00e-01  0.0000    Inf
+## k1        18.5560 5.00e-01  0.0000    Inf
 ## k2         0.0776 1.41e-05  0.0518  0.116
 ## g          0.4733 1.41e-09  0.3674  0.582
 ## sigma      7.1902 2.11e-08  5.2785  9.102
@@ -950,53 +947,11 @@
 
- @@ -1007,7 +962,7 @@
-

Site built with pkgdown 1.4.1.

+

Site built with pkgdown 1.5.1.

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 ef5e72ed..218a790f 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 ad7cf62c..b47df46f 100644 --- a/docs/articles/web_only/benchmarks.html +++ b/docs/articles/web_only/benchmarks.html @@ -5,13 +5,13 @@ -Benchmark timings for mkin on various systems • mkin +Benchmark timings for mkin • mkin - + - - - + + + + + - - + - +
@@ -87,12 +94,12 @@
@@ -103,99 +110,90 @@

How to benefit from compiled models

When using an mkin version equal to or greater than 0.9-36 and a C compiler is available, you will see a message that the model is being compiled from autogenerated C code when defining a model using mkinmod. Starting from version 0.9.49.9, the mkinmod() function checks for presence of a compiler using

- +
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 gcc or clang installed. On Debian based linux distributions, these will be pulled in by installing the build-essential package.

On MacOS, which I do not use personally, I have had reports that a compiler is available by default.

On Windows, you need to install Rtools and have the path to its bin directory in your PATH variable. You do not need to modify the PATH variable when installing Rtools. Instead, I would recommend to put the line

-
Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
+
Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))

into your .Rprofile startup file. This is just a text file with some R code that is executed when your R session starts. It has to be named .Rprofile and has to be located in your home directory, which will generally be your Documents folder. You can check the location of the home directory used by R by issuing

-
Sys.getenv("HOME")
+
Sys.getenv("HOME")
-
+

-Comparison with Eigenvalue based solutions

-

First, we build a simple degradation model for a parent compound with one metabolite.

-
library("mkin", quietly = TRUE)
-SFO_SFO <- mkinmod(
-  parent = mkinsub("SFO", "m1"),
-  m1 = mkinsub("SFO"))
+Comparison with other solution methods +

First, we build a simple degradation model for a parent compound with one metabolite, and we remove zero values from the dataset.

+
library("mkin", quietly = TRUE)
+SFO_SFO <- mkinmod(
+  parent = mkinsub("SFO", "m1"),
+  m1 = mkinsub("SFO"))
## Successfully compiled differential equation model from auto-generated C code.
-

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.

- -
##                    test replications elapsed relative user.self sys.self
-## 3     deSolve, compiled            3   3.107    1.000     3.105        0
-## 1 deSolve, not compiled            3  28.765    9.258    28.749        0
-## 2      Eigenvalue based            3   4.446    1.431     4.445        0
-##   user.child sys.child
-## 3          0         0
-## 1          0         0
-## 2          0         0
-

We see that using the compiled model is by a factor of around 9 faster than using the R version with the default ode solver, and it is even faster than the Eigenvalue based solution implemented in R which does not need iterative solution of the ODEs.

+
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(
+    "deSolve, not compiled" = mkinfit(SFO_SFO, FOCUS_D,
+       solution_type = "deSolve",
+       use_compiled = FALSE, quiet = TRUE),
+    "Eigenvalue based" = mkinfit(SFO_SFO, FOCUS_D,
+       solution_type = "eigen", quiet = TRUE),
+    "deSolve, compiled" = mkinfit(SFO_SFO, FOCUS_D,
+       solution_type = "deSolve", quiet = TRUE),
+    "analytical" = mkinfit(SFO_SFO, FOCUS_D,
+       solution_type = "analytical",
+       use_compiled = FALSE, quiet = TRUE),
+    replications = 1, order = "relative",
+    columns = c("test", "replications", "relative", "elapsed"))
+  print(b.1)
+} else {
+  print("R package rbenchmark is not available")
+}
+
##                    test replications relative elapsed
+## 4            analytical            1    1.000   0.190
+## 3     deSolve, compiled            1    1.774   0.337
+## 2      Eigenvalue based            1    2.105   0.400
+## 1 deSolve, not compiled            1   42.763   8.125
+

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

-
+

-Model that can not be solved with Eigenvalues

-

This evaluation is also taken from the example section of mkinfit.

-
if (require(rbenchmark)) {
-  FOMC_SFO <- mkinmod(
-    parent = mkinsub("FOMC", "m1"),
-    m1 = mkinsub( "SFO"))
-
-  b.2 <- benchmark(
-    "deSolve, not compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D,
-                                      use_compiled = FALSE, quiet = TRUE),
-    "deSolve, compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE),
-    replications = 3)
-  print(b.2)
-  factor_FOMC_SFO <- round(b.2["1", "relative"])
-} else {
-  factor_FOMC_SFO <- NA
-  print("R package benchmark is not available")
-}
+Model without analytical solution +

This evaluation is also taken from the example section of mkinfit. No analytical solution is available for this system, and now Eigenvalue based solution is possible, so only deSolve using with or without compiled code is available.

+
if (require(rbenchmark)) {
+  FOMC_SFO <- mkinmod(
+    parent = mkinsub("FOMC", "m1"),
+    m1 = mkinsub( "SFO"))
+
+  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),
+    replications = 1, order = "relative",
+    columns = c("test", "replications", "relative", "elapsed"))
+  print(b.2)
+  factor_FOMC_SFO <- round(b.2["1", "relative"])
+} else {
+  factor_FOMC_SFO <- NA
+  print("R package benchmark is not available")
+}
## Successfully compiled differential equation model from auto-generated C code.
-
##                    test replications elapsed relative user.self sys.self
-## 2     deSolve, compiled            3   4.844    1.000     4.842        0
-## 1 deSolve, not compiled            3  53.833   11.113    53.807        0
-##   user.child sys.child
-## 2          0         0
-## 1          0         0
-

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

-

This vignette was built with mkin 0.9.49.9 on

-
## R version 3.6.3 (2020-02-29)
+
##                    test replications relative elapsed
+## 2     deSolve, compiled            1    1.000   0.476
+## 1 deSolve, not compiled            1   30.103  14.329
+

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

+

This vignette was built with mkin 0.9.50.2 on

+
## R version 4.0.0 (2020-04-24)
 ## Platform: x86_64-pc-linux-gnu (64-bit)
 ## Running under: Debian GNU/Linux 10 (buster)
## CPU model: AMD Ryzen 7 1700 Eight-Core Processor
- @@ -206,7 +204,7 @@
-

Site built with pkgdown 1.4.1.

+

Site built with pkgdown 1.5.1.

-- cgit v1.2.1