From 6653ff2507f45eae909f491a9af3f1eb5358a600 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 1 Mar 2018 14:32:46 +0100 Subject: Static documentation rebuilt using current pkgdown::build_site() --- docs/articles/FOCUS_D.R | 24 -- docs/articles/FOCUS_D.html | 27 +- docs/articles/FOCUS_D_files/figure-html/plot-1.png | Bin 39955 -> 96321 bytes .../FOCUS_D_files/figure-html/plot_2-1.png | Bin 6454 -> 14047 bytes docs/articles/FOCUS_L.html | 127 +++++----- .../figure-html/unnamed-chunk-10-1.png | Bin 29157 -> 28683 bytes .../figure-html/unnamed-chunk-12-1.png | Bin 54520 -> 52097 bytes .../figure-html/unnamed-chunk-13-1.png | Bin 21712 -> 21427 bytes .../figure-html/unnamed-chunk-15-1.png | Bin 38347 -> 36600 bytes .../figure-html/unnamed-chunk-4-1.png | Bin 23493 -> 23247 bytes .../figure-html/unnamed-chunk-5-1.png | Bin 14866 -> 14668 bytes .../figure-html/unnamed-chunk-6-1.png | Bin 23975 -> 23624 bytes .../figure-html/unnamed-chunk-8-1.png | Bin 27988 -> 27537 bytes .../figure-html/unnamed-chunk-9-1.png | Bin 28412 -> 27959 bytes docs/articles/FOCUS_Z.R | 115 --------- docs/articles/FOCUS_Z.Rnw | 274 --------------------- docs/articles/FOCUS_Z.html | 124 +++++----- .../figure-html/FOCUS_2006_Z_fits_1-1.png | Bin 85456 -> 83846 bytes .../figure-html/FOCUS_2006_Z_fits_10-1.png | Bin 128546 -> 123289 bytes .../figure-html/FOCUS_2006_Z_fits_11-1.png | Bin 128184 -> 122641 bytes .../figure-html/FOCUS_2006_Z_fits_11a-1.png | Bin 101885 -> 96633 bytes .../figure-html/FOCUS_2006_Z_fits_11b-1.png | Bin 22682 -> 22186 bytes .../figure-html/FOCUS_2006_Z_fits_2-1.png | Bin 86036 -> 84217 bytes .../figure-html/FOCUS_2006_Z_fits_3-1.png | Bin 85658 -> 83907 bytes .../figure-html/FOCUS_2006_Z_fits_5-1.png | Bin 101539 -> 96969 bytes .../figure-html/FOCUS_2006_Z_fits_6-1.png | Bin 129171 -> 123363 bytes .../figure-html/FOCUS_2006_Z_fits_7-1.png | Bin 128994 -> 123396 bytes .../figure-html/FOCUS_2006_Z_fits_9-1.png | Bin 108245 -> 103846 bytes docs/articles/compiled_models.R | 55 ----- docs/articles/compiled_models.html | 62 +++-- .../figure-html/benchmark_FOMC_SFO-1.png | Bin 9755 -> 0 bytes .../figure-html/benchmark_SFO_SFO-1.png | Bin 11237 -> 0 bytes docs/articles/header.tex | 22 -- docs/articles/index.html | 8 +- docs/articles/mkin.R | 34 --- docs/articles/mkin.html | 20 +- .../mkin_files/figure-html/unnamed-chunk-2-1.png | Bin 114757 -> 110404 bytes docs/articles/twa.R | 1 - docs/articles/twa.html | 11 +- 39 files changed, 195 insertions(+), 709 deletions(-) delete mode 100644 docs/articles/FOCUS_D.R delete mode 100644 docs/articles/FOCUS_Z.R delete mode 100644 docs/articles/FOCUS_Z.Rnw delete mode 100644 docs/articles/compiled_models.R delete mode 100644 docs/articles/compiled_models_files/figure-html/benchmark_FOMC_SFO-1.png delete mode 100644 docs/articles/compiled_models_files/figure-html/benchmark_SFO_SFO-1.png delete mode 100644 docs/articles/header.tex delete mode 100644 docs/articles/mkin.R delete mode 100644 docs/articles/twa.R (limited to 'docs/articles') diff --git a/docs/articles/FOCUS_D.R b/docs/articles/FOCUS_D.R deleted file mode 100644 index b831e14e..00000000 --- a/docs/articles/FOCUS_D.R +++ /dev/null @@ -1,24 +0,0 @@ -## ---- include = FALSE---------------------------------------------------- -library(knitr) -opts_chunk$set(tidy = FALSE, cache = TRUE) - -## ----data---------------------------------------------------------------- -library("mkin", quietly = TRUE) -print(FOCUS_2006_D) - -## ----model--------------------------------------------------------------- -SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO")) -print(SFO_SFO$diffs) - -## ----fit----------------------------------------------------------------- -fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE) - -## ----plot, fig.height = 6, fig.width = 8--------------------------------- -plot_sep(fit, lpos = c("topright", "bottomright")) - -## ----plot_2, fig.height = 4, fig.width = 8------------------------------- -mkinparplot(fit) - -## ------------------------------------------------------------------------ -summary(fit) - diff --git a/docs/articles/FOCUS_D.html b/docs/articles/FOCUS_D.html index d9dd8ad5..af04f755 100644 --- a/docs/articles/FOCUS_D.html +++ b/docs/articles/FOCUS_D.html @@ -8,8 +8,11 @@ Example evaluation of FOCUS Example Dataset D • mkin - - + + + + @@ -77,7 +80,7 @@

Example evaluation of FOCUS Example Dataset D

Johannes Ranke

-

2018-01-16

+

2018-03-01

@@ -85,7 +88,7 @@

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", quietly = TRUE)
-print(FOCUS_2006_D)
+print(FOCUS_2006_D)
##      name time  value
 ## 1  parent    0  99.46
 ## 2  parent    0 102.04
@@ -135,13 +138,13 @@
 

The call to mkinmod returns a degradation model. The differential equations represented in R code can be found in the character vector $diffs of the mkinmod object. If a C compiler (gcc) is installed and functional, the differential equation model will be compiled from auto-generated C code.

SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
## Successfully compiled differential equation model from auto-generated C code.
-
print(SFO_SFO$diffs)
+
print(SFO_SFO$diffs)
##                                                       parent 
 ## "d_parent = - k_parent_sink * parent - k_parent_m1 * parent" 
 ##                                                           m1 
 ##             "d_m1 = + k_parent_m1 * parent - k_m1_sink * m1"

We do the fitting without progress report (quiet = TRUE).

-
fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
+
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"))

@@ -150,10 +153,10 @@

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

summary(fit)
-
## mkin version:    0.9.46.1 
-## R version:       3.4.1 
-## Date of fit:     Thu Sep 14 12:15:01 2017 
-## Date of summary: Thu Sep 14 12:15:02 2017 
+
## mkin version:    0.9.46.3 
+## R version:       3.4.3 
+## Date of fit:     Thu Mar  1 14:17:55 2018 
+## Date of summary: Thu Mar  1 14:17:55 2018 
 ## 
 ## Equations:
 ## d_parent/dt = - k_parent_sink * parent - k_parent_m1 * parent
@@ -161,7 +164,7 @@
 ## 
 ## Model predictions using solution type deSolve 
 ## 
-## Fitted with method Port using 153 model solutions performed in 1.14 s
+## Fitted with method Port using 153 model solutions performed in 0.993 s
 ## 
 ## Weighting: none
 ## 
@@ -286,7 +289,7 @@
 
 
 
-

Site built with pkgdown.

+

Site built with pkgdown.

diff --git a/docs/articles/FOCUS_D_files/figure-html/plot-1.png b/docs/articles/FOCUS_D_files/figure-html/plot-1.png index 75c4c299..b4fa2ff4 100644 Binary files a/docs/articles/FOCUS_D_files/figure-html/plot-1.png and b/docs/articles/FOCUS_D_files/figure-html/plot-1.png differ diff --git a/docs/articles/FOCUS_D_files/figure-html/plot_2-1.png b/docs/articles/FOCUS_D_files/figure-html/plot_2-1.png index 94e7e2b3..ba06ce31 100644 Binary files a/docs/articles/FOCUS_D_files/figure-html/plot_2-1.png and b/docs/articles/FOCUS_D_files/figure-html/plot_2-1.png differ diff --git a/docs/articles/FOCUS_L.html b/docs/articles/FOCUS_L.html index 42ec2df1..5de06ad5 100644 --- a/docs/articles/FOCUS_L.html +++ b/docs/articles/FOCUS_L.html @@ -8,8 +8,11 @@ Example evaluation of FOCUS Laboratory Data L1 to L3 • mkin - - + + + + @@ -77,7 +80,7 @@

Example evaluation of FOCUS Laboratory Data L1 to L3

Johannes Ranke

-

2018-01-16

+

2018-03-01

@@ -88,27 +91,27 @@ Laboratory Data L1

The following code defines example dataset L1 from the FOCUS kinetics report, p. 284:

library("mkin", quietly = TRUE)
-FOCUS_2006_L1 = data.frame(
+FOCUS_2006_L1 = data.frame(
   t = rep(c(0, 1, 2, 3, 5, 7, 14, 21, 30), each = 2),
   parent = c(88.3, 91.4, 85.6, 84.5, 78.9, 77.6,
              72.0, 71.9, 50.3, 59.4, 47.0, 45.1,
              27.7, 27.3, 10.0, 10.4, 2.9, 4.0))
-FOCUS_2006_L1_mkin <- mkin_wide_to_long(FOCUS_2006_L1)
+FOCUS_2006_L1_mkin <- mkin_wide_to_long(FOCUS_2006_L1)

Here we use the assumptions of simple first order (SFO), the case of declining rate constant over time (FOMC) and the case of two different phases of the kinetics (DFOP). For a more detailed discussion of the models, please see the FOCUS kinetics report.

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)
+
m.L1.SFO <- mkinfit("SFO", FOCUS_2006_L1_mkin, quiet = TRUE)
 summary(m.L1.SFO)
-
## mkin version:    0.9.47.1 
+
## mkin version:    0.9.46.3 
 ## R version:       3.4.3 
-## Date of fit:     Tue Jan 16 06:11:06 2018 
-## Date of summary: Tue Jan 16 06:11:06 2018 
+## Date of fit:     Thu Mar  1 14:31:57 2018 
+## Date of summary: Thu Mar  1 14:31:57 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.245 s
+## Fitted with method Port using 37 model solutions performed in 0.24 s
 ## 
 ## Weighting: none
 ## 
@@ -185,28 +188,21 @@ FOCUS_2006_L1_mkin <- 
mkinresplot(m.L1.SFO, ylab = "Observed", xlab = "Time")

For comparison, the FOMC model is fitted as well, and the \(\chi^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")
+
m.L1.FOMC <- mkinfit("FOMC", FOCUS_2006_L1_mkin, quiet=TRUE)
+plot(m.L1.FOMC, show_errmin = TRUE, main = "FOCUS L1 - FOMC")

summary(m.L1.FOMC, data = FALSE)
-
## mkin version:    0.9.47.1 
+
## mkin version:    0.9.46.3 
 ## R version:       3.4.3 
-## Date of fit:     Tue Jan 16 06:11:07 2018 
-## Date of summary: Tue Jan 16 06:11:07 2018 
-## 
-## 
-## Warning: Optimisation by method Port did not converge.
-## Convergence code is 1 
-## 
+## Date of fit:     Thu Mar  1 14:31:59 2018 
+## Date of summary: Thu Mar  1 14:32:00 2018 
 ## 
 ## Equations:
 ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Port using 155 model solutions performed in 0.424 s
+## Fitted with method Port using 611 model solutions performed in 1.375 s
 ## 
 ## Weighting: none
 ## 
@@ -226,16 +222,16 @@ FOCUS_2006_L1_mkin <-   
 Laboratory Data L2
 

The following code defines example dataset L2 from the FOCUS kinetics report, p. 287:

-
FOCUS_2006_L2 = data.frame(
+
FOCUS_2006_L2 = data.frame(
   t = rep(c(0, 1, 3, 7, 14, 28), each = 2),
   parent = c(96.1, 91.8, 41.4, 38.7,
              19.3, 22.3, 4.6, 4.6,
              2.6, 1.2, 0.3, 0.6))
-FOCUS_2006_L2_mkin <- mkin_wide_to_long(FOCUS_2006_L2)
+FOCUS_2006_L2_mkin <- mkin_wide_to_long(FOCUS_2006_L2)

SFO fit for L2

Again, the SFO model is fitted and the result is plotted. The residual plot can be obtained simply by adding the argument show_residuals to the plot command.

-
m.L2.SFO <- mkinfit("SFO", FOCUS_2006_L2_mkin, quiet=TRUE)
+
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")

@@ -286,22 +282,22 @@ FOCUS_2006_L2_mkin <- FOMC fit for L2

For comparison, the FOMC model is fitted as well, and the \(\chi^2\) error level is checked.

-
m.L2.FOMC <- mkinfit("FOMC", FOCUS_2006_L2_mkin, quiet = 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.47.1 
+
## mkin version:    0.9.46.3 
 ## R version:       3.4.3 
-## Date of fit:     Tue Jan 16 06:11:08 2018 
-## Date of summary: Tue Jan 16 06:11:08 2018 
+## Date of fit:     Thu Mar  1 14:32:00 2018 
+## Date of summary: Thu Mar  1 14:32:00 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.168 s
+## Fitted with method Port using 81 model solutions performed in 0.158 s
 ## 
 ## Weighting: none
 ## 
@@ -357,15 +353,15 @@ FOCUS_2006_L2_mkin <- 
 DFOP fit for L2
 

Fitting the four parameter DFOP model further reduces the \(\chi^2\) error level.

-
m.L2.DFOP <- mkinfit("DFOP", FOCUS_2006_L2_mkin, quiet = 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.47.1 
+
## mkin version:    0.9.46.3 
 ## R version:       3.4.3 
-## Date of fit:     Tue Jan 16 06:11:09 2018 
-## Date of summary: Tue Jan 16 06:11:09 2018 
+## Date of fit:     Thu Mar  1 14:32:01 2018 
+## Date of summary: Thu Mar  1 14:32:01 2018 
 ## 
 ## Equations:
 ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) *
@@ -374,7 +370,7 @@ FOCUS_2006_L2_mkin <-  
 Laboratory Data L3
 

The following code defines example dataset L3 from the FOCUS kinetics report, p. 290.

-
FOCUS_2006_L3 = data.frame(
+
FOCUS_2006_L3 = data.frame(
   t = c(0, 3, 7, 14, 30, 60, 91, 120),
   parent = c(97.8, 60, 51, 43, 35, 22, 15, 12))
-FOCUS_2006_L3_mkin <- mkin_wide_to_long(FOCUS_2006_L3)
+FOCUS_2006_L3_mkin <- mkin_wide_to_long(FOCUS_2006_L3)

Fit multiple models

As of mkin version 0.9-39 (June 2015), we can fit several models to one or more datasets in one call to the function mmkin. The datasets have to be passed in a list, in this case a named list holding only the L3 dataset prepared above.

# Only use one core here, not to offend the CRAN checks
 mm.L3 <- mmkin(c("SFO", "FOMC", "DFOP"), cores = 1,
-               list("FOCUS L3" = FOCUS_2006_L3_mkin), quiet = TRUE)
+               list("FOCUS L3" = FOCUS_2006_L3_mkin), quiet = TRUE)
 plot(mm.L3)

The \(\chi^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 \(\chi^2\) test passes of 7%. Fitting the four parameter DFOP model further reduces the \(\chi^2\) error level considerably.

@@ -454,10 +450,10 @@ mm.L3 <-
summary(mm.L3[["DFOP", 1]])
-
## mkin version:    0.9.47.1 
+
## mkin version:    0.9.46.3 
 ## R version:       3.4.3 
-## Date of fit:     Tue Jan 16 06:11:10 2018 
-## Date of summary: Tue Jan 16 06:11:10 2018 
+## Date of fit:     Thu Mar  1 14:32:02 2018 
+## Date of summary: Thu Mar  1 14:32:02 2018 
 ## 
 ## Equations:
 ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) *
@@ -542,30 +538,30 @@ mm.L3 <- 
 Laboratory Data L4
 

The following code defines example dataset L4 from the FOCUS kinetics report, p. 293:

-
FOCUS_2006_L4 = data.frame(
+
FOCUS_2006_L4 = data.frame(
   t = c(0, 3, 7, 14, 30, 60, 91, 120),
   parent = c(96.6, 96.3, 94.3, 88.8, 74.9, 59.9, 53.5, 49.0))
-FOCUS_2006_L4_mkin <- mkin_wide_to_long(FOCUS_2006_L4)
+FOCUS_2006_L4_mkin <- mkin_wide_to_long(FOCUS_2006_L4)

Fits of the SFO and FOMC models, plots and summaries are produced below:

# Only use one core here, not to offend the CRAN checks
 mm.L4 <- mmkin(c("SFO", "FOMC"), cores = 1,
-               list("FOCUS L4" = FOCUS_2006_L4_mkin),
+               list("FOCUS L4" = FOCUS_2006_L4_mkin),
                quiet = TRUE)
 plot(mm.L4)

The \(\chi^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 \(\chi^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.47.1 
+
## mkin version:    0.9.46.3 
 ## R version:       3.4.3 
-## Date of fit:     Tue Jan 16 06:11:10 2018 
-## Date of summary: Tue Jan 16 06:11:10 2018 
+## Date of fit:     Thu Mar  1 14:32:03 2018 
+## Date of summary: Thu Mar  1 14:32:03 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.094 s
+## Fitted with method Port using 46 model solutions performed in 0.089 s
 ## 
 ## Weighting: none
 ## 
@@ -615,17 +611,17 @@ mm.L4 <- 
summary(mm.L4[["FOMC", 1]], data = FALSE)
-
## mkin version:    0.9.47.1 
+
## mkin version:    0.9.46.3 
 ## R version:       3.4.3 
-## Date of fit:     Tue Jan 16 06:11:10 2018 
-## Date of summary: Tue Jan 16 06:11:10 2018 
+## Date of fit:     Thu Mar  1 14:32:03 2018 
+## Date of summary: Thu Mar  1 14:32:03 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.139 s
+## Fitted with method Port using 66 model solutions performed in 0.134 s
 ## 
 ## Weighting: none
 ## 
@@ -690,7 +686,8 @@ mm.L4 <- 
         
-

Contents

+

+Contents

diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-10-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-10-1.png index f5f45ac6..c9da66ac 100644 Binary files a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-10-1.png and b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-10-1.png differ diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-12-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-12-1.png index 22f3a530..aa728f0f 100644 Binary files a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-12-1.png and b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-12-1.png differ diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-13-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-13-1.png index 9eb0378f..4eb7f3b1 100644 Binary files a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-13-1.png and b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-13-1.png differ diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-15-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-15-1.png index 93966e70..56654730 100644 Binary files a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-15-1.png and b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-15-1.png differ diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-4-1.png index 1a9c8457..b143282b 100644 Binary files a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-5-1.png index 12b4beea..a4753a7e 100644 Binary files a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-5-1.png and b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-5-1.png differ diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-6-1.png index 55e96a9e..50528c8a 100644 Binary files a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-6-1.png and b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-6-1.png differ diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-8-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-8-1.png index 7b8e7f95..95a5bc5c 100644 Binary files a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-8-1.png and b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-8-1.png differ diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-9-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-9-1.png index 49c48168..745477a3 100644 Binary files a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-9-1.png and b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-9-1.png differ diff --git a/docs/articles/FOCUS_Z.R b/docs/articles/FOCUS_Z.R deleted file mode 100644 index 4d2dffca..00000000 --- a/docs/articles/FOCUS_Z.R +++ /dev/null @@ -1,115 +0,0 @@ -## ---- include = FALSE---------------------------------------------------- -require(knitr) -options(digits = 5) -opts_chunk$set(engine='R', tidy = FALSE) - -## ---- echo = TRUE, fig = TRUE, fig.width = 8, fig.height = 7------------- -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) - -## ----FOCUS_2006_Z_fits_1, echo=TRUE, fig.height=6------------------------ -Z.2a <- mkinmod(Z0 = mkinsub("SFO", "Z1"), - Z1 = mkinsub("SFO")) -m.Z.2a <- mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.2a) -summary(m.Z.2a, data = FALSE)$bpar - -## ----FOCUS_2006_Z_fits_2, echo=TRUE, fig.height=6------------------------ -Z.2a.ff <- mkinmod(Z0 = mkinsub("SFO", "Z1"), - Z1 = mkinsub("SFO"), - use_of_ff = "max") - -m.Z.2a.ff <- mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.2a.ff) -summary(m.Z.2a.ff, data = FALSE)$bpar - -## ----FOCUS_2006_Z_fits_3, echo=TRUE, fig.height=6------------------------ -Z.3 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE), - Z1 = mkinsub("SFO"), use_of_ff = "max") -m.Z.3 <- mkinfit(Z.3, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.3) -summary(m.Z.3, data = FALSE)$bpar - -## ----FOCUS_2006_Z_fits_5, echo=TRUE, fig.height=7------------------------ -Z.5 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO"), use_of_ff = "max") -m.Z.5 <- mkinfit(Z.5, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.5) - -## ----FOCUS_2006_Z_fits_6, echo=TRUE, fig.height=8------------------------ -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") -m.Z.FOCUS <- mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, - parms.ini = m.Z.5$bparms.ode, - quiet = TRUE) -plot_sep(m.Z.FOCUS) -summary(m.Z.FOCUS, data = FALSE)$bpar -endpoints(m.Z.FOCUS) - -## ----FOCUS_2006_Z_fits_7, echo=TRUE, fig.height=8------------------------ -Z.mkin.1 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO", "Z3"), - Z3 = mkinsub("SFORB")) -m.Z.mkin.1 <- mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.mkin.1) -summary(m.Z.mkin.1, data = FALSE)$cov.unscaled - -## ----FOCUS_2006_Z_fits_9, echo=TRUE, fig.height=8------------------------ -Z.mkin.3 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO")) -m.Z.mkin.3 <- mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.mkin.3) - -## ----FOCUS_2006_Z_fits_10, echo=TRUE, fig.height=8----------------------- -Z.mkin.4 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO", "Z3"), - Z3 = mkinsub("SFO")) -m.Z.mkin.4 <- mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin, - parms.ini = m.Z.mkin.3$bparms.ode, - quiet = TRUE) -plot_sep(m.Z.mkin.4) - -## ----FOCUS_2006_Z_fits_11, echo=TRUE, fig.height=8----------------------- -Z.mkin.5 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO", "Z3"), - Z3 = mkinsub("SFORB")) -m.Z.mkin.5 <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, - parms.ini = m.Z.mkin.4$bparms.ode[1:4], - quiet = TRUE) -plot_sep(m.Z.mkin.5) - -## ----FOCUS_2006_Z_fits_11a, echo=TRUE------------------------------------ -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) -plot_sep(m.Z.mkin.5a) - -## ----FOCUS_2006_Z_fits_11b, echo=TRUE------------------------------------ -mkinparplot(m.Z.mkin.5a) - -## ----FOCUS_2006_Z_fits_11b_endpoints, echo=TRUE-------------------------- -endpoints(m.Z.mkin.5a) - diff --git a/docs/articles/FOCUS_Z.Rnw b/docs/articles/FOCUS_Z.Rnw deleted file mode 100644 index 5abda0e1..00000000 --- a/docs/articles/FOCUS_Z.Rnw +++ /dev/null @@ -1,274 +0,0 @@ -%\VignetteIndexEntry{Example evaluation of FOCUS dataset Z} -%\VignetteEngine{knitr::knitr} -\documentclass[12pt,a4paper]{article} -\usepackage{a4wide} -\input{header} -\hypersetup{ - pdftitle = {Example evaluation of FOCUS dataset Z}, - pdfsubject = {Manuscript}, - pdfauthor = {Johannes Ranke}, - colorlinks = {true}, - linkcolor = {blue}, - citecolor = {blue}, - urlcolor = {red}, - hyperindex = {true}, - linktocpage = {true}, -} - -\begin{document} - -<>= -require(knitr) -opts_chunk$set(engine='R', tidy = FALSE, cache = TRUE) -options(width=70) -@ - -\title{Example evaluation of FOCUS dataset Z} -\author{\textbf{Johannes Ranke} \\[0.5cm] -%EndAName -Wissenschaftlicher Berater\\ -Kronacher Str. 8, 79639 Grenzach-Wyhlen, Germany\\[0.5cm] -and\\[0.5cm] -University of Bremen\\ -} -\maketitle - -\thispagestyle{empty} \setcounter{page}{0} - -\clearpage - -\tableofcontents - -\textbf{Key words}: Kinetics, FOCUS, nonlinear optimisation - -\section{The data} - -The following code defines the example dataset from Appendix 7 to the FOCUS kinetics -report \citep{FOCUSkinetics2011}, p.350. - -<>= -require(mkin) -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) -@ - -\section{Parent compound 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")) -m.Z.2a <- mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.2a) -summary(m.Z.2a, data = FALSE)$bpar -@ - -As obvious from the parameter summary (the \texttt{bpar} component of the -summary), the kinetic rate constant from parent compound Z to sink -is negligible. Accordingly, the exact magnitude of the fitted parameter -\texttt{log k\_Z0\_sink} is ill-defined and the covariance matrix is not -returned (not shown, would be visible in the complete summary). -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") - -m.Z.2a.ff <- mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.2a.ff) -summary(m.Z.2a.ff, data = FALSE)$bpar -@ - -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. Again, the covariance matrix is not returned as the model is -overparameterised. - -The simplified model is obtained by setting the list component \texttt{sink} to -\texttt{FALSE}.\footnote{If the model formulation without formation fractions -is used, the same effect can be obtained by fixing the parameter \texttt{k\_Z\_sink} -to a value of zero.} - -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") -m.Z.3 <- mkinfit(Z.3, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.3) -summary(m.Z.3, data = FALSE)$bpar -@ - -As there is only one transformation product for Z0 and no pathway -to sink, the formation fraction is internally fixed to unity. - -\section{Including 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") -m.Z.5 <- mkinfit(Z.5, FOCUS_2006_Z_mkin, quiet = TRUE) -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") -m.Z.FOCUS <- mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, - parms.ini = m.Z.5$bparms.ode, - quiet = TRUE) -plot_sep(m.Z.FOCUS) -summary(m.Z.FOCUS, data = FALSE)$bpar -endpoints(m.Z.FOCUS) -@ - -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. - -\section{Using the SFORB model for parent and metabolites} - -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")) -m.Z.mkin.1 <- mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.mkin.1) -summary(m.Z.mkin.1, data = FALSE)$cov.unscaled -@ - -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")) -m.Z.mkin.3 <- mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE) -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")) -m.Z.mkin.4 <- mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin, - parms.ini = m.Z.mkin.3$bparms.ode, - quiet = TRUE) -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")) -m.Z.mkin.5 <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, - parms.ini = m.Z.mkin.4$bparms.ode[1:4], - quiet = TRUE) -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 -\texttt{k\_Z3\_bound\_free} 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) -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 -\texttt{Z.mkin.5a} 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) -@ - -The endpoints obtained with this model are - -<>= -endpoints(m.Z.mkin.5a) -@ - -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. - -\bibliographystyle{plainnat} -\bibliography{references} - -\end{document} -% vim: set foldmethod=syntax: diff --git a/docs/articles/FOCUS_Z.html b/docs/articles/FOCUS_Z.html index a5cfc616..52a1db77 100644 --- a/docs/articles/FOCUS_Z.html +++ b/docs/articles/FOCUS_Z.html @@ -8,8 +8,11 @@ Example evaluation of FOCUS dataset Z • mkin - - + + + + @@ -77,7 +80,7 @@

Example evaluation of FOCUS dataset Z

Johannes Ranke

-

2018-01-16

+

2018-03-01

@@ -90,64 +93,64 @@

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(
+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,
+         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)
+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"),
+
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)
-plot_sep(m.Z.2a)
+
m.Z.2a <- mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE)
+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.553135 2.7304e+01 1.6792e-21 91.4014 102.62838
-## k_Z0_sink 6.2135e-10   0.226894 2.7385e-09 5.0000e-01  0.0000       Inf
-## k_Z0_Z1   2.2360e+00   0.165073 1.3546e+01 7.3939e-14  1.8374   2.72107
-## k_Z1_sink 4.8212e-01   0.065854 7.3212e+00 3.5520e-08  0.4006   0.58024
+
summary(m.Z.2a, data = FALSE)$bpar
+
##             Estimate se_notrans    t value     Pr(>t) Lower Upper
+## Z0_0      9.7015e+01   3.553140 2.7304e+01 1.6793e-21    NA    NA
+## k_Z0_sink 1.2790e-11   0.226895 5.6368e-11 5.0000e-01    NA    NA
+## k_Z0_Z1   2.2360e+00   0.165073 1.3546e+01 7.3938e-14    NA    NA
+## k_Z1_sink 4.8212e-01   0.065854 7.3212e+00 3.5520e-08    NA    NA

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"),
+
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)
-plot_sep(m.Z.2a.ff)
+
m.Z.2a.ff <- mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE)
+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.553146 27.3039 1.6793e-21    NA    NA
-## k_Z0        2.23601   0.216847 10.3114 3.6617e-11    NA    NA
+## Z0_0       97.01488   3.553145 27.3039 1.6793e-21    NA    NA
+## k_Z0        2.23601   0.216849 10.3114 3.6623e-11    NA    NA
 ## k_Z1        0.48212   0.065854  7.3211 3.5520e-08    NA    NA
-## f_Z0_to_Z1  1.00000   0.101473  9.8548 9.7071e-11    NA    NA
+## f_Z0_to_Z1 1.00000 0.101473 9.8548 9.7068e-11 NA NA

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")
## 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)
 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.681771  36.176 2.3636e-25 91.52152 102.508
-## k_Z0  2.23601   0.146862  15.225 2.2470e-15  1.95453   2.558
+## Z0_0 97.01488   2.681772  36.176 2.3636e-25 91.52152 102.508
+## k_Z0  2.23601   0.146861  15.225 2.2464e-15  1.95453   2.558
 ## k_Z1  0.48212   0.042687  11.294 3.0686e-12  0.40216   0.578

As there is only one transformation product for Z0 and no pathway to sink, the formation fraction is internally fixed to unity.

@@ -159,7 +162,7 @@ FOCUS_2006_Z_mkin <- 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)
 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.

@@ -169,25 +172,25 @@ FOCUS_2006_Z_mkin <- Z3 = mkinsub("SFO"), use_of_ff = "max")
## Successfully compiled differential equation model from auto-generated C code.
-
m.Z.FOCUS <- mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin,
-                     parms.ini = m.Z.5$bparms.ode,
+
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, : Optimisation by method Port did not converge.
 ## Convergence code is 1
plot_sep(m.Z.FOCUS)

-
summary(m.Z.FOCUS, data = FALSE)$bpar
-
##            Estimate se_notrans t value     Pr(>t)     Lower      Upper
-## Z0_0       96.84024   2.058814 47.0369 5.5723e-44 92.706852 100.973637
-## k_Z0        2.21540   0.118128 18.7543 7.7369e-25  1.990504   2.465708
-## k_Z1        0.47836   0.029294 16.3298 3.3443e-22  0.423035   0.540918
-## k_Z2        0.45166   0.044186 10.2218 3.0364e-14  0.371065   0.549767
-## k_Z3        0.05869   0.014290  4.1072 7.2560e-05  0.035983   0.095725
-## f_Z2_to_Z3  0.47147   0.057027  8.2676 2.7790e-11  0.360295   0.585556
+
summary(m.Z.FOCUS, data = FALSE)$bpar
+
##             Estimate se_notrans t value     Pr(>t)     Lower      Upper
+## Z0_0       96.837112   2.058861 47.0343 5.5877e-44 92.703779 100.970445
+## k_Z0        2.215368   0.118098 18.7587 7.6563e-25  1.990525   2.465609
+## k_Z1        0.478302   0.029289 16.3302 3.3408e-22  0.422977   0.540864
+## k_Z2        0.451617   0.044214 10.2144 3.1133e-14  0.371034   0.549702
+## k_Z3        0.058693   0.014296  4.1056 7.2924e-05  0.035994   0.095705
+## f_Z2_to_Z3  0.471516   0.057057  8.2639 2.8156e-11  0.360381   0.585548
endpoints(m.Z.FOCUS)
## $ff
 ##   Z2_Z3 Z2_sink 
-## 0.47147 0.52853 
+## 0.47152 0.52848 
 ## 
 ## $SFORB
 ## logical(0)
@@ -195,9 +198,9 @@ FOCUS_2006_Z_mkin <- 
@@ -210,17 +213,17 @@ FOCUS_2006_Z_mkin <- 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)
+
m.Z.mkin.1 <- mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, quiet = TRUE)
 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"))
## Successfully compiled differential equation model from auto-generated C code.
-
m.Z.mkin.3 <- mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE)
+
m.Z.mkin.3 <- mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE)
 plot_sep(m.Z.mkin.3)

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

@@ -230,8 +233,8 @@ FOCUS_2006_Z_mkin <- 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,
+
m.Z.mkin.4 <- mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin,
+                      parms.ini = m.Z.mkin.3$bparms.ode,
                       quiet = TRUE)
 plot_sep(m.Z.mkin.4)

@@ -241,36 +244,36 @@ FOCUS_2006_Z_mkin <- 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],
+
m.Z.mkin.5 <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin,
+                      parms.ini = m.Z.mkin.4$bparms.ode[1:4],
                       quiet = TRUE)
 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],
+
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)
-plot_sep(m.Z.mkin.5a)
+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 
 ## 
 ## $SFORB
 ##     Z0_b1     Z0_b2     Z3_b1     Z3_b2 
-## 2.4471373 0.0075126 0.0800076 0.0000000 
+## 2.4471382 0.0075127 0.0800075 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.265         NA         NA
+## Z0 0.3043 1.1848    0.28325     92.264         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
@@ -291,7 +294,8 @@ FOCUS_2006_Z_mkin <-
-

Contents

+

+Contents

diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png index cb32b3c6..b66289d9 100644 Binary files a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png and b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png differ diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png index 7ce8a39c..af26f416 100644 Binary files a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png and b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png differ diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png index a7528057..d4e7a647 100644 Binary files a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png and b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png differ diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png index 3fe80d42..8c6d81ef 100644 Binary files a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png and b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png differ diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png index ff0dbbbd..fffb4892 100644 Binary files a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png and b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png differ diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png index dfe447ed..0ac5b6ce 100644 Binary files a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png and b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png differ diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png index 8f7102aa..87226454 100644 Binary files a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png and b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png differ diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png index 74a82e2b..58241d1d 100644 Binary files a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png and b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png differ diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png index 7042e390..381e7df5 100644 Binary files a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png and b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png differ diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png index 29824228..19e73f1c 100644 Binary files a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png and b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png differ diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png index 79f1b87e..891d8d92 100644 Binary files a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png and b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png differ diff --git a/docs/articles/compiled_models.R b/docs/articles/compiled_models.R deleted file mode 100644 index c5b06c11..00000000 --- a/docs/articles/compiled_models.R +++ /dev/null @@ -1,55 +0,0 @@ -## ---- include = FALSE---------------------------------------------------- -library(knitr) -opts_chunk$set(tidy = FALSE, cache = FALSE) - -## ----check_gcc----------------------------------------------------------- -Sys.which("gcc") - -## ----create_SFO_SFO------------------------------------------------------ -library("mkin", quietly = TRUE) -SFO_SFO <- mkinmod( - parent = mkinsub("SFO", "m1"), - m1 = mkinsub("SFO")) - -## ----benchmark_SFO_SFO, fig.height = 3----------------------------------- -if (require(rbenchmark)) { - b.1 <- benchmark( - "deSolve, not compiled" = mkinfit(SFO_SFO, FOCUS_2006_D, - solution_type = "deSolve", - use_compiled = FALSE, quiet = TRUE), - "Eigenvalue based" = mkinfit(SFO_SFO, FOCUS_2006_D, - solution_type = "eigen", quiet = TRUE), - "deSolve, compiled" = mkinfit(SFO_SFO, FOCUS_2006_D, - solution_type = "deSolve", quiet = TRUE), - replications = 3) - print(b.1) - factor_SFO_SFO <- round(b.1["1", "relative"]) -} else { - factor_SFO_SFO <- NA - print("R package benchmark is not available") -} - -## ----benchmark_FOMC_SFO, fig.height = 3---------------------------------- -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") -} - -## ----sessionInfo, echo = FALSE------------------------------------------- -cat(capture.output(sessionInfo())[1:3], sep = "\n") -if(!inherits(try(cpuinfo <- readLines("/proc/cpuinfo")), "try-error")) { - cat(gsub("model name\t: ", "CPU model: ", cpuinfo[grep("model name", cpuinfo)[1]])) -} - diff --git a/docs/articles/compiled_models.html b/docs/articles/compiled_models.html index d5d29a1a..9f0b5708 100644 --- a/docs/articles/compiled_models.html +++ b/docs/articles/compiled_models.html @@ -8,8 +8,11 @@ Performance benefit by using compiled model definitions in mkin • mkin - - + + + + @@ -77,7 +80,7 @@

Performance benefit by using compiled model definitions in mkin

Johannes Ranke

-

2018-01-16

+

2018-03-01

@@ -97,73 +100,66 @@ SFO_SFO <- 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.

-
if (require(rbenchmark)) {
+
if (require(rbenchmark)) {
   b.1 <- benchmark(
-    "deSolve, not compiled" = mkinfit(SFO_SFO, FOCUS_2006_D,
+    "deSolve, not compiled" = mkinfit(SFO_SFO, FOCUS_2006_D,
                                       solution_type = "deSolve",
                                       use_compiled = FALSE, quiet = TRUE),
-    "Eigenvalue based" = mkinfit(SFO_SFO, FOCUS_2006_D,
+    "Eigenvalue based" = mkinfit(SFO_SFO, FOCUS_2006_D,
                                  solution_type = "eigen", quiet = TRUE),
-    "deSolve, compiled" = mkinfit(SFO_SFO, FOCUS_2006_D,
+    "deSolve, compiled" = mkinfit(SFO_SFO, FOCUS_2006_D,
                                   solution_type = "deSolve", quiet = TRUE),
     replications = 3)
   print(b.1)
   factor_SFO_SFO <- round(b.1["1", "relative"])
-} else {
+} else {
   factor_SFO_SFO <- NA
   print("R package benchmark is not available")
 }
## Lade nötiges Paket: rbenchmark
-
##                    test replications elapsed relative user.self sys.self
-## 3     deSolve, compiled            3   1.940    1.000     1.940        0
-## 1 deSolve, not compiled            3  13.865    7.147    13.864        0
-## 2      Eigenvalue based            3   2.427    1.251     2.428        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 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.

+
## Warning in library(package, lib.loc = lib.loc, character.only = TRUE,
+## logical.return = TRUE, : es gibt kein Paket namens 'rbenchmark'
+
## [1] "R package benchmark is not available"
+

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

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

-
if (require(rbenchmark)) {
+
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,
+    "deSolve, not compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D,
                                       use_compiled = FALSE, quiet = TRUE),
-    "deSolve, compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D, 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 {
+} 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   3.432    1.000     3.428        0
-## 1 deSolve, not compiled            3  28.844    8.404    28.840        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.47.1 on

+
## Lade nötiges Paket: rbenchmark
+
## Warning in library(package, lib.loc = lib.loc, character.only = TRUE,
+## logical.return = TRUE, : es gibt kein Paket namens '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 0.9.46.3 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
+
## CPU model: AMD Ryzen 7 1700 Eight-Core Processor
-

Site built with pkgdown.

+

Site built with pkgdown.

diff --git a/docs/articles/mkin.R b/docs/articles/mkin.R deleted file mode 100644 index 19e80322..00000000 --- a/docs/articles/mkin.R +++ /dev/null @@ -1,34 +0,0 @@ -## ---- include = FALSE---------------------------------------------------- -require(knitr) -opts_chunk$set(engine='R', tidy=FALSE) - -## ---- echo = TRUE, cache = TRUE, fig = TRUE, fig.width = 8, fig.height = 7---- -library("mkin", quietly = TRUE) -# Define the kinetic model -m_SFO_SFO_SFO <- mkinmod(parent = mkinsub("SFO", "M1"), - M1 = mkinsub("SFO", "M2"), - M2 = mkinsub("SFO"), - use_of_ff = "max", quiet = TRUE) - - -# Produce model predictions using some arbitrary parameters -sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) -d_SFO_SFO_SFO <- mkinpredict(m_SFO_SFO_SFO, - c(k_parent = 0.03, - f_parent_to_M1 = 0.5, k_M1 = log(2)/100, - f_M1_to_M2 = 0.9, k_M2 = log(2)/50), - c(parent = 100, M1 = 0, M2 = 0), - sampling_times) - -# Generate a dataset by adding normally distributed errors with -# standard deviation 3, for two replicates at each sampling time -d_SFO_SFO_SFO_err <- add_err(d_SFO_SFO_SFO, reps = 2, - sdfunc = function(x) 3, - n = 1, seed = 123456789 ) - -# Fit the model to the dataset -f_SFO_SFO_SFO <- mkinfit(m_SFO_SFO_SFO, d_SFO_SFO_SFO_err[[1]], quiet = TRUE) - -# Plot the results separately for parent and metabolites -plot_sep(f_SFO_SFO_SFO, lpos = c("topright", "bottomright", "bottomright")) - diff --git a/docs/articles/mkin.html b/docs/articles/mkin.html index b70918ab..a91da0a4 100644 --- a/docs/articles/mkin.html +++ b/docs/articles/mkin.html @@ -8,8 +8,11 @@ Introduction to mkin • mkin - - + + + + @@ -77,7 +80,7 @@

Introduction to mkin

Johannes Ranke

-

2018-01-16

+

2018-03-01

@@ -100,15 +103,15 @@ m_SFO_SFO_SFO <- c(0, 1, 3, 7, 14, 28, 60, 90, 120) d_SFO_SFO_SFO <- mkinpredict(m_SFO_SFO_SFO, c(k_parent = 0.03, - f_parent_to_M1 = 0.5, k_M1 = log(2)/100, - f_M1_to_M2 = 0.9, k_M2 = log(2)/50), + f_parent_to_M1 = 0.5, k_M1 = log(2)/100, + f_M1_to_M2 = 0.9, k_M2 = log(2)/50), c(parent = 100, M1 = 0, M2 = 0), sampling_times) # Generate a dataset by adding normally distributed errors with # standard deviation 3, for two replicates at each sampling time d_SFO_SFO_SFO_err <- add_err(d_SFO_SFO_SFO, reps = 2, - sdfunc = function(x) 3, + sdfunc = function(x) 3, n = 1, seed = 123456789 ) # Fit the model to the dataset @@ -208,7 +211,8 @@ f_SFO_SFO_SFO <-
-

Contents

+

+Contents

diff --git a/docs/articles/mkin_files/figure-html/unnamed-chunk-2-1.png b/docs/articles/mkin_files/figure-html/unnamed-chunk-2-1.png index fafe8afd..5a3e3b6c 100644 Binary files a/docs/articles/mkin_files/figure-html/unnamed-chunk-2-1.png and b/docs/articles/mkin_files/figure-html/unnamed-chunk-2-1.png differ diff --git a/docs/articles/twa.R b/docs/articles/twa.R deleted file mode 100644 index 8b137891..00000000 --- a/docs/articles/twa.R +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/articles/twa.html b/docs/articles/twa.html index 086c8593..400b1383 100644 --- a/docs/articles/twa.html +++ b/docs/articles/twa.html @@ -8,8 +8,11 @@ Calculation of time weighted average concentrations with mkin • mkin - - + + + + @@ -77,7 +80,7 @@

Calculation of time weighted average concentrations with mkin

Johannes Ranke

-

2018-01-16

+

2018-03-01

@@ -126,7 +129,7 @@
-

Site built with pkgdown.

+

Site built with pkgdown.

-- cgit v1.2.1