From 54cf070313c844f5ccf741fc7f1237fe2d260ded Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 13 Oct 2016 17:40:36 +0200 Subject: Cleaning up a bit --- .Rbuildignore | 14 +++++------ .gitignore | 1 - README.html | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 77 insertions(+), 19 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index f843460d..79f6ea09 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,11 +1,9 @@ -build.log -check.log -GNUmakefile -mkin.Rcheck -README.html -^Rplots.pdf$ -test.log -test.R +^GNUmakefile$ +^build.log$ +^check.log$ +^test.log$ +^README.html$ +^mkin.Rcheck ^inst/web/* ^inst/staticdocs/* ^vignettes/.build.timestamp$ diff --git a/.gitignore b/.gitignore index 06973a0b..2b68846f 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,3 @@ vignettes/*_cache/ vignettes/*_files/ mkin.Rcheck install.log -test.R diff --git a/README.html b/README.html index 1e5ac529..b52ad556 100644 --- a/README.html +++ b/README.html @@ -10,18 +10,19 @@ + - + - - + + - + - + + + @@ -51,19 +80,48 @@ code { color: inherit; background-color: rgba(0, 0, 0, 0.04); } -img { - max-width:100%; - height: auto; +img { + max-width:100%; + height: auto; +} +.tabbed-pane { + padding-top: 12px; +} +button.code-folding-btn:focus { + outline: none; } + + +
+ + + + + + + + + + +

mkin

-

+

The R package mkin provides calculation routines for the analysis of chemical degradation data, including multicompartment kinetics as needed for modelling the formation and decline of transformation products, or if several compartments are involved.

Installation

@@ -89,7 +147,7 @@ img {
  • As of version 0.9-39, fitting of several models to several datasets, optionally in parallel, is supported, see for example plot.mmkin.
  • Model solution (forward modelling) in the function mkinpredict is performed either using the analytical solution for the case of parent only degradation, an eigenvalue based solution if only simple first-order (SFO) or SFORB kinetics are used in the model, or using a numeric solver from the deSolve package (default is lsoda).
  • If a C compiler is installed, the kinetic models are compiled from automatically generated C code, see
    - vignette compiled_models. The autogeneration of C code was inspired by the ccSolve package. Thanks to Karline Soetaert for her work on that.
  • +vignette compiled_models. The autogeneration of C code was inspired by the ccSolve package. Thanks to Karline Soetaert for her work on that.
  • By default, kinetic rate constants and kinetic formation fractions are transformed internally using transform_odeparms so their estimators can more reasonably be expected to follow a normal distribution. This has the side effect that no constraints are needed in the optimisation. Thanks to René Lehmann for the nice cooperation on this, especially the isometric logration transformation that is now used for the formation fractions.
  • A side effect of this is that when parameter estimates are backtransformed to match the model definition, confidence intervals calculated from standard errors are also backtransformed to the correct scale, and will not include meaningless values like negative rate constants or formation fractions adding up to more than 1, which can not occur in a single experiment with a single defined radiolabel position.
  • The usual one-sided t-test for significant difference from zero is nevertheless shown based on estimators for the untransformed parameters.
  • @@ -125,6 +183,8 @@ img {
    + +
    -- cgit v1.2.1 From 1c81442284a25a9cf4979d9236ec0c1a1cf8a8dd Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sat, 22 Oct 2016 17:55:12 +0200 Subject: Update way to specify encoding, improve FOCUS_L TOC --- vignettes/FOCUS_D.Rmd | 12 ++--- vignettes/FOCUS_D.html | 29 +++++------ vignettes/FOCUS_L.Rmd | 8 ++-- vignettes/FOCUS_L.html | 106 ++++++++++++++++++++++------------------- vignettes/FOCUS_Z.pdf | Bin 239565 -> 239558 bytes vignettes/compiled_models.Rmd | 2 +- vignettes/compiled_models.html | 50 +++++++++---------- vignettes/mkin.Rmd | 2 +- vignettes/mkin.html | 64 ++++++++++++++++--------- 9 files changed, 149 insertions(+), 124 deletions(-) diff --git a/vignettes/FOCUS_D.Rmd b/vignettes/FOCUS_D.Rmd index 4edc7bf2..57b2d9d6 100644 --- a/vignettes/FOCUS_D.Rmd +++ b/vignettes/FOCUS_D.Rmd @@ -10,7 +10,7 @@ output: vignette: > %\VignetteIndexEntry{Example evaluation of FOCUS Example Dataset D} %\VignetteEngine{knitr::rmarkdown} - \usepackage[utf8]{inputenc} + %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} @@ -25,7 +25,7 @@ library we look a the data. We have observed concentrations in the column named named `parent` and `m1`. -```{r} +```{r data} library("mkin") print(FOCUS_2006_D) ``` @@ -38,7 +38,7 @@ 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. -```{r} +```{r model} SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO")) print(SFO_SFO$diffs) ``` @@ -46,21 +46,21 @@ print(SFO_SFO$diffs) We do the fitting without progress report (`quiet = TRUE`). -```{r} +```{r fit} 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` method for `mkinfit` objects. -```{r, fig.height = 5} +```{r plot, fig.height = 5} plot(fit, show_residuals = TRUE) ``` Confidence intervals for the parameter estimates are obtained using the `mkinparplot` function. -```{r, fig.height = 4} +```{r plot_2, fig.height = 4} mkinparplot(fit) ``` diff --git a/vignettes/FOCUS_D.html b/vignettes/FOCUS_D.html index af9b2e9f..743ec52b 100644 --- a/vignettes/FOCUS_D.html +++ b/vignettes/FOCUS_D.html @@ -11,13 +11,13 @@ - + Example evaluation of FOCUS Example Dataset D - + @@ -95,6 +95,7 @@ button.code-folding-btn:focus { +
    @@ -118,19 +119,14 @@ $(document).ready(function () {

    Example evaluation of FOCUS Example Dataset D

    Johannes Ranke

    -

    2016-09-28

    +

    2016-10-22

    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")
    -
    ## Loading required package: minpack.lm
    -
    ## Loading required package: rootSolve
    -
    ## Loading required package: inline
    -
    ## Loading required package: methods
    -
    ## Loading required package: parallel
    -
    print(FOCUS_2006_D)
    +
    library("mkin")
    +print(FOCUS_2006_D)
    ##      name time  value
     ## 1  parent    0  99.46
     ## 2  parent    0 102.04
    @@ -189,16 +185,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 method for mkinfit objects.

    plot(fit, show_residuals = TRUE)
    -

    +

    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.44.9000 
    +
    ## mkin version:    0.9.44 
     ## R version:       3.3.1 
    -## Date of fit:     Wed Sep 28 08:12:47 2016 
    -## Date of summary: Wed Sep 28 08:12:48 2016 
    +## Date of fit:     Sat Oct 22 17:45:21 2016 
    +## Date of summary: Sat Oct 22 17:45:21 2016 
     ## 
     ## Equations:
     ## d_parent = - k_parent_sink * parent - k_parent_m1 * parent
    @@ -206,7 +202,7 @@ $(document).ready(function () {
     ## 
     ## Model predictions using solution type deSolve 
     ## 
    -## Fitted with method Port using 153 model solutions performed in 0.641 s
    +## Fitted with method Port using 153 model solutions performed in 0.663 s
     ## 
     ## Weighting: none
     ## 
    @@ -330,6 +326,7 @@ $(document).ready(function () {
       $('tr.header').parent('thead').parent('table').addClass('table table-condensed');
     });
     
    +
     
     
     
    diff --git a/vignettes/FOCUS_L.Rmd b/vignettes/FOCUS_L.Rmd
    index 72a5ba34..ccf7c85e 100644
    --- a/vignettes/FOCUS_L.Rmd
    +++ b/vignettes/FOCUS_L.Rmd
    @@ -21,12 +21,12 @@ references:
     vignette: >
       %\VignetteIndexEntry{Example evaluation of FOCUS Laboratory Data L1 to L3}
       %\VignetteEngine{knitr::rmarkdown}
    -  \usepackage[utf8]{inputenc}
    +  %\VignetteEncoding{UTF-8}
     ---
     
     ```{r, include = FALSE}
     library(knitr)
    -opts_chunk$set(tidy = FALSE, cache = TRUE)
    +opts_chunk$set(tidy = FALSE, cache = FALSE)
     ```
     
     # Laboratory Data L1
    @@ -189,7 +189,7 @@ FOCUS_2006_L3 = data.frame(
     FOCUS_2006_L3_mkin <- mkin_wide_to_long(FOCUS_2006_L3)
     ```
     
    -## Use mmkin to fit multiple models
    +## 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
    @@ -209,7 +209,7 @@ 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.
     
    -## Accessing elements of mmkin objects
    +## Accessing mmkin objects
     
     The objects returned by mmkin are arranged like a matrix, with 
     models as a row index and datasets as a column index.
    diff --git a/vignettes/FOCUS_L.html b/vignettes/FOCUS_L.html
    index 16fa2ac0..ab25f2f1 100644
    --- a/vignettes/FOCUS_L.html
    +++ b/vignettes/FOCUS_L.html
    @@ -11,19 +11,19 @@
     
     
     
    -
    +
     
     Example evaluation of FOCUS Laboratory Data L1 to L3
     
     
    -
    -
    -
     
    -
    +
     
     
     
    +
    +
    +
     
     
     
    @@ -98,6 +98,7 @@ button.code-folding-btn:focus {
     
     
     
    +
     
    @@ -215,7 +216,7 @@ div.tocify {

    Example evaluation of FOCUS Laboratory Data L1 to L3

    Johannes Ranke

    -

    2016-09-28

    +

    2016-10-22

    @@ -234,17 +235,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.44.9000 
    +
    ## mkin version:    0.9.44 
     ## R version:       3.3.1 
    -## Date of fit:     Wed Sep 28 08:12:49 2016 
    -## Date of summary: Wed Sep 28 08:12:49 2016 
    +## Date of fit:     Sat Oct 22 17:54:39 2016 
    +## Date of summary: Sat Oct 22 17:54:39 2016 
     ## 
     ## Equations:
     ## d_parent = - k_parent_sink * parent
     ## 
     ## Model predictions using solution type analytical 
     ## 
    -## Fitted with method Port using 37 model solutions performed in 0.092 s
    +## Fitted with method Port using 37 model solutions performed in 0.09 s
     ## 
     ## Weighting: none
     ## 
    @@ -316,21 +317,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.44.9000 
    +
    ## mkin version:    0.9.44 
     ## R version:       3.3.1 
    -## Date of fit:     Wed Sep 28 08:12:49 2016 
    -## Date of summary: Wed Sep 28 08:12:49 2016 
    +## Date of fit:     Sat Oct 22 17:54:40 2016 
    +## Date of summary: Sat Oct 22 17:54:40 2016 
     ## 
     ## 
     ## Warning: Optimisation by method Port did not converge.
    @@ -342,7 +343,7 @@ summary(m.L1.SFO)
    ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 188 model solutions performed in 0.43 s +## Fitted with method Port using 188 model solutions performed in 0.417 s ## ## Weighting: none ## @@ -394,7 +395,7 @@ summary(m.L1.SFO)
    ## parent 7.25 24.08 7.25

    We get a warning that the default optimisation algorithm Port did not converge, which is an indication that the model is overparameterised, i.e. contains too many parameters that are ill-defined as a consequence.

    And in fact, due to the higher number of parameters, and the lower number of degrees of freedom of the fit, the χ2 error level is actually higher for the FOMC model (3.6%) than for the SFO model (3.4%). Additionally, the parameters log_alpha and log_beta internally fitted in the model have excessive confidence intervals, that span more than 25 orders of magnitude (!) when backtransformed to the scale of alpha and beta. Also, the t-test for significant difference from zero does not indicate such a significant difference, with p-values greater than 0.1, and finally, the parameter correlation of log_alpha and log_beta is 1.000, clearly indicating that the model is overparameterised.

    -

    The χ2 error levels reported in Appendix 3 and Appendix 7 to the FOCUS kinetics report are rounded to integer percentages and partly deviate by one percentage point from the results calculated by mkin. The reason for this is not known. However, mkin gives the same χ2 error levels as the kinfit package and the calculation routines of the kinfit package have been extensively compared to the results obtained by the KinGUI software, as documented in the kinfit package vignette. KinGUI was the first widely used standard package in this field. Also, the calculation of χ2 error levels was compared with KinGUII, CAKE and DegKin manager in a project sponsored by the German Umweltbundesamt (Ranke).

    +

    The χ2 error levels reported in Appendix 3 and Appendix 7 to the FOCUS kinetics report are rounded to integer percentages and partly deviate by one percentage point from the results calculated by mkin. The reason for this is not known. However, mkin gives the same χ2 error levels as the kinfit package and the calculation routines of the kinfit package have been extensively compared to the results obtained by the KinGUI software, as documented in the kinfit package vignette. KinGUI was the first widely used standard package in this field. Also, the calculation of χ2 error levels was compared with KinGUII, CAKE and DegKin manager in a project sponsored by the German Umweltbundesamt (Ranke, n.d.).

    Laboratory Data L2

    @@ -411,7 +412,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.

    @@ -422,19 +423,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.44.9000 
    +
    ## mkin version:    0.9.44 
     ## R version:       3.3.1 
    -## Date of fit:     Wed Sep 28 08:12:50 2016 
    -## Date of summary: Wed Sep 28 08:12:50 2016 
    +## Date of fit:     Sat Oct 22 17:54:40 2016 
    +## Date of summary: Sat Oct 22 17:54:40 2016 
     ## 
     ## Equations:
     ## d_parent = - (alpha/beta) * 1/((time/beta) + 1) * parent
     ## 
     ## Model predictions using solution type analytical 
     ## 
    -## Fitted with method Port using 81 model solutions performed in 0.177 s
    +## Fitted with method Port using 81 model solutions performed in 0.179 s
     ## 
     ## Weighting: none
     ## 
    @@ -492,12 +493,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.44.9000 
    +
    ## mkin version:    0.9.44 
     ## R version:       3.3.1 
    -## Date of fit:     Wed Sep 28 08:12:51 2016 
    -## Date of summary: Wed Sep 28 08:12:51 2016 
    +## Date of fit:     Sat Oct 22 17:54:41 2016 
    +## Date of summary: Sat Oct 22 17:54:41 2016 
     ## 
     ## Equations:
     ## d_parent = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
    @@ -506,7 +507,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.79 s
    +## Fitted with method Port using 336 model solutions performed in 0.759 s
     ## 
     ## Weighting: none
     ## 
    @@ -568,25 +569,25 @@ plot(m.L2.DFOP, show_residuals = TRUE, show_errmin = TRUE,
       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)
    -
    -

    Use mmkin to fit multiple models

    +
    +

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

    -
    -

    Accessing elements of mmkin objects

    +
    +

    Accessing mmkin objects

    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.44.9000 
    +
    ## mkin version:    0.9.44 
     ## R version:       3.3.1 
    -## Date of fit:     Wed Sep 28 08:12:51 2016 
    -## Date of summary: Wed Sep 28 08:12:51 2016 
    +## Date of fit:     Sat Oct 22 17:54:42 2016 
    +## Date of summary: Sat Oct 22 17:54:42 2016 
     ## 
     ## Equations:
     ## d_parent = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
    @@ -595,7 +596,7 @@ plot(mm.L3)
    ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 137 model solutions performed in 0.32 s +## Fitted with method Port using 137 model solutions performed in 0.309 s ## ## Weighting: none ## @@ -662,7 +663,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.

    @@ -680,20 +681,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.44.9000 
    +
    ## mkin version:    0.9.44 
     ## R version:       3.3.1 
    -## Date of fit:     Wed Sep 28 08:12:52 2016 
    -## Date of summary: Wed Sep 28 08:12:52 2016 
    +## Date of fit:     Sat Oct 22 17:54:42 2016 
    +## Date of summary: Sat Oct 22 17:54:43 2016 
     ## 
     ## Equations:
     ## d_parent = - k_parent_sink * parent
     ## 
     ## Model predictions using solution type analytical 
     ## 
    -## Fitted with method Port using 46 model solutions performed in 0.104 s
    +## Fitted with method Port using 46 model solutions performed in 0.101 s
     ## 
     ## Weighting: none
     ## 
    @@ -743,17 +744,17 @@ plot(mm.L4)
    ## DT50 DT90 ## parent 106 352
    summary(mm.L4[["FOMC", 1]], data = FALSE)
    -
    ## mkin version:    0.9.44.9000 
    +
    ## mkin version:    0.9.44 
     ## R version:       3.3.1 
    -## Date of fit:     Wed Sep 28 08:12:52 2016 
    -## Date of summary: Wed Sep 28 08:12:52 2016 
    +## Date of fit:     Sat Oct 22 17:54:43 2016 
    +## Date of summary: Sat Oct 22 17:54:43 2016 
     ## 
     ## Equations:
     ## d_parent = - (alpha/beta) * 1/((time/beta) + 1) * parent
     ## 
     ## Model predictions using solution type analytical 
     ## 
    -## Fitted with method Port using 66 model solutions performed in 0.148 s
    +## Fitted with method Port using 66 model solutions performed in 0.144 s
     ## 
     ## Weighting: none
     ## 
    @@ -804,9 +805,13 @@ plot(mm.L4)
    ## DT50 DT90 DT50back ## parent 108.9 1644 494.9
    -
    +

    References

    -

    Ranke, Johannes. Prüfung und Validierung von Modellierungssoftware als Alternative zu ModelMaker 4.0. Umweltbundesamt Projektnummer 27452.

    +
    +
    +

    Ranke, Johannes. n.d. “Prüfung und Validierung von Modellierungssoftware als Alternative zu ModelMaker 4.0.” Umweltbundesamt Projektnummer 27452.

    +
    +
    @@ -823,6 +828,7 @@ $(document).ready(function () { $('tr.header').parent('thead').parent('table').addClass('table table-condensed'); }); + diff --git a/vignettes/FOCUS_Z.pdf b/vignettes/FOCUS_Z.pdf index bc37c873..6f71d018 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 7a8ef6f1..3db5cfe8 100644 --- a/vignettes/compiled_models.Rmd +++ b/vignettes/compiled_models.Rmd @@ -11,7 +11,7 @@ output: vignette: > %\VignetteIndexEntry{Performance benefit by using compiled model definitions in mkin} %\VignetteEngine{knitr::rmarkdown} - \usepackage[utf8]{inputenc} + %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} diff --git a/vignettes/compiled_models.html b/vignettes/compiled_models.html index 7a9537c7..c941f6ae 100644 --- a/vignettes/compiled_models.html +++ b/vignettes/compiled_models.html @@ -11,19 +11,19 @@ - + Performance benefit by using compiled model definitions in mkin - - - - + + + + @@ -98,6 +98,7 @@ button.code-folding-btn:focus { +
    @@ -215,7 +216,7 @@ div.tocify {

    Performance benefit by using compiled model definitions in mkin

    Johannes Ranke

    -

    2016-09-28

    +

    2016-10-22

    @@ -256,21 +257,21 @@ mb.1 <- microbenchmark( print(mb.1)
    ## Unit: milliseconds
     ##                   expr       min        lq      mean    median        uq
    -##  deSolve, not compiled 5191.7067 5234.0766 5254.1638 5276.4465 5285.3923
    -##       Eigenvalue based  837.7118  839.5009  848.7273  841.2900  854.2351
    -##      deSolve, compiled  725.9412  738.4609  776.5436  750.9807  801.8448
    +##  deSolve, not compiled 5099.8455 5110.8441 5119.1894 5121.8427 5128.8613
    +##       Eigenvalue based  845.6937  847.1686  861.2028  848.6434  868.9574
    +##      deSolve, compiled  701.8677  704.0306  705.7280  706.1935  707.6581
     ##        max neval cld
    -##  5294.3381     3   b
    -##   867.1802     3  a 
    -##   852.7088     3  a
    +## 5135.8800 3 c +## 889.2714 3 b +## 709.1228 3 a
    autoplot(mb.1)
    -

    -

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

    +

    +

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

    rownames(smb.1) <- smb.1$expr
     smb.1["median"]/smb.1["deSolve, compiled", "median"]
    ##                         median
    -## deSolve, not compiled 7.026075
    -## Eigenvalue based      1.120255
    +## deSolve, not compiled 7.252747
    +## Eigenvalue based      1.201715
     ## deSolve, compiled     1.000000
    @@ -291,20 +292,20 @@ smb.1["median"]/smb.1["deSolve, compiled", "median"
    smb.2 <- summary(mb.2)
     print(mb.2)
    ## Unit: seconds
    -##                   expr       min        lq      mean   median        uq
    -##  deSolve, not compiled 10.977718 11.003379 11.044286 11.02904 11.077570
    -##      deSolve, compiled  1.289028  1.296324  1.332644  1.30362  1.354451
    +##                   expr       min        lq      mean    median        uq
    +##  deSolve, not compiled 10.850714 10.861070 10.893285 10.871427 10.914570
    +##      deSolve, compiled  1.278907  1.285111  1.300237  1.291314  1.310902
     ##        max neval cld
    -##  11.126100     3   b
    -##   1.405282     3  a
    +## 10.957713 3 b +## 1.330489 3 a
    smb.2["median"]/smb.2["deSolve, compiled", "median"]
    ##   median
     ## 1     NA
     ## 2     NA
    autoplot(mb.2)
    -

    -

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

    -

    This vignette was built with mkin 0.9.44.9000 on

    +

    +

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

    +

    This vignette was built with mkin 0.9.44 on

    ## R version 3.3.1 (2016-06-21)
     ## Platform: x86_64-pc-linux-gnu (64-bit)
     ## Running under: Debian GNU/Linux 8 (jessie)
    @@ -325,6 +326,7 @@ $(document).ready(function () { $('tr.header').parent('thead').parent('table').addClass('table table-condensed'); }); + diff --git a/vignettes/mkin.Rmd b/vignettes/mkin.Rmd index 3f579519..906b3b01 100644 --- a/vignettes/mkin.Rmd +++ b/vignettes/mkin.Rmd @@ -12,7 +12,7 @@ bibliography: references.bib vignette: > %\VignetteEngine{knitr::rmarkdown} %\VignetteIndexEntry{mkin - Kinetic evaluation of chemical degradation data} - \usepackage[utf8]{inputenc} + %\VignetteEncoding{UTF-8} --- [Wissenschaftlicher Berater, Kronacher Str. 8, 79639 Grenzach-Wyhlen, Germany](http://www.jrwb.de)
    diff --git a/vignettes/mkin.html b/vignettes/mkin.html index 857acb30..a32c1375 100644 --- a/vignettes/mkin.html +++ b/vignettes/mkin.html @@ -11,19 +11,19 @@ - + mkin - Kinetic evaluation of chemical degradation data - - - - + + + + @@ -98,6 +98,7 @@ button.code-folding-btn:focus { +
    @@ -109,7 +110,11 @@ $(document).ready(function () { - + + -- cgit v1.2.1 From 0ce4dd40fc31b4297aa8f237b20c7f5daa46ea32 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sat, 22 Oct 2016 22:38:45 +0200 Subject: Improve yaml formatting --- vignettes/FOCUS_L.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/FOCUS_L.Rmd b/vignettes/FOCUS_L.Rmd index ccf7c85e..b500243b 100644 --- a/vignettes/FOCUS_L.Rmd +++ b/vignettes/FOCUS_L.Rmd @@ -17,7 +17,7 @@ references: given: Johannes type: report year: 2014 - number: Umweltbundesamt Projektnummer 27452 + number: "Umweltbundesamt Projektnummer 27452" vignette: > %\VignetteIndexEntry{Example evaluation of FOCUS Laboratory Data L1 to L3} %\VignetteEngine{knitr::rmarkdown} -- cgit v1.2.1