From 092c6fdc8b8bbadd3724b4023de60b7f1fe1500f Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 21 Jul 2017 18:05:21 +0200 Subject: Fix another URL, vignette builder, rebuild --- vignettes/FOCUS_D.html | 18 ++++----- vignettes/FOCUS_L.html | 90 ++++++++++++++++++++--------------------- vignettes/FOCUS_Z.pdf | Bin 240492 -> 240659 bytes vignettes/compiled_models.Rmd | 1 + vignettes/compiled_models.html | 15 +++---- vignettes/mkin.html | 3 +- vignettes/references.bib | 4 +- vignettes/twa.Rmd | 1 + 8 files changed, 68 insertions(+), 64 deletions(-) (limited to 'vignettes') diff --git a/vignettes/FOCUS_D.html b/vignettes/FOCUS_D.html index 5da77efa..44bbe062 100644 --- a/vignettes/FOCUS_D.html +++ b/vignettes/FOCUS_D.html @@ -11,7 +11,7 @@ - + Example evaluation of FOCUS Example Dataset D @@ -119,7 +119,7 @@ $(document).ready(function () {

Example evaluation of FOCUS Example Dataset D

Johannes Ranke

-

2017-05-05

+

2017-07-21

@@ -190,16 +190,16 @@ $(document).ready(function () {
fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)

A plot of the fit including a residual plot for both observed variables is obtained using the plot_sep method for mkinfit objects, which shows separate graphs for all compounds and their residuals.

plot_sep(fit, lpos = c("topright", "bottomright"))
-

+

Confidence intervals for the parameter estimates are obtained using the mkinparplot function.

mkinparplot(fit)
-

+

A comprehensive report of the results is obtained using the summary method for mkinfit objects.

summary(fit)
-
## mkin version:    0.9.45 
-## R version:       3.4.0 
-## Date of fit:     Fri May  5 12:14:00 2017 
-## Date of summary: Fri May  5 12:14:00 2017 
+
## mkin version:    0.9.45.2 
+## R version:       3.4.1 
+## Date of fit:     Fri Jul 21 18:02:19 2017 
+## Date of summary: Fri Jul 21 18:02:20 2017 
 ## 
 ## Equations:
 ## d_parent/dt = - k_parent_sink * parent - k_parent_m1 * parent
@@ -207,7 +207,7 @@ $(document).ready(function () {
 ## 
 ## Model predictions using solution type deSolve 
 ## 
-## Fitted with method Port using 153 model solutions performed in 1.033 s
+## Fitted with method Port using 153 model solutions performed in 1.059 s
 ## 
 ## Weighting: none
 ## 
diff --git a/vignettes/FOCUS_L.html b/vignettes/FOCUS_L.html
index fd531133..180c0323 100644
--- a/vignettes/FOCUS_L.html
+++ b/vignettes/FOCUS_L.html
@@ -11,7 +11,7 @@
 
 
 
-
+
 
 Example evaluation of FOCUS Laboratory Data L1 to L3
 
@@ -223,7 +223,7 @@ div.tocify {
 
 

Example evaluation of FOCUS Laboratory Data L1 to L3

Johannes Ranke

-

2017-05-05

+

2017-07-21

@@ -242,17 +242,17 @@ FOCUS_2006_L1_mkin <- mkin_wide_to_long(FOCUS_2006_L1)

Since mkin version 0.9-32 (July 2014), we can use shorthand notation like "SFO" for parent only degradation models. The following two lines fit the model and produce the summary report of the model fit. This covers the numerical analysis given in the FOCUS report.

m.L1.SFO <- mkinfit("SFO", FOCUS_2006_L1_mkin, quiet = TRUE)
 summary(m.L1.SFO)
-
## mkin version:    0.9.45 
-## R version:       3.4.0 
-## Date of fit:     Fri May  5 12:14:02 2017 
-## Date of summary: Fri May  5 12:14:02 2017 
+
## mkin version:    0.9.45.2 
+## R version:       3.4.1 
+## Date of fit:     Fri Jul 21 18:02:22 2017 
+## Date of summary: Fri Jul 21 18:02:22 2017 
 ## 
 ## Equations:
 ## d_parent/dt = - k_parent_sink * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Port using 37 model solutions performed in 0.263 s
+## Fitted with method Port using 37 model solutions performed in 0.258 s
 ## 
 ## Weighting: none
 ## 
@@ -324,21 +324,21 @@ summary(m.L1.SFO)
## 30 parent 4.0 5.251 -1.2513

A plot of the fit is obtained with the plot function for mkinfit objects.

plot(m.L1.SFO, show_errmin = TRUE, main = "FOCUS L1 - SFO")
-

+

The residual plot can be easily obtained by

mkinresplot(m.L1.SFO, ylab = "Observed", xlab = "Time")
-

+

For comparison, the FOMC model is fitted as well, and the χ2 error level is checked.

m.L1.FOMC <- mkinfit("FOMC", FOCUS_2006_L1_mkin, quiet=TRUE)
## Warning in mkinfit("FOMC", FOCUS_2006_L1_mkin, quiet = TRUE): Optimisation by method Port did not converge.
 ## Convergence code is 1
plot(m.L1.FOMC, show_errmin = TRUE, main = "FOCUS L1 - FOMC")
-

+

summary(m.L1.FOMC, data = FALSE)
-
## mkin version:    0.9.45 
-## R version:       3.4.0 
-## Date of fit:     Fri May  5 12:14:03 2017 
-## Date of summary: Fri May  5 12:14:03 2017 
+
## mkin version:    0.9.45.2 
+## R version:       3.4.1 
+## Date of fit:     Fri Jul 21 18:02:23 2017 
+## Date of summary: Fri Jul 21 18:02:23 2017 
 ## 
 ## 
 ## Warning: Optimisation by method Port did not converge.
@@ -350,7 +350,7 @@ summary(m.L1.SFO)
## ## Model predictions using solution type analytical ## -## Fitted with method Port using 155 model solutions performed in 0.439 s +## Fitted with method Port using 155 model solutions performed in 0.445 s ## ## Weighting: none ## @@ -419,7 +419,7 @@ FOCUS_2006_L2_mkin <- mkin_wide_to_long(FOCUS_2006_L2)
m.L2.SFO <- mkinfit("SFO", FOCUS_2006_L2_mkin, quiet=TRUE)
 plot(m.L2.SFO, show_residuals = TRUE, show_errmin = TRUE,
      main = "FOCUS L2 - SFO")
-

+

The χ2 error level of 14% suggests that the model does not fit very well. This is also obvious from the plots of the fit, in which we have included the residual plot.

In the FOCUS kinetics report, it is stated that there is no apparent systematic error observed from the residual plot up to the measured DT90 (approximately at day 5), and there is an underestimation beyond that point.

We may add that it is difficult to judge the random nature of the residuals just from the three samplings at days 0, 1 and 3. Also, it is not clear a priori why a consistent underestimation after the approximate DT90 should be irrelevant. However, this can be rationalised by the fact that the FOCUS fate models generally only implement SFO kinetics.

@@ -430,19 +430,19 @@ plot(m.L2.SFO, show_residuals = TRUE, show_errmin = TRUE,
m.L2.FOMC <- mkinfit("FOMC", FOCUS_2006_L2_mkin, quiet = TRUE)
 plot(m.L2.FOMC, show_residuals = TRUE,
      main = "FOCUS L2 - FOMC")
-

+

summary(m.L2.FOMC, data = FALSE)
-
## mkin version:    0.9.45 
-## R version:       3.4.0 
-## Date of fit:     Fri May  5 12:14:04 2017 
-## Date of summary: Fri May  5 12:14:04 2017 
+
## mkin version:    0.9.45.2 
+## R version:       3.4.1 
+## Date of fit:     Fri Jul 21 18:02:24 2017 
+## Date of summary: Fri Jul 21 18:02:24 2017 
 ## 
 ## Equations:
 ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Port using 81 model solutions performed in 0.171 s
+## Fitted with method Port using 81 model solutions performed in 0.246 s
 ## 
 ## Weighting: none
 ## 
@@ -500,12 +500,12 @@ plot(m.L2.FOMC, show_residuals = TRUE,
 
m.L2.DFOP <- mkinfit("DFOP", FOCUS_2006_L2_mkin, quiet = TRUE)
 plot(m.L2.DFOP, show_residuals = TRUE, show_errmin = TRUE,
      main = "FOCUS L2 - DFOP")
-

+

summary(m.L2.DFOP, data = FALSE)
-
## mkin version:    0.9.45 
-## R version:       3.4.0 
-## Date of fit:     Fri May  5 12:14:05 2017 
-## Date of summary: Fri May  5 12:14:05 2017 
+
## mkin version:    0.9.45.2 
+## R version:       3.4.1 
+## Date of fit:     Fri Jul 21 18:02:24 2017 
+## Date of summary: Fri Jul 21 18:02:24 2017 
 ## 
 ## Equations:
 ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) *
@@ -583,7 +583,7 @@ FOCUS_2006_L3_mkin <- mkin_wide_to_long(FOCUS_2006_L3)
mm.L3 <- mmkin(c("SFO", "FOMC", "DFOP"), cores = 1, list("FOCUS L3" = FOCUS_2006_L3_mkin), quiet = TRUE) plot(mm.L3)
-

+

The χ2 error level of 21% as well as the plot suggest that the SFO model does not fit very well. The FOMC model performs better, with an error level at which the χ2 test passes of 7%. Fitting the four parameter DFOP model further reduces the χ2 error level considerably.

@@ -591,10 +591,10 @@ plot(mm.L3)

The objects returned by mmkin are arranged like a matrix, with models as a row index and datasets as a column index.

We can extract the summary and plot for e.g. the DFOP fit, using square brackets for indexing which will result in the use of the summary and plot functions working on mkinfit objects.

summary(mm.L3[["DFOP", 1]])
-
## mkin version:    0.9.45 
-## R version:       3.4.0 
-## Date of fit:     Fri May  5 12:14:06 2017 
-## Date of summary: Fri May  5 12:14:06 2017 
+
## mkin version:    0.9.45.2 
+## R version:       3.4.1 
+## Date of fit:     Fri Jul 21 18:02:25 2017 
+## Date of summary: Fri Jul 21 18:02:25 2017 
 ## 
 ## Equations:
 ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) *
@@ -603,7 +603,7 @@ plot(mm.L3)
## ## Model predictions using solution type analytical ## -## Fitted with method Port using 137 model solutions performed in 0.348 s +## Fitted with method Port using 137 model solutions performed in 0.371 s ## ## Weighting: none ## @@ -670,7 +670,7 @@ plot(mm.L3)
## 91 parent 15.0 15.18 -0.18181 ## 120 parent 12.0 10.19 1.81395
plot(mm.L3[["DFOP", 1]], show_errmin = TRUE)
-

+

Here, a look to the model plot, the confidence intervals of the parameters and the correlation matrix suggest that the parameter estimates are reliable, and the DFOP model can be used as the best-fit model based on the χ2 error level criterion for laboratory data L3.

This is also an example where the standard t-test for the parameter g_ilr is misleading, as it tests for a significant difference from zero. In this case, zero appears to be the correct value for this parameter, and the confidence interval for the backtransformed parameter g is quite narrow.

@@ -688,20 +688,20 @@ mm.L4 <- mmkin(c("SFO", "FOMC"), cores = 1, list("FOCUS L4" = FOCUS_2006_L4_mkin), quiet = TRUE) plot(mm.L4)
-

+

The χ2 error level of 3.3% as well as the plot suggest that the SFO model fits very well. The error level at which the χ2 test passes is slightly lower for the FOMC model. However, the difference appears negligible.

summary(mm.L4[["SFO", 1]], data = FALSE)
-
## mkin version:    0.9.45 
-## R version:       3.4.0 
-## Date of fit:     Fri May  5 12:14:06 2017 
-## Date of summary: Fri May  5 12:14:06 2017 
+
## mkin version:    0.9.45.2 
+## R version:       3.4.1 
+## Date of fit:     Fri Jul 21 18:02:26 2017 
+## Date of summary: Fri Jul 21 18:02:26 2017 
 ## 
 ## Equations:
 ## d_parent/dt = - k_parent_sink * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Port using 46 model solutions performed in 0.096 s
+## Fitted with method Port using 46 model solutions performed in 0.098 s
 ## 
 ## Weighting: none
 ## 
@@ -751,17 +751,17 @@ plot(mm.L4)
## DT50 DT90 ## parent 106 352
summary(mm.L4[["FOMC", 1]], data = FALSE)
-
## mkin version:    0.9.45 
-## R version:       3.4.0 
-## Date of fit:     Fri May  5 12:14:06 2017 
-## Date of summary: Fri May  5 12:14:06 2017 
+
## mkin version:    0.9.45.2 
+## R version:       3.4.1 
+## Date of fit:     Fri Jul 21 18:02:26 2017 
+## Date of summary: Fri Jul 21 18:02:26 2017 
 ## 
 ## Equations:
 ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Port using 66 model solutions performed in 0.138 s
+## Fitted with method Port using 66 model solutions performed in 0.141 s
 ## 
 ## Weighting: none
 ## 
diff --git a/vignettes/FOCUS_Z.pdf b/vignettes/FOCUS_Z.pdf
index f7c67277..9b8f914d 100644
Binary files a/vignettes/FOCUS_Z.pdf and b/vignettes/FOCUS_Z.pdf differ
diff --git a/vignettes/compiled_models.Rmd b/vignettes/compiled_models.Rmd
index 956f428a..21b6b0d5 100644
--- a/vignettes/compiled_models.Rmd
+++ b/vignettes/compiled_models.Rmd
@@ -5,6 +5,7 @@ output: rmarkdown::html_vignette
 date: "`r Sys.Date()`"
 vignette: >
   %\VignetteIndexEntry{Performance benefit by using compiled model definitions in mkin}
+  %\VignetteEngine{knitr::rmarkdown}
   %\VignetteEncoding{UTF-8}
 ---
 
diff --git a/vignettes/compiled_models.html b/vignettes/compiled_models.html
index ee3347ca..30f29699 100644
--- a/vignettes/compiled_models.html
+++ b/vignettes/compiled_models.html
@@ -85,6 +85,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
 
## Loading required package: minpack.lm
## Loading required package: rootSolve
## Loading required package: inline
+
## Loading required package: methods
## Loading required package: parallel
SFO_SFO <- mkinmod(
   parent = mkinsub("SFO", "m1"),
@@ -109,14 +110,14 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
 }
## Loading required package: rbenchmark
##                    test replications elapsed relative user.self sys.self
-## 3     deSolve, compiled            3   2.101    1.000     2.100    0.000
-## 1 deSolve, not compiled            3  25.685   12.225    25.600    0.088
-## 2      Eigenvalue based            3   2.729    1.299     2.728    0.000
+## 3     deSolve, compiled            3   2.140    1.000     2.140        0
+## 1 deSolve, not compiled            3  15.070    7.042    15.068        0
+## 2      Eigenvalue based            3   2.577    1.204     2.576        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 12 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.

+

We see that using the compiled model is by a factor of around 7 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.

Model that can not be solved with Eigenvalues

@@ -139,12 +140,12 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf }
## Successfully compiled differential equation model from auto-generated C code.
##                    test replications elapsed relative user.self sys.self
-## 2     deSolve, compiled            3   3.590    1.000     3.592    0.000
-## 1 deSolve, not compiled            3  51.219   14.267    51.028    0.192
+## 2     deSolve, compiled            3   3.646    1.000     3.644        0
+## 1 deSolve, not compiled            3  30.752    8.434    30.752        0
 ##   user.child sys.child
 ## 2          0         0
 ## 1          0         0
-

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

+

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

This vignette was built with mkin 0.9.45.2 on

## R version 3.4.1 (2017-06-30)
 ## Platform: x86_64-pc-linux-gnu (64-bit)
diff --git a/vignettes/mkin.html b/vignettes/mkin.html
index 9b0a4675..5c9c1a84 100644
--- a/vignettes/mkin.html
+++ b/vignettes/mkin.html
@@ -247,6 +247,7 @@ div.tocify {
 
## Loading required package: minpack.lm
## Loading required package: rootSolve
## Loading required package: inline
+
## Loading required package: methods
## Loading required package: parallel
# Define the kinetic model
 m_SFO_SFO_SFO <- mkinmod(parent = mkinsub("SFO", "M1"),
@@ -327,7 +328,7 @@ plot_sep(f_SFO_SFO_SFO, lpos = c("topright", "bottomright",
 

Bates, D., and D. Watts. 1988. Nonlinear Regression and Its Applications. Wiley-Interscience.

-

FOCUS Work Group on Degradation Kinetics. 2006. Guidance Document on Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in Eu Registration. Report of the Focus Work Group on Degradation Kinetics. http://focus.jrc.ec.europa.eu/dk.

+

FOCUS Work Group on Degradation Kinetics. 2006. Guidance Document on Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in Eu Registration. Report of the Focus Work Group on Degradation Kinetics. http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics.

———. 2014. Generic Guidance for Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in Eu Registration. 1.1 ed. http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics.

diff --git a/vignettes/references.bib b/vignettes/references.bib index 118b0cc7..efccb362 100644 --- a/vignettes/references.bib +++ b/vignettes/references.bib @@ -16,7 +16,7 @@ month = {November}, year = {2011}, file = {FOCUS kinetics 2011 Generic guidance:/home/ranke/dok/orgs/focus/FOCUSkineticsvc_1_0_Nov23.pdf:PDF}, - url = {http://focus.jrc.ec.europa.eu/dk} + url = {http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} } @MANUAL{FOCUSkinetics2014, @@ -37,7 +37,7 @@ author = {{FOCUS Work Group on Degradation Kinetics}}, year = {2006}, note = {EC Document Reference Sanco/10058/2005 version 2.0}, - url = {http://focus.jrc.ec.europa.eu/dk} + url = {http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} } @MANUAL{rcore2016, diff --git a/vignettes/twa.Rmd b/vignettes/twa.Rmd index a37a1c00..22a4d5a3 100644 --- a/vignettes/twa.Rmd +++ b/vignettes/twa.Rmd @@ -6,6 +6,7 @@ bibliography: references.bib output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Calculation of time weighted average concentrations with mkin} + %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- -- cgit v1.2.1