From 373d98038c514c5152478127a8a2b9b390ee1b58 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sun, 14 Jan 2018 18:37:07 +0100 Subject: Load mkin quietly in vignettes Static documentation articles rebuilt by pkgdown::build_articles() --- vignettes/FOCUS_D.Rmd | 2 +- vignettes/FOCUS_D.html | 16 ++++----- vignettes/FOCUS_L.html | 80 +++++++++++++++++++++--------------------- vignettes/FOCUS_Z.Rmd | 2 +- vignettes/FOCUS_Z.html | 6 ++-- vignettes/compiled_models.Rmd | 2 +- vignettes/compiled_models.html | 27 ++++++-------- vignettes/mkin.Rmd | 2 +- vignettes/mkin.html | 6 ++-- 9 files changed, 69 insertions(+), 74 deletions(-) (limited to 'vignettes') diff --git a/vignettes/FOCUS_D.Rmd b/vignettes/FOCUS_D.Rmd index 9cb9c529..037dd854 100644 --- a/vignettes/FOCUS_D.Rmd +++ b/vignettes/FOCUS_D.Rmd @@ -24,7 +24,7 @@ named `parent` and `m1`. ```{r data} -library("mkin") +library("mkin", quietly = TRUE) print(FOCUS_2006_D) ``` diff --git a/vignettes/FOCUS_D.html b/vignettes/FOCUS_D.html index abd7d129..84e3748c 100644 --- a/vignettes/FOCUS_D.html +++ b/vignettes/FOCUS_D.html @@ -12,7 +12,7 @@ - + Example evaluation of FOCUS Example Dataset D @@ -70,12 +70,12 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf

Example evaluation of FOCUS Example Dataset D

Johannes Ranke

-

2017-11-16

+

2018-01-14

This is just a very simple vignette showing how to fit a degradation model for a parent compound with one transformation product using mkin. After loading the library we look a the data. We have observed concentrations in the column named value at the times specified in column time for the two observed variables named parent and m1.

-
library("mkin")
+
library("mkin", quietly = TRUE)
 print(FOCUS_2006_D)
##      name time  value
 ## 1  parent    0  99.46
@@ -141,10 +141,10 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
 

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

summary(fit)
-
## mkin version:    0.9.46.2 
-## R version:       3.4.2 
-## Date of fit:     Thu Nov 16 17:07:26 2017 
-## Date of summary: Thu Nov 16 17:07:27 2017 
+
## mkin version:    0.9.47.1 
+## R version:       3.4.3 
+## Date of fit:     Sun Jan 14 17:50:03 2018 
+## Date of summary: Sun Jan 14 17:50:03 2018 
 ## 
 ## Equations:
 ## d_parent/dt = - k_parent_sink * parent - k_parent_m1 * parent
@@ -152,7 +152,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
 ## 
 ## Model predictions using solution type deSolve 
 ## 
-## Fitted with method Port using 153 model solutions performed in 1.031 s
+## Fitted with method Port using 153 model solutions performed in 1.072 s
 ## 
 ## Weighting: none
 ## 
diff --git a/vignettes/FOCUS_L.html b/vignettes/FOCUS_L.html
index 180c0323..ccde0c82 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-07-21

+

2018-01-14

@@ -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.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 
+
## mkin version:    0.9.47.1 
+## R version:       3.4.3 
+## Date of fit:     Sun Jan 14 17:50:05 2018 
+## Date of summary: Sun Jan 14 17:50:05 2018 
 ## 
 ## 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.258 s
+## Fitted with method Port using 37 model solutions performed in 0.242 s
 ## 
 ## Weighting: none
 ## 
@@ -324,7 +324,7 @@ 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")

@@ -333,12 +333,12 @@ summary(m.L1.SFO)
## 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.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 
+
## mkin version:    0.9.47.1 
+## R version:       3.4.3 
+## Date of fit:     Sun Jan 14 17:50:06 2018 
+## Date of summary: Sun Jan 14 17:50:06 2018 
 ## 
 ## 
 ## 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.445 s +## Fitted with method Port using 155 model solutions performed in 0.432 s ## ## Weighting: none ## @@ -432,17 +432,17 @@ plot(m.L2.FOMC, show_residuals = TRUE, main = "FOCUS L2 - FOMC")

summary(m.L2.FOMC, data = FALSE)
-
## 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 
+
## mkin version:    0.9.47.1 
+## R version:       3.4.3 
+## Date of fit:     Sun Jan 14 17:50:07 2018 
+## Date of summary: Sun Jan 14 17:50:07 2018 
 ## 
 ## 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.246 s
+## Fitted with method Port using 81 model solutions performed in 0.166 s
 ## 
 ## Weighting: none
 ## 
@@ -502,10 +502,10 @@ 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.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 
+
## mkin version:    0.9.47.1 
+## R version:       3.4.3 
+## Date of fit:     Sun Jan 14 17:50:08 2018 
+## Date of summary: Sun Jan 14 17:50:08 2018 
 ## 
 ## Equations:
 ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) *
@@ -514,7 +514,7 @@ plot(m.L2.DFOP, show_residuals = TRUE, show_errmin = TRUE,
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Port using 336 model solutions performed in 0.742 s
+## Fitted with method Port using 336 model solutions performed in 0.712 s
 ## 
 ## Weighting: none
 ## 
@@ -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.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 
+
## mkin version:    0.9.47.1 
+## R version:       3.4.3 
+## Date of fit:     Sun Jan 14 17:50:08 2018 
+## Date of summary: Sun Jan 14 17:50:08 2018 
 ## 
 ## 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.371 s +## Fitted with method Port using 137 model solutions performed in 0.291 s ## ## Weighting: none ## @@ -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.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 
+
## mkin version:    0.9.47.1 
+## R version:       3.4.3 
+## Date of fit:     Sun Jan 14 17:50:09 2018 
+## Date of summary: Sun Jan 14 17:50:09 2018 
 ## 
 ## 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.098 s
+## Fitted with method Port using 46 model solutions performed in 0.094 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.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 
+
## mkin version:    0.9.47.1 
+## R version:       3.4.3 
+## Date of fit:     Sun Jan 14 17:50:09 2018 
+## Date of summary: Sun Jan 14 17:50:09 2018 
 ## 
 ## 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.141 s
+## Fitted with method Port using 66 model solutions performed in 0.139 s
 ## 
 ## Weighting: none
 ## 
diff --git a/vignettes/FOCUS_Z.Rmd b/vignettes/FOCUS_Z.Rmd
index d61f7387..b1ac7d42 100644
--- a/vignettes/FOCUS_Z.Rmd
+++ b/vignettes/FOCUS_Z.Rmd
@@ -29,7 +29,7 @@ The following code defines the example dataset from Appendix 7 to the FOCUS kine
 report [@FOCUSkinetics2014, p. 354].
 
 ```{r, echo = TRUE, fig = TRUE, fig.width = 8, fig.height = 7}
-library(mkin, quiet = TRUE)
+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,
diff --git a/vignettes/FOCUS_Z.html b/vignettes/FOCUS_Z.html
index 369e913d..1428ea85 100644
--- a/vignettes/FOCUS_Z.html
+++ b/vignettes/FOCUS_Z.html
@@ -11,7 +11,7 @@
 
 
 
-
+
 
 Example evaluation of FOCUS dataset Z
 
@@ -234,7 +234,7 @@ div.tocify {
 
 

Example evaluation of FOCUS dataset Z

Johannes Ranke

-

2017-11-16

+

2018-01-14

@@ -243,7 +243,7 @@ div.tocify {

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, quiet = TRUE)
+
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,
diff --git a/vignettes/compiled_models.Rmd b/vignettes/compiled_models.Rmd
index 21b6b0d5..e97876da 100644
--- a/vignettes/compiled_models.Rmd
+++ b/vignettes/compiled_models.Rmd
@@ -28,7 +28,7 @@ Sys.which("gcc")
 First, we build a simple degradation model for a parent compound with one metabolite.
 
 ```{r create_SFO_SFO}
-library("mkin")
+library("mkin", quietly = TRUE)
 SFO_SFO <- mkinmod(
   parent = mkinsub("SFO", "m1"),
   m1 = mkinsub("SFO"))
diff --git a/vignettes/compiled_models.html b/vignettes/compiled_models.html
index 30f29699..8aaa70d6 100644
--- a/vignettes/compiled_models.html
+++ b/vignettes/compiled_models.html
@@ -12,7 +12,7 @@
 
 
 
-
+
 
 Performance benefit by using compiled model definitions in mkin
 
@@ -70,7 +70,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
 
 

Performance benefit by using compiled model definitions in mkin

Johannes Ranke

-

2017-07-21

+

2018-01-14

@@ -81,13 +81,8 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
##            gcc 
 ## "/usr/bin/gcc"

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

-
library("mkin")
-
## Loading required package: minpack.lm
-
## Loading required package: rootSolve
-
## Loading required package: inline
-
## Loading required package: methods
-
## Loading required package: parallel
-
SFO_SFO <- mkinmod(
+
library("mkin", quietly = TRUE)
+SFO_SFO <- mkinmod(
   parent = mkinsub("SFO", "m1"),
   m1 = mkinsub("SFO"))
## Successfully compiled differential equation model from auto-generated C code.
@@ -110,9 +105,9 @@ 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.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
+## 3     deSolve, compiled            3   2.005    1.000     2.000    0.004
+## 1 deSolve, not compiled            3  14.202    7.083    14.196    0.000
+## 2      Eigenvalue based            3   2.427    1.210     2.428    0.000
 ##   user.child sys.child
 ## 3          0         0
 ## 1          0         0
@@ -140,14 +135,14 @@ 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.646    1.000     3.644        0
-## 1 deSolve, not compiled            3  30.752    8.434    30.752        0
+## 2     deSolve, compiled            3   3.489    1.000     3.488        0
+## 1 deSolve, not compiled            3  28.906    8.285    28.904        0
 ##   user.child sys.child
 ## 2          0         0
 ## 1          0         0

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)
+

This vignette was built with mkin 0.9.47.1 on

+
## R version 3.4.3 (2017-11-30)
 ## Platform: x86_64-pc-linux-gnu (64-bit)
 ## Running under: Debian GNU/Linux 9 (stretch)
## CPU model: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
diff --git a/vignettes/mkin.Rmd b/vignettes/mkin.Rmd index 84bc5adb..4f3ac7fc 100644 --- a/vignettes/mkin.Rmd +++ b/vignettes/mkin.Rmd @@ -34,7 +34,7 @@ measures for data series within one or more compartments, for parent and metabolites. ```{r, echo = TRUE, cache = TRUE, fig = TRUE, fig.width = 8, fig.height = 7} -library(mkin) +library("mkin", quietly = TRUE) # Define the kinetic model m_SFO_SFO_SFO <- mkinmod(parent = mkinsub("SFO", "M1"), M1 = mkinsub("SFO", "M2"), diff --git a/vignettes/mkin.html b/vignettes/mkin.html index f87c967f..635dd79e 100644 --- a/vignettes/mkin.html +++ b/vignettes/mkin.html @@ -11,7 +11,7 @@ - + Introduction to mkin @@ -234,7 +234,7 @@ div.tocify {

Introduction to mkin

Johannes Ranke

-

2017-11-16

+

2018-01-14

@@ -243,7 +243,7 @@ div.tocify {

Abstract

In the regulatory evaluation of chemical substances like plant protection products (pesticides), biocides and other chemicals, degradation data play an important role. For the evaluation of pesticide degradation experiments, detailed guidance has been developed, based on nonlinear optimisation. The R add-on package mkin (Ranke 2016) implements fitting some of the models recommended in this guidance from within R and calculates some statistical measures for data series within one or more compartments, for parent and metabolites.

-
library(mkin)
+
library("mkin", quietly = TRUE)
 # Define the kinetic model
 m_SFO_SFO_SFO <- mkinmod(parent = mkinsub("SFO", "M1"),
                          M1 = mkinsub("SFO", "M2"),
-- 
cgit v1.2.1