From 7008a4ee100830a29a923a05274fd4ca216cd1ea Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 1 Jul 2022 09:08:49 +0200 Subject: Add R version to data in benchmark vignette --- GNUmakefile | 2 +- docs/404.html | 2 +- docs/articles/FOCUS_L.html | 210 +- .../figure-html/unnamed-chunk-6-1.png | Bin 36120 -> 36101 bytes docs/articles/index.html | 2 +- docs/articles/web_only/benchmarks.html | 408 ++-- docs/authors.html | 2 +- docs/index.html | 13 +- docs/news/index.html | 2 +- docs/pkgdown.yml | 4 +- docs/reference/index.html | 2 +- docs/reference/mkinds.html | 23 +- docs/reference/mkindsg.html | 29 +- vignettes/FOCUS_L.rmd | 2 +- vignettes/web_only/benchmarks.R | 112 + vignettes/web_only/benchmarks.html | 2190 ++++++++++++++++++++ vignettes/web_only/benchmarks.rmd | 53 +- vignettes/web_only/mkin_benchmarks.rda | Bin 1269 -> 1300 bytes 18 files changed, 2777 insertions(+), 279 deletions(-) create mode 100644 vignettes/web_only/benchmarks.R create mode 100644 vignettes/web_only/benchmarks.html diff --git a/GNUmakefile b/GNUmakefile index d6a6d9b5..569e10ea 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -104,7 +104,7 @@ vignettes/%.html: vignettes/mkin_vignettes.css vignettes/references.bib vignette vignettes: vignettes/mkin.html vignettes/FOCUS_D.html vignettes/FOCUS_L.html vignettes/twa.html vignettes/web_only/%.html: vignettes/references.bib vignettes/web_only/%.rmd - "$(RBIN)/Rscript" -e "tools::buildVignette(file = 'vignettes/web_only/$*.rmd', dir = 'vignettes/web_only')" + "$(RBIN)/Rscript" -e "tools::buildVignette(file = 'vignettes/web_only/$*.rmd', dir = 'vignettes/web_only', keep='mkin_benchmarks.rda')" articles: vignettes/web_only/FOCUS_Z.html vignettes/web_only/compiled_models.html vignettes/web_only/benchmarks.html vignettes/web_only/dimethenamid_2018.html diff --git a/docs/404.html b/docs/404.html index e4837693..6d48c164 100644 --- a/docs/404.html +++ b/docs/404.html @@ -124,7 +124,7 @@ Content not found. Please use links in the navbar.

-

Site built with pkgdown 2.0.3.

+

Site built with pkgdown 2.0.5.

diff --git a/docs/articles/FOCUS_L.html b/docs/articles/FOCUS_L.html index 5f41b6a3..d3918ef4 100644 --- a/docs/articles/FOCUS_L.html +++ b/docs/articles/FOCUS_L.html @@ -105,7 +105,7 @@

Example evaluation of FOCUS Laboratory Data L1 to L3

Johannes Ranke

-

Last change 17 November 2016 (rebuilt 2022-05-18)

+

Last change 18 May 2022 (rebuilt 2022-06-30)

Source: vignettes/FOCUS_L.rmd @@ -130,18 +130,18 @@

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)
+summary(m.L1.SFO)
## mkin version used for fitting:    1.1.0 
-## R version used for fitting:       4.2.0 
-## Date of fit:     Wed May 18 20:42:32 2022 
-## Date of summary: Wed May 18 20:42:32 2022 
+## R version used for fitting:       4.2.1 
+## Date of fit:     Thu Jun 30 10:43:59 2022 
+## Date of summary: Thu Jun 30 10:43:59 2022 
 ## 
 ## Equations:
 ## d_parent/dt = - k_parent * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted using 133 model solutions performed in 0.031 s
+## Fitted using 133 model solutions performed in 0.032 s
 ## 
 ## Error model: Constant variance 
 ## 
@@ -173,9 +173,9 @@
 ## 
 ## Parameter correlation:
 ##                parent_0 log_k_parent      sigma
-## parent_0      1.000e+00    6.186e-01 -1.712e-09
-## log_k_parent  6.186e-01    1.000e+00 -3.237e-09
-## sigma        -1.712e-09   -3.237e-09  1.000e+00
+## parent_0      1.000e+00    6.186e-01 -1.516e-09
+## log_k_parent  6.186e-01    1.000e+00 -3.124e-09
+## sigma        -1.516e-09   -3.124e-09  1.000e+00
 ## 
 ## Backtransformed parameters:
 ## Confidence intervals for internally transformed parameters are asymmetric.
@@ -217,7 +217,7 @@
 ##    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")
+plot(m.L1.SFO, show_errmin = TRUE, main = "FOCUS L1 - SFO")

The residual plot can be easily obtained by

@@ -225,26 +225,29 @@
 

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)
-plot(m.L1.FOMC, show_errmin = TRUE, main = "FOCUS L1 - FOMC")
+m.L1.FOMC <- mkinfit("FOMC", FOCUS_2006_L1_mkin, quiet=TRUE)
+
## Warning in mkinfit("FOMC", FOCUS_2006_L1_mkin, quiet = TRUE): Optimisation did not converge:
+## false convergence (8)
+
+plot(m.L1.FOMC, show_errmin = TRUE, main = "FOCUS L1 - FOMC")

-
-summary(m.L1.FOMC, data = FALSE)
+
+summary(m.L1.FOMC, data = FALSE)
## Warning in sqrt(diag(covar)): NaNs produced
## Warning in sqrt(1/diag(V)): NaNs produced
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
 ## doubtful
## mkin version used for fitting:    1.1.0 
-## R version used for fitting:       4.2.0 
-## Date of fit:     Wed May 18 20:42:33 2022 
-## Date of summary: Wed May 18 20:42:33 2022 
+## R version used for fitting:       4.2.1 
+## Date of fit:     Thu Jun 30 10:44:00 2022 
+## Date of summary: Thu Jun 30 10:44:00 2022 
 ## 
 ## Equations:
 ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted using 357 model solutions performed in 0.072 s
+## Fitted using 369 model solutions performed in 0.082 s
 ## 
 ## Error model: Constant variance 
 ## 
@@ -265,34 +268,39 @@
 ## Fixed parameter values:
 ## None
 ## 
+## 
+## Warning(s): 
+## Optimisation did not converge:
+## false convergence (8)
+## 
 ## Results:
 ## 
-##        AIC      BIC    logLik
-##   95.88804 99.44953 -43.94402
+##        AIC      BIC   logLik
+##   95.88781 99.44929 -43.9439
 ## 
 ## Optimised, transformed parameters with symmetric confidence intervals:
 ##           Estimate Std. Error  Lower  Upper
 ## parent_0     92.47     1.2820 89.720 95.220
-## log_alpha    11.37        NaN    NaN    NaN
-## log_beta     13.72        NaN    NaN    NaN
-## sigma         2.78     0.4621  1.789  3.771
+## log_alpha    13.78        NaN    NaN    NaN
+## log_beta     16.13        NaN    NaN    NaN
+## sigma         2.78     0.4598  1.794  3.766
 ## 
 ## Parameter correlation:
 ##            parent_0 log_alpha log_beta     sigma
-## parent_0  1.0000000       NaN      NaN 0.0005548
+## parent_0  1.0000000       NaN      NaN 0.0001671
 ## log_alpha       NaN         1      NaN       NaN
 ## log_beta        NaN       NaN        1       NaN
-## sigma     0.0005548       NaN      NaN 1.0000000
+## sigma     0.0001671       NaN      NaN 1.0000000
 ## 
 ## Backtransformed parameters:
 ## Confidence intervals for internally transformed parameters are asymmetric.
 ## t-test (unrealistically) based on the assumption of normal distribution
 ## for estimators of untransformed parameters.
 ##           Estimate t value Pr(>t)  Lower  Upper
-## parent_0     92.47      NA     NA 89.720 95.220
-## alpha     87110.00      NA     NA     NA     NA
-## beta     911100.00      NA     NA     NA     NA
-## sigma         2.78      NA     NA  1.789  3.771
+## parent_0 9.247e+01      NA     NA 89.720 95.220
+## alpha    9.658e+05      NA     NA     NA     NA
+## beta     1.010e+07      NA     NA     NA     NA
+## sigma    2.780e+00      NA     NA  1.794  3.766
 ## 
 ## FOCUS Chi2 error levels in percent:
 ##          err.min n.optim df
@@ -300,8 +308,8 @@
 ## parent     3.619       3  6
 ## 
 ## Estimated disappearance times:
-##         DT50  DT90 DT50back
-## parent 7.249 24.08    7.249
+## DT50 DT90 DT50back +## 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 \(\chi^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 \(\chi^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 \(\chi^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 \(\chi^2\) error levels was compared with KinGUII, CAKE and DegKin manager in a project sponsored by the German Umweltbundesamt (Ranke 2014).

@@ -310,7 +318,7 @@

Laboratory Data L2

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

-
+
 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,
@@ -321,9 +329,9 @@
 

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)
-plot(m.L2.SFO, show_residuals = TRUE, show_errmin = TRUE,
+plot(m.L2.SFO, show_residuals = TRUE, show_errmin = TRUE,
      main = "FOCUS L2 - SFO")

The \(\chi^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.

@@ -334,24 +342,24 @@

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)
-plot(m.L2.FOMC, show_residuals = TRUE,
+plot(m.L2.FOMC, show_residuals = TRUE,
      main = "FOCUS L2 - FOMC")

-
-summary(m.L2.FOMC, data = FALSE)
+
+summary(m.L2.FOMC, data = FALSE)
## mkin version used for fitting:    1.1.0 
-## R version used for fitting:       4.2.0 
-## Date of fit:     Wed May 18 20:42:33 2022 
-## Date of summary: Wed May 18 20:42:33 2022 
+## R version used for fitting:       4.2.1 
+## Date of fit:     Thu Jun 30 10:44:01 2022 
+## Date of summary: Thu Jun 30 10:44:01 2022 
 ## 
 ## Equations:
 ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted using 239 model solutions performed in 0.044 s
+## Fitted using 239 model solutions performed in 0.049 s
 ## 
 ## Error model: Constant variance 
 ## 
@@ -386,10 +394,10 @@
 ## 
 ## Parameter correlation:
 ##             parent_0  log_alpha   log_beta      sigma
-## parent_0   1.000e+00 -1.151e-01 -2.085e-01 -7.637e-09
-## log_alpha -1.151e-01  1.000e+00  9.741e-01 -1.617e-07
-## log_beta  -2.085e-01  9.741e-01  1.000e+00 -1.387e-07
-## sigma     -7.637e-09 -1.617e-07 -1.387e-07  1.000e+00
+## parent_0   1.000e+00 -1.151e-01 -2.085e-01 -7.828e-09
+## log_alpha -1.151e-01  1.000e+00  9.741e-01 -1.602e-07
+## log_beta  -2.085e-01  9.741e-01  1.000e+00 -1.372e-07
+## sigma     -7.828e-09 -1.602e-07 -1.372e-07  1.000e+00
 ## 
 ## Backtransformed parameters:
 ## Confidence intervals for internally transformed parameters are asymmetric.
@@ -415,17 +423,17 @@
 

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)
-plot(m.L2.DFOP, show_residuals = TRUE, show_errmin = TRUE,
+plot(m.L2.DFOP, show_residuals = TRUE, show_errmin = TRUE,
      main = "FOCUS L2 - DFOP")

-
-summary(m.L2.DFOP, data = FALSE)
+
+summary(m.L2.DFOP, data = FALSE)
## mkin version used for fitting:    1.1.0 
-## R version used for fitting:       4.2.0 
-## Date of fit:     Wed May 18 20:42:34 2022 
-## Date of summary: Wed May 18 20:42:34 2022 
+## R version used for fitting:       4.2.1 
+## Date of fit:     Thu Jun 30 10:44:01 2022 
+## Date of summary: Thu Jun 30 10:44:01 2022 
 ## 
 ## Equations:
 ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
@@ -434,7 +442,7 @@
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted using 581 model solutions performed in 0.121 s
+## Fitted using 581 model solutions performed in 0.132 s
 ## 
 ## Error model: Constant variance 
 ## 
@@ -465,18 +473,18 @@
 ## Optimised, transformed parameters with symmetric confidence intervals:
 ##          Estimate Std. Error      Lower     Upper
 ## parent_0   93.950  9.998e-01    91.5900   96.3100
-## log_k1      3.113  1.845e+03 -4360.0000 4367.0000
+## log_k1      3.112  1.842e+03 -4353.0000 4359.0000
 ## log_k2     -1.088  6.285e-02    -1.2370   -0.9394
 ## g_qlogis   -0.399  9.946e-02    -0.6342   -0.1638
 ## sigma       1.414  2.886e-01     0.7314    2.0960
 ## 
 ## Parameter correlation:
 ##            parent_0     log_k1     log_k2   g_qlogis      sigma
-## parent_0  1.000e+00  6.784e-07 -5.188e-10  2.665e-01 -5.800e-10
-## log_k1    6.784e-07  1.000e+00  1.114e-04 -2.191e-04 -1.029e-05
-## log_k2   -5.188e-10  1.114e-04  1.000e+00 -7.903e-01  5.080e-09
-## g_qlogis  2.665e-01 -2.191e-04 -7.903e-01  1.000e+00 -7.991e-09
-## sigma    -5.800e-10 -1.029e-05  5.080e-09 -7.991e-09  1.000e+00
+## parent_0  1.000e+00  6.783e-07 -3.390e-10  2.665e-01 -2.967e-10
+## log_k1    6.783e-07  1.000e+00  1.116e-04 -2.196e-04 -1.031e-05
+## log_k2   -3.390e-10  1.116e-04  1.000e+00 -7.903e-01  2.917e-09
+## g_qlogis  2.665e-01 -2.196e-04 -7.903e-01  1.000e+00 -4.408e-09
+## sigma    -2.967e-10 -1.031e-05  2.917e-09 -4.408e-09  1.000e+00
 ## 
 ## Backtransformed parameters:
 ## Confidence intervals for internally transformed parameters are asymmetric.
@@ -484,7 +492,7 @@
 ## for estimators of untransformed parameters.
 ##          Estimate   t value    Pr(>t)   Lower   Upper
 ## parent_0  93.9500 9.397e+01 2.036e-12 91.5900 96.3100
-## k1        22.4800 5.544e-04 4.998e-01  0.0000     Inf
+## k1        22.4800 5.553e-04 4.998e-01  0.0000     Inf
 ## k2         0.3369 1.591e+01 4.697e-07  0.2904  0.3909
 ## g          0.4016 1.680e+01 3.238e-07  0.3466  0.4591
 ## sigma      1.4140 4.899e+00 8.776e-04  0.7314  2.0960
@@ -496,7 +504,7 @@
 ## 
 ## Estimated disappearance times:
 ##          DT50  DT90 DT50back DT50_k1 DT50_k2
-## parent 0.5335 5.311    1.599 0.03083   2.058
+## parent 0.5335 5.311 1.599 0.03084 2.058

Here, the DFOP model is clearly the best-fit model for dataset L2 based on the chi^2 error level criterion.

@@ -504,7 +512,7 @@

Laboratory Data L3

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

-
+
 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))
@@ -513,11 +521,11 @@
 

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

@@ -526,12 +534,12 @@

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]])
+
+summary(mm.L3[["DFOP", 1]])
## mkin version used for fitting:    1.1.0 
-## R version used for fitting:       4.2.0 
-## Date of fit:     Wed May 18 20:42:34 2022 
-## Date of summary: Wed May 18 20:42:35 2022 
+## R version used for fitting:       4.2.1 
+## Date of fit:     Thu Jun 30 10:44:02 2022 
+## Date of summary: Thu Jun 30 10:44:02 2022 
 ## 
 ## Equations:
 ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
@@ -540,7 +548,7 @@
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted using 376 model solutions performed in 0.073 s
+## Fitted using 376 model solutions performed in 0.08 s
 ## 
 ## Error model: Constant variance 
 ## 
@@ -578,11 +586,11 @@
 ## 
 ## Parameter correlation:
 ##            parent_0     log_k1     log_k2   g_qlogis      sigma
-## parent_0  1.000e+00  1.732e-01  2.282e-02  4.009e-01 -9.632e-08
-## log_k1    1.732e-01  1.000e+00  4.945e-01 -5.809e-01  7.145e-07
-## log_k2    2.282e-02  4.945e-01  1.000e+00 -6.812e-01  1.021e-06
-## g_qlogis  4.009e-01 -5.809e-01 -6.812e-01  1.000e+00 -7.925e-07
-## sigma    -9.632e-08  7.145e-07  1.021e-06 -7.925e-07  1.000e+00
+## parent_0  1.000e+00  1.732e-01  2.282e-02  4.009e-01 -9.664e-08
+## log_k1    1.732e-01  1.000e+00  4.945e-01 -5.809e-01  7.147e-07
+## log_k2    2.282e-02  4.945e-01  1.000e+00 -6.812e-01  1.022e-06
+## g_qlogis  4.009e-01 -5.809e-01 -6.812e-01  1.000e+00 -7.926e-07
+## sigma    -9.664e-08  7.147e-07  1.022e-06 -7.926e-07  1.000e+00
 ## 
 ## Backtransformed parameters:
 ## Confidence intervals for internally transformed parameters are asymmetric.
@@ -614,8 +622,8 @@
 ##    60   parent     22.0     23.26 -1.25919
 ##    91   parent     15.0     15.18 -0.18181
 ##   120   parent     12.0     10.19  1.81395
-
-plot(mm.L3[["DFOP", 1]], show_errmin = TRUE)
+
+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 \(\chi^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.

@@ -625,33 +633,33 @@

Laboratory Data L4

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

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

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),
                quiet = TRUE)
-plot(mm.L4)
+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)
+
+summary(mm.L4[["SFO", 1]], data = FALSE)
## mkin version used for fitting:    1.1.0 
-## R version used for fitting:       4.2.0 
-## Date of fit:     Wed May 18 20:42:35 2022 
-## Date of summary: Wed May 18 20:42:35 2022 
+## R version used for fitting:       4.2.1 
+## Date of fit:     Thu Jun 30 10:44:02 2022 
+## Date of summary: Thu Jun 30 10:44:02 2022 
 ## 
 ## Equations:
 ## d_parent/dt = - k_parent * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted using 142 model solutions performed in 0.027 s
+## Fitted using 142 model solutions performed in 0.03 s
 ## 
 ## Error model: Constant variance 
 ## 
@@ -683,9 +691,9 @@
 ## 
 ## Parameter correlation:
 ##               parent_0 log_k_parent     sigma
-## parent_0     1.000e+00    5.938e-01 3.440e-07
-## log_k_parent 5.938e-01    1.000e+00 5.885e-07
-## sigma        3.440e-07    5.885e-07 1.000e+00
+## parent_0     1.000e+00    5.938e-01 3.387e-07
+## log_k_parent 5.938e-01    1.000e+00 5.830e-07
+## sigma        3.387e-07    5.830e-07 1.000e+00
 ## 
 ## Backtransformed parameters:
 ## Confidence intervals for internally transformed parameters are asymmetric.
@@ -704,19 +712,19 @@
 ## Estimated disappearance times:
 ##        DT50 DT90
 ## parent  106  352
-
-summary(mm.L4[["FOMC", 1]], data = FALSE)
+
+summary(mm.L4[["FOMC", 1]], data = FALSE)
## mkin version used for fitting:    1.1.0 
-## R version used for fitting:       4.2.0 
-## Date of fit:     Wed May 18 20:42:35 2022 
-## Date of summary: Wed May 18 20:42:35 2022 
+## R version used for fitting:       4.2.1 
+## Date of fit:     Thu Jun 30 10:44:02 2022 
+## Date of summary: Thu Jun 30 10:44:03 2022 
 ## 
 ## Equations:
 ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted using 224 model solutions performed in 0.041 s
+## Fitted using 224 model solutions performed in 0.045 s
 ## 
 ## Error model: Constant variance 
 ## 
@@ -751,10 +759,10 @@
 ## 
 ## Parameter correlation:
 ##             parent_0  log_alpha   log_beta      sigma
-## parent_0   1.000e+00 -4.696e-01 -5.543e-01 -2.563e-07
-## log_alpha -4.696e-01  1.000e+00  9.889e-01  4.066e-08
-## log_beta  -5.543e-01  9.889e-01  1.000e+00  6.818e-08
-## sigma     -2.563e-07  4.066e-08  6.818e-08  1.000e+00
+## parent_0   1.000e+00 -4.696e-01 -5.543e-01 -2.468e-07
+## log_alpha -4.696e-01  1.000e+00  9.889e-01  2.478e-08
+## log_beta  -5.543e-01  9.889e-01  1.000e+00  5.211e-08
+## sigma     -2.468e-07  2.478e-08  5.211e-08  1.000e+00
 ## 
 ## Backtransformed parameters:
 ## Confidence intervals for internally transformed parameters are asymmetric.
@@ -803,7 +811,7 @@
 
 

-

Site built with pkgdown 2.0.3.

+

Site built with pkgdown 2.0.2.

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 b56e91e1..b6130527 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/index.html b/docs/articles/index.html index 89eb092b..717c34a8 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -112,7 +112,7 @@
-

Site built with pkgdown 2.0.3.

+

Site built with pkgdown 2.0.5.

diff --git a/docs/articles/web_only/benchmarks.html b/docs/articles/web_only/benchmarks.html index 058d43fa..309cc746 100644 --- a/docs/articles/web_only/benchmarks.html +++ b/docs/articles/web_only/benchmarks.html @@ -105,7 +105,7 @@

Benchmark timings for mkin

Johannes Ranke

-

Last change 13 May 2020 (rebuilt 2022-05-18)

+

Last change 30 June 2022 (rebuilt 2022-07-01)

Source: vignettes/web_only/benchmarks.rmd @@ -114,148 +114,201 @@ -

Each system is characterized by its CPU type, the operating system type and the mkin version. Currently only values for one system are available. A compiler was available, so if no analytical solution was available, compiled ODE models are used.

+

Each system is characterized by the operating system type, the CPU type, the mkin version, and, as in June 2022 the current R version lead to worse performance, the R version. A compiler was available, so if no analytical solution was available, compiled ODE models are used.

+

Every fit is only performed once, so the accuracy of the benchmarks is limited.

Test cases

Parent only:

-FOCUS_C <- FOCUS_2006_C
-FOCUS_D <- subset(FOCUS_2006_D, value != 0)
-parent_datasets <- list(FOCUS_C, FOCUS_D)
-
-t1 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets))[["elapsed"]]
-t2 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets,
-    error_model = "tc"))[["elapsed"]]
+FOCUS_C <- FOCUS_2006_C +FOCUS_D <- subset(FOCUS_2006_D, value != 0) +parent_datasets <- list(FOCUS_C, FOCUS_D) + +t1 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets))[["elapsed"]] +t2 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets, + error_model = "tc"))[["elapsed"]]

One metabolite:

-SFO_SFO <- mkinmod(
-  parent = mkinsub("SFO", "m1"),
-  m1 = mkinsub("SFO"))
-FOMC_SFO <- mkinmod(
-  parent = mkinsub("FOMC", "m1"),
-  m1 = mkinsub("SFO"))
-DFOP_SFO <- mkinmod(
-  parent = mkinsub("FOMC", "m1"),
-  m1 = mkinsub("SFO"))
-t3 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D)))[["elapsed"]]
-t4 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D),
-    error_model = "tc"))[["elapsed"]]
-t5 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D),
-    error_model = "obs"))[["elapsed"]]
+SFO_SFO <- mkinmod( + parent = mkinsub("SFO", "m1"), + m1 = mkinsub("SFO")) +FOMC_SFO <- mkinmod( + parent = mkinsub("FOMC", "m1"), + m1 = mkinsub("SFO")) +DFOP_SFO <- mkinmod( + parent = mkinsub("FOMC", "m1"), + m1 = mkinsub("SFO")) +t3 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D)))[["elapsed"]] +t4 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D), + error_model = "tc"))[["elapsed"]] +t5 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D), + error_model = "obs"))[["elapsed"]]

Two metabolites, synthetic data:

-m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"),
-                           M1 = mkinsub("SFO", "M2"),
-                           M2 = mkinsub("SFO"),
-                           use_of_ff = "max", quiet = TRUE)
-
-m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")),
-                           M1 = mkinsub("SFO"),
-                           M2 = mkinsub("SFO"),
-                           use_of_ff = "max", quiet = TRUE)
-
-SFO_lin_a <- synthetic_data_for_UBA_2014[[1]]$data
-
-DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data
-
-t6 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a)))[["elapsed"]]
-t7 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c)))[["elapsed"]]
-
-t8 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a),
-    error_model = "tc"))[["elapsed"]]
-t9 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c),
-    error_model = "tc"))[["elapsed"]]
-
-t10 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a),
-    error_model = "obs"))[["elapsed"]]
-t11 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c),
-    error_model = "obs"))[["elapsed"]]
+m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"), + M1 = mkinsub("SFO", "M2"), + M2 = mkinsub("SFO"), + use_of_ff = "max", quiet = TRUE) + +m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), + M1 = mkinsub("SFO"), + M2 = mkinsub("SFO"), + use_of_ff = "max", quiet = TRUE) + +SFO_lin_a <- synthetic_data_for_UBA_2014[[1]]$data + +DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data + +t6 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a)))[["elapsed"]] +t7 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c)))[["elapsed"]] + +t8 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a), + error_model = "tc"))[["elapsed"]] +t9 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c), + error_model = "tc"))[["elapsed"]] + +t10 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a), + error_model = "obs"))[["elapsed"]] +t11 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c), + error_model = "obs"))[["elapsed"]]
-mkin_benchmarks[system_string, paste0("t", 1:11)] <-
-  c(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11)
-save(mkin_benchmarks, file = "~/git/mkin/vignettes/web_only/mkin_benchmarks.rda")
+mkin_benchmarks[system_string, paste0("t", 1:11)] <- + c(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) +save(mkin_benchmarks, file = benchmark_path) +# Hide rownames from kable for results section +rownames(mkin_benchmarks) <- NULL

Results

-

Benchmarks for all available error models are shown.

+

Benchmarks for all available error models are shown. They are intended for improving mkin, not for comparing CPUs or operating systems. All trademarks belong to their respective owners.

Parent only

Constant variance (t1) and two-component error model (t2) for four models fitted to two datasets, i.e. eight fits for each test.

- ----- +
- + + + + - + + + + - + + + + - + + + + - + + + + - + + + + - + + + + - + + + + - + + + + - + + + + - + + + + - - - + + + + + + - + + + + + + + + + + + + + + + + + + + +
OSCPURmkin t1 t2
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.48.1LinuxRyzen 7 1700NA0.9.48.1 3.610 11.019
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1LinuxRyzen 7 1700NA0.9.49.1 8.184 22.889
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2LinuxRyzen 7 1700NA0.9.49.2 7.064 12.558
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3LinuxRyzen 7 1700NA0.9.49.3 7.296 21.239
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4LinuxRyzen 7 1700NA0.9.49.4 5.936 20.545
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.50.2LinuxRyzen 7 1700NA0.9.50.2 1.714 3.971
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.50.3LinuxRyzen 7 1700NA0.9.50.3 1.752 4.156
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.50.4LinuxRyzen 7 1700NA0.9.50.4 1.786 3.729
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 1.0.3LinuxRyzen 7 1700NA1.0.3 1.881 3.504
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 1.0.4LinuxRyzen 7 1700NA1.0.4 1.867 3.450
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 1.1.01.9383.517LinuxRyzen 7 1700NA1.1.01.7913.466
Linux, Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz, mkin version 1.1.0Linuxi7-4710MQNA1.1.0 1.621 3.123
LinuxRyzen 7 17004.1.31.1.01.7913.289
LinuxRyzen 7 17004.2.11.1.01.8603.526
@@ -264,91 +317,142 @@

Constant variance (t3), two-component error model (t4), and variance by variable (t5) for three models fitted to one dataset, i.e. three fits for each test.

------ - + + + + - + + + + - + + + + - + + + + - + + + + - + + + + - + + + + - + + + + - + + + + - + + + + - + + + + - - - - + + + + + + + - + + + + + + + + + + + + + + + + + + + + + +
OSCPURmkin t3 t4 t5
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.48.1LinuxRyzen 7 1700NA0.9.48.1 3.764 14.347 9.495
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1LinuxRyzen 7 1700NA0.9.49.1 4.649 13.789 6.395
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2LinuxRyzen 7 1700NA0.9.49.2 4.786 8.461 5.675
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3LinuxRyzen 7 1700NA0.9.49.3 4.510 13.805 7.386
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4LinuxRyzen 7 1700NA0.9.49.4 4.446 15.335 6.002
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.50.2LinuxRyzen 7 1700NA0.9.50.2 1.402 6.174 2.764
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.50.3LinuxRyzen 7 1700NA0.9.50.3 1.430 6.615 2.878
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.50.4LinuxRyzen 7 1700NA0.9.50.4 1.397 7.251 2.810
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 1.0.3LinuxRyzen 7 1700NA1.0.3 1.430 6.344 2.798
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 1.0.4LinuxRyzen 7 1700NA1.0.4 1.415 6.364 2.820
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 1.1.01.4706.5082.894LinuxRyzen 7 1700NA1.1.03.90121.5748.564
Linux, Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz, mkin version 1.1.0Linuxi7-4710MQNA1.1.0 3.319 18.209 7.773
LinuxRyzen 7 17004.1.31.1.01.3106.2792.681
LinuxRyzen 7 17004.2.11.1.04.23723.8829.508
@@ -357,17 +461,11 @@

Constant variance (t6 and t7), two-component error model (t8 and t9), and variance by variable (t10 and t11) for one model fitted to one dataset, i.e. one fit for each test.

--------- - + + + + @@ -377,7 +475,10 @@ - + + + + @@ -386,7 +487,10 @@ - + + + + @@ -395,7 +499,10 @@ - + + + + @@ -404,7 +511,10 @@ - + + + + @@ -413,7 +523,10 @@ - + + + + @@ -422,7 +535,10 @@ - + + + + @@ -431,7 +547,10 @@ - + + + + @@ -440,7 +559,10 @@ - + + + + @@ -449,7 +571,10 @@ - + + + + @@ -458,7 +583,10 @@ - + + + + @@ -467,16 +595,22 @@ - - - - - - - + + + + + + + + + + - + + + + @@ -484,6 +618,30 @@ + + + + + + + + + + + + + + + + + + + + + + + +
OSCPURmkin t6 t7 t8
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.48.1LinuxRyzen 7 1700NA0.9.48.1 2.623 4.587 7.52531.267
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1LinuxRyzen 7 1700NA0.9.49.1 2.542 4.128 4.6325.636
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2LinuxRyzen 7 1700NA0.9.49.2 2.723 4.478 4.8625.574
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3LinuxRyzen 7 1700NA0.9.49.3 2.643 4.374 7.0207.365
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4LinuxRyzen 7 1700NA0.9.49.4 2.635 4.259 4.7375.626
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.50.2LinuxRyzen 7 1700NA0.9.50.2 0.777 1.236 1.3322.987
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.50.3LinuxRyzen 7 1700NA0.9.50.3 0.858 1.264 1.3333.073
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.50.4LinuxRyzen 7 1700NA0.9.50.4 0.783 1.282 1.4863.105
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 1.0.3LinuxRyzen 7 1700NA1.0.3 0.763 1.244 1.4572.839
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 1.0.4LinuxRyzen 7 1700NA1.0.4 0.785 1.252 1.4662.826
Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 1.1.00.8101.2641.5033.0961.9842.847LinuxRyzen 7 1700NA1.1.03.0884.3245.11410.9886.8009.860
Linux, Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz, mkin version 1.1.0Linuxi7-4710MQNA1.1.0 2.348 3.579 4.2545.981 8.368
LinuxRyzen 7 17004.1.31.1.00.7441.2271.2883.5531.8952.738
LinuxRyzen 7 17004.2.11.1.03.3504.7355.50711.8607.17910.934
@@ -507,7 +665,7 @@

-

Site built with pkgdown 2.0.3.

+

Site built with pkgdown 2.0.5.

diff --git a/docs/authors.html b/docs/authors.html index 70b1ce8a..998e6d54 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -130,7 +130,7 @@ R package version 1.1.0, https://pkgdown
-

Site built with pkgdown 2.0.3.

+

Site built with pkgdown 2.0.5.

diff --git a/docs/index.html b/docs/index.html index 0204d944..47775538 100644 --- a/docs/index.html +++ b/docs/index.html @@ -122,7 +122,7 @@

You can install the latest released version from CRAN from within R:

+install.packages("mkin")

Background @@ -263,14 +263,7 @@

-
-

Dev status

-
    -
  • -
  • Build Status
  • -
  • codecov
  • -
-
+ @@ -283,7 +276,7 @@

-

Site built with pkgdown 2.0.3.

+

Site built with pkgdown 2.0.5.

diff --git a/docs/news/index.html b/docs/news/index.html index 3c90ccad..b8202e95 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -593,7 +593,7 @@
-

Site built with pkgdown 2.0.3.

+

Site built with pkgdown 2.0.5.

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 9912aeb2..53faba85 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,5 +1,5 @@ pandoc: 2.9.2.1 -pkgdown: 2.0.3 +pkgdown: 2.0.5 pkgdown_sha: ~ articles: FOCUS_D: FOCUS_D.html @@ -11,7 +11,7 @@ articles: benchmarks: web_only/benchmarks.html compiled_models: web_only/compiled_models.html dimethenamid_2018: web_only/dimethenamid_2018.html -last_built: 2022-06-30T07:49Z +last_built: 2022-07-01T06:51Z urls: reference: https://pkgdown.jrwb.de/mkin/reference article: https://pkgdown.jrwb.de/mkin/articles diff --git a/docs/reference/index.html b/docs/reference/index.html index 4d657918..876207da 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -429,7 +429,7 @@ kinetic models fitted with mkinfit

-

Site built with pkgdown 2.0.3.

+

Site built with pkgdown 2.0.5.

diff --git a/docs/reference/mkinds.html b/docs/reference/mkinds.html index bef3be93..f43cfed4 100644 --- a/docs/reference/mkinds.html +++ b/docs/reference/mkinds.html @@ -93,18 +93,23 @@ provided by this package come as mkinds objects nevertheless.

-
# S3 method for mkinds
-print(x, data = FALSE, ...)
+
# S3 method for mkinds
+print(x, data = FALSE, ...)

Arguments

x

An mkinds object.

+ +
data

Should the data be printed?

+ +
...

Not used.

+

Public fields

@@ -151,7 +156,7 @@ and value in order to be compatible with mkinfit

Method new()

Create a new mkinds object

Usage

-

mkinds$new(title = "", data, time_unit = NA, unit = NA)

+

mkinds$new(title = "", data, time_unit = NA, unit = NA)

@@ -179,7 +184,7 @@ and value in order to be compatible with mkinfit

Method clone()

The objects of this class are cloneable with this method.

Usage

-

mkinds$clone(deep = FALSE)

+

mkinds$clone(deep = FALSE)

@@ -197,15 +202,15 @@ and value in order to be compatible with mkinfit

Examples

-

-mds <- mkinds$new("FOCUS A", FOCUS_2006_A)
-print(mds)
+    

+mds <- mkinds$new("FOCUS A", FOCUS_2006_A)
+print(mds)
 #> <mkinds> with $title:  FOCUS A 
 #> Observed compounds $observed:  parent 
 #> Sampling times $sampling_times:
 #> 0, 3, 7, 14, 30, 62, 90, 118 
 #> With a maximum of  1  replicates
-
+
 
@@ -220,7 +225,7 @@ and value in order to be compatible with mkinfit

-

Site built with pkgdown 2.0.3.

+

Site built with pkgdown 2.0.5.

diff --git a/docs/reference/mkindsg.html b/docs/reference/mkindsg.html index ceee4f37..37ec29bd 100644 --- a/docs/reference/mkindsg.html +++ b/docs/reference/mkindsg.html @@ -93,20 +93,27 @@ dataset if no data are supplied.

-
# S3 method for mkindsg
-print(x, data = FALSE, verbose = data, ...)
+
# S3 method for mkindsg
+print(x, data = FALSE, verbose = data, ...)

Arguments

x

An mkindsg object.

+ +
data

Should the mkinds objects be printed with their data?

+ +
verbose

Should the mkinds objects be printed?

+ +
...

Not used.

+

Public fields

@@ -148,7 +155,7 @@ or covariates like soil pH).

Method new()

Create a new mkindsg object

Usage

-

mkindsg$new(title = "", ds, f_time_norm = rep(1, length(ds)), meta)

+

mkindsg$new(title = "", ds, f_time_norm = rep(1, length(ds)), meta)

@@ -176,7 +183,7 @@ or covariates like soil pH).

Method clone()

The objects of this class are cloneable with this method.

Usage

-

mkindsg$clone(deep = FALSE)

+

mkindsg$clone(deep = FALSE)

@@ -194,15 +201,15 @@ or covariates like soil pH).

Examples

-

-mdsg <- mkindsg$new("Experimental X", experimental_data_for_UBA_2019[6:10])
-print(mdsg)
+    

+mdsg <- mkindsg$new("Experimental X", experimental_data_for_UBA_2019[6:10])
+print(mdsg)
 #> <mkindsg> holding 5 mkinds objects
 #> Title $title:  Experimental X 
 #> Occurrence of observed compounds $observed_n:
 #> parent     A1 
 #>      5      5 
-print(mdsg, verbose = TRUE)
+print(mdsg, verbose = TRUE)
 #> <mkindsg> holding 5 mkinds objects
 #> Title $title:  Experimental X 
 #> Occurrence of observed compounds $observed_n:
@@ -249,7 +256,7 @@ or covariates like soil pH).

#> With a maximum of 2 replicates #> Time unit: days #> Observation unit: \%AR -print(mdsg, verbose = TRUE, data = TRUE) +print(mdsg, verbose = TRUE, data = TRUE) #> <mkindsg> holding 5 mkinds objects #> Title $title: Experimental X #> Occurrence of observed compounds $observed_n: @@ -391,7 +398,7 @@ or covariates like soil pH).

#> 14 91 46.7 13.2 #> 15 120 42.1 14.3 #> 16 120 41.3 12.1 - +
@@ -406,7 +413,7 @@ or covariates like soil pH).

-

Site built with pkgdown 2.0.3.

+

Site built with pkgdown 2.0.5.

diff --git a/vignettes/FOCUS_L.rmd b/vignettes/FOCUS_L.rmd index 6871760c..2dafa74d 100644 --- a/vignettes/FOCUS_L.rmd +++ b/vignettes/FOCUS_L.rmd @@ -1,7 +1,7 @@ --- title: "Example evaluation of FOCUS Laboratory Data L1 to L3" author: "Johannes Ranke" -date: Last change 17 November 2016 (rebuilt `r Sys.Date()`) +date: Last change 18 May 2022 (rebuilt `r Sys.Date()`) output: html_document: toc: true diff --git a/vignettes/web_only/benchmarks.R b/vignettes/web_only/benchmarks.R new file mode 100644 index 00000000..c9ba5be3 --- /dev/null +++ b/vignettes/web_only/benchmarks.R @@ -0,0 +1,112 @@ +## ---- include = FALSE--------------------------------------------------------- +library(knitr) +opts_chunk$set(tidy = FALSE, cache = FALSE) +library("mkin") + +## ----include = FALSE---------------------------------------------------------- +cpu_model <- benchmarkme::get_cpu()$model_name +# Abbreviate CPU identifiers +cpu_model <- gsub("AMD ", "", cpu_model) +cpu_model <- gsub("Intel\\(R\\) Core\\(TM\\) ", "", cpu_model) +cpu_model <- gsub(" Eight-Core Processor", "", cpu_model) +cpu_model <- gsub(" CPU @ 2.50GHz", "", cpu_model) + +operating_system <- Sys.info()[["sysname"]] +mkin_version <- as.character(packageVersion("mkin")) +R_version <- paste0(R.version$major, ".", R.version$minor) +system_string <- paste0(operating_system, ", ", cpu_model, ", mkin ", mkin_version, ", R ", R_version) + +benchmark_path = normalizePath("~/git/mkin/vignettes/web_only/mkin_benchmarks.rda") +load(benchmark_path) + +# Used for reformatting the data on 2022-06-30 +# mkin_benchmarks[, "R"] <- NA +# mkin_benchmarks <- mkin_benchmarks[c(2, 1, 15, 3, 4:14)] +# mkin_benchmarks[, "CPU"] <- gsub("AMD.*", "Ryzen 7 1700", mkin_benchmarks[, "CPU"]) +# mkin_benchmarks[, "CPU"] <- gsub("Intel.*", "i7-4710MQ", mkin_benchmarks[, "CPU"]) +# rownames(mkin_benchmarks) <- gsub("AMD Ryzen 7 1700 Eight-Core Processor", "Ryzen 7 1700", rownames(mkin_benchmarks)) +# rownames(mkin_benchmarks) <- gsub("Intel\\(R\\) Core\\(TM\\) i7-4710MQ CPU @ 2.50GHz", "i7-4710MQ", rownames(mkin_benchmarks)) +# rownames(mkin_benchmarks) <- gsub(" version", "", rownames(mkin_benchmarks)) + +mkin_benchmarks[system_string, c("CPU", "OS", "mkin", "R")] <- + c(cpu_model, operating_system, mkin_version, R_version) + +if (mkin_version > "0.9.48.1") { + mmkin_bench <- function(models, datasets, error_model = "const") { + mmkin(models, datasets, error_model = error_model, cores = 1, quiet = TRUE) + } +} else { + mmkin_bench <- function(models, datasets, error_model = NULL) { + mmkin(models, datasets, reweight.method = error_model, cores = 1, quiet = TRUE) + } +} + +## ----parent_only, warning = FALSE--------------------------------------------- +FOCUS_C <- FOCUS_2006_C +FOCUS_D <- subset(FOCUS_2006_D, value != 0) +parent_datasets <- list(FOCUS_C, FOCUS_D) + +t1 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets))[["elapsed"]] +t2 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets, + error_model = "tc"))[["elapsed"]] + +## ----one_metabolite, message = FALSE------------------------------------------ +SFO_SFO <- mkinmod( + parent = mkinsub("SFO", "m1"), + m1 = mkinsub("SFO")) +FOMC_SFO <- mkinmod( + parent = mkinsub("FOMC", "m1"), + m1 = mkinsub("SFO")) +DFOP_SFO <- mkinmod( + parent = mkinsub("FOMC", "m1"), + m1 = mkinsub("SFO")) +t3 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D)))[["elapsed"]] +t4 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D), + error_model = "tc"))[["elapsed"]] +t5 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D), + error_model = "obs"))[["elapsed"]] + +## ----two_metabolites, message = FALSE----------------------------------------- +m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"), + M1 = mkinsub("SFO", "M2"), + M2 = mkinsub("SFO"), + use_of_ff = "max", quiet = TRUE) + +m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), + M1 = mkinsub("SFO"), + M2 = mkinsub("SFO"), + use_of_ff = "max", quiet = TRUE) + +SFO_lin_a <- synthetic_data_for_UBA_2014[[1]]$data + +DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data + +t6 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a)))[["elapsed"]] +t7 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c)))[["elapsed"]] + +t8 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a), + error_model = "tc"))[["elapsed"]] +t9 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c), + error_model = "tc"))[["elapsed"]] + +t10 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a), + error_model = "obs"))[["elapsed"]] +t11 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c), + error_model = "obs"))[["elapsed"]] + +## ----results------------------------------------------------------------------ +mkin_benchmarks[system_string, paste0("t", 1:11)] <- + c(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) +save(mkin_benchmarks, file = benchmark_path) +# Hide rownames from kable for results section +rownames(mkin_benchmarks) <- NULL + +## ---- echo = FALSE------------------------------------------------------------ +kable(mkin_benchmarks[, c(1:4, 5:6)]) + +## ---- echo = FALSE------------------------------------------------------------ +kable(mkin_benchmarks[, c(1:4, 7:9)]) + +## ---- echo = FALSE------------------------------------------------------------ +kable(mkin_benchmarks[, c(1:4, 10:15)]) + diff --git a/vignettes/web_only/benchmarks.html b/vignettes/web_only/benchmarks.html new file mode 100644 index 00000000..f6164796 --- /dev/null +++ b/vignettes/web_only/benchmarks.html @@ -0,0 +1,2190 @@ + + + + + + + + + + + + + + +Benchmark timings for mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+
+ +
+ + + + + + + +

Each system is characterized by the operating system type, the CPU type, the mkin version, and, as in June 2022 the current R version lead to worse performance, the R version. A compiler was available, so if no analytical solution was available, compiled ODE models are used.

+

Every fit is only performed once, so the accuracy of the benchmarks is limited.

+
+

Test cases

+

Parent only:

+
FOCUS_C <- FOCUS_2006_C
+FOCUS_D <- subset(FOCUS_2006_D, value != 0)
+parent_datasets <- list(FOCUS_C, FOCUS_D)
+
+t1 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets))[["elapsed"]]
+t2 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets,
+    error_model = "tc"))[["elapsed"]]
+

One metabolite:

+
SFO_SFO <- mkinmod(
+  parent = mkinsub("SFO", "m1"),
+  m1 = mkinsub("SFO"))
+FOMC_SFO <- mkinmod(
+  parent = mkinsub("FOMC", "m1"),
+  m1 = mkinsub("SFO"))
+DFOP_SFO <- mkinmod(
+  parent = mkinsub("FOMC", "m1"),
+  m1 = mkinsub("SFO"))
+t3 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D)))[["elapsed"]]
+t4 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D),
+    error_model = "tc"))[["elapsed"]]
+t5 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D),
+    error_model = "obs"))[["elapsed"]]
+

Two metabolites, synthetic data:

+
m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"),
+                           M1 = mkinsub("SFO", "M2"),
+                           M2 = mkinsub("SFO"),
+                           use_of_ff = "max", quiet = TRUE)
+
+m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")),
+                           M1 = mkinsub("SFO"),
+                           M2 = mkinsub("SFO"),
+                           use_of_ff = "max", quiet = TRUE)
+
+SFO_lin_a <- synthetic_data_for_UBA_2014[[1]]$data
+
+DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data
+
+t6 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a)))[["elapsed"]]
+t7 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c)))[["elapsed"]]
+
+t8 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a),
+    error_model = "tc"))[["elapsed"]]
+t9 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c),
+    error_model = "tc"))[["elapsed"]]
+
+t10 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a),
+    error_model = "obs"))[["elapsed"]]
+t11 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c),
+    error_model = "obs"))[["elapsed"]]
+
mkin_benchmarks[system_string, paste0("t", 1:11)] <-
+  c(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11)
+save(mkin_benchmarks, file = benchmark_path)
+# Hide rownames from kable for results section
+rownames(mkin_benchmarks) <- NULL
+
+
+

Results

+

Benchmarks for all available error models are shown. They are intended for improving mkin, not for comparing CPUs or operating systems. All trademarks belong to their respective owners.

+
+

Parent only

+

Constant variance (t1) and two-component error model (t2) for four models fitted to two datasets, i.e. eight fits for each test.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OSCPURmkint1t2
LinuxRyzen 7 1700NA0.9.48.13.61011.019
LinuxRyzen 7 1700NA0.9.49.18.18422.889
LinuxRyzen 7 1700NA0.9.49.27.06412.558
LinuxRyzen 7 1700NA0.9.49.37.29621.239
LinuxRyzen 7 1700NA0.9.49.45.93620.545
LinuxRyzen 7 1700NA0.9.50.21.7143.971
LinuxRyzen 7 1700NA0.9.50.31.7524.156
LinuxRyzen 7 1700NA0.9.50.41.7863.729
LinuxRyzen 7 1700NA1.0.31.8813.504
LinuxRyzen 7 1700NA1.0.41.8673.450
LinuxRyzen 7 1700NA1.1.01.7913.466
Linuxi7-4710MQNA1.1.01.6213.123
LinuxRyzen 7 17004.1.31.1.01.7913.289
+
+
+

One metabolite

+

Constant variance (t3), two-component error model (t4), and variance by variable (t5) for three models fitted to one dataset, i.e. three fits for each test.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OSCPURmkint3t4t5
LinuxRyzen 7 1700NA0.9.48.13.76414.3479.495
LinuxRyzen 7 1700NA0.9.49.14.64913.7896.395
LinuxRyzen 7 1700NA0.9.49.24.7868.4615.675
LinuxRyzen 7 1700NA0.9.49.34.51013.8057.386
LinuxRyzen 7 1700NA0.9.49.44.44615.3356.002
LinuxRyzen 7 1700NA0.9.50.21.4026.1742.764
LinuxRyzen 7 1700NA0.9.50.31.4306.6152.878
LinuxRyzen 7 1700NA0.9.50.41.3977.2512.810
LinuxRyzen 7 1700NA1.0.31.4306.3442.798
LinuxRyzen 7 1700NA1.0.41.4156.3642.820
LinuxRyzen 7 1700NA1.1.03.90121.5748.564
Linuxi7-4710MQNA1.1.03.31918.2097.773
LinuxRyzen 7 17004.1.31.1.01.3106.2792.681
+
+
+

Two metabolites

+

Constant variance (t6 and t7), two-component error model (t8 and t9), and variance by variable (t10 and t11) for one model fitted to one dataset, i.e. one fit for each test.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OSCPURmkint6t7t8t9t10t11
LinuxRyzen 7 1700NA0.9.48.12.6234.5877.52516.6218.57631.267
LinuxRyzen 7 1700NA0.9.49.12.5424.1284.6328.1713.6765.636
LinuxRyzen 7 1700NA0.9.49.22.7234.4784.8627.6183.5795.574
LinuxRyzen 7 1700NA0.9.49.32.6434.3747.02011.1245.3887.365
LinuxRyzen 7 1700NA0.9.49.42.6354.2594.7377.7633.4275.626
LinuxRyzen 7 1700NA0.9.50.20.7771.2361.3322.8722.0692.987
LinuxRyzen 7 1700NA0.9.50.30.8581.2641.3332.9842.1133.073
LinuxRyzen 7 1700NA0.9.50.40.7831.2821.4863.8151.9583.105
LinuxRyzen 7 1700NA1.0.30.7631.2441.4573.0541.9232.839
LinuxRyzen 7 1700NA1.0.40.7851.2521.4663.0911.9362.826
LinuxRyzen 7 1700NA1.1.03.0884.3245.11410.9886.8009.860
Linuxi7-4710MQNA1.1.02.3483.5794.25411.3155.9818.368
LinuxRyzen 7 17004.1.31.1.00.7441.2271.2883.5531.8952.738
+
+
+ + + +
+
+ +
+ + + + + + + + + + + + + + + + + diff --git a/vignettes/web_only/benchmarks.rmd b/vignettes/web_only/benchmarks.rmd index 9697f96b..9ac87631 100644 --- a/vignettes/web_only/benchmarks.rmd +++ b/vignettes/web_only/benchmarks.rmd @@ -1,7 +1,7 @@ --- title: "Benchmark timings for mkin" author: "Johannes Ranke" -date: Last change 13 May 2020 (rebuilt `r Sys.Date()`) +date: Last change 30 June 2022 (rebuilt `r Sys.Date()`) output: html_document: toc: true @@ -19,19 +19,40 @@ opts_chunk$set(tidy = FALSE, cache = FALSE) library("mkin") ``` -Each system is characterized by its CPU type, the operating system type and the -mkin version. Currently only values for one system are available. A compiler -was available, so if no analytical solution was available, compiled ODE models are -used. +Each system is characterized by the operating system type, the CPU type, the +mkin version, and, as in June 2022 the current R version lead to worse +performance, the R version. A compiler was available, so if no analytical +solution was available, compiled ODE models are used. + +Every fit is only performed once, so the accuracy of the benchmarks is limited. ```{r include = FALSE} cpu_model <- benchmarkme::get_cpu()$model_name +# Abbreviate CPU identifiers +cpu_model <- gsub("AMD ", "", cpu_model) +cpu_model <- gsub("Intel\\(R\\) Core\\(TM\\) ", "", cpu_model) +cpu_model <- gsub(" Eight-Core Processor", "", cpu_model) +cpu_model <- gsub(" CPU @ 2.50GHz", "", cpu_model) + operating_system <- Sys.info()[["sysname"]] mkin_version <- as.character(packageVersion("mkin")) -system_string <- paste0(operating_system, ", ", cpu_model, ", mkin version ", mkin_version) -load("~/git/mkin/vignettes/web_only/mkin_benchmarks.rda") -mkin_benchmarks[system_string, c("CPU", "OS", "mkin")] <- - c(cpu_model, operating_system, mkin_version) +R_version <- paste0(R.version$major, ".", R.version$minor) +system_string <- paste0(operating_system, ", ", cpu_model, ", mkin ", mkin_version, ", R ", R_version) + +benchmark_path = normalizePath("~/git/mkin/vignettes/web_only/mkin_benchmarks.rda") +load(benchmark_path) + +# Used for reformatting the data on 2022-06-30 +# mkin_benchmarks[, "R"] <- NA +# mkin_benchmarks <- mkin_benchmarks[c(2, 1, 15, 3, 4:14)] +# mkin_benchmarks[, "CPU"] <- gsub("AMD.*", "Ryzen 7 1700", mkin_benchmarks[, "CPU"]) +# mkin_benchmarks[, "CPU"] <- gsub("Intel.*", "i7-4710MQ", mkin_benchmarks[, "CPU"]) +# rownames(mkin_benchmarks) <- gsub("AMD Ryzen 7 1700 Eight-Core Processor", "Ryzen 7 1700", rownames(mkin_benchmarks)) +# rownames(mkin_benchmarks) <- gsub("Intel\\(R\\) Core\\(TM\\) i7-4710MQ CPU @ 2.50GHz", "i7-4710MQ", rownames(mkin_benchmarks)) +# rownames(mkin_benchmarks) <- gsub(" version", "", rownames(mkin_benchmarks)) + +mkin_benchmarks[system_string, c("CPU", "OS", "mkin", "R")] <- + c(cpu_model, operating_system, mkin_version, R_version) if (mkin_version > "0.9.48.1") { mmkin_bench <- function(models, datasets, error_model = "const") { @@ -111,12 +132,16 @@ t11 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c), ```{r results} mkin_benchmarks[system_string, paste0("t", 1:11)] <- c(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) -save(mkin_benchmarks, file = "~/git/mkin/vignettes/web_only/mkin_benchmarks.rda") +save(mkin_benchmarks, file = benchmark_path) +# Hide rownames from kable for results section +rownames(mkin_benchmarks) <- NULL ``` ## Results -Benchmarks for all available error models are shown. +Benchmarks for all available error models are shown. They are intended for +improving mkin, not for comparing CPUs or operating systems. All trademarks +belong to their respective owners. ### Parent only @@ -124,7 +149,7 @@ Constant variance (t1) and two-component error model (t2) for four models fitted to two datasets, i.e. eight fits for each test. ```{r, echo = FALSE} -kable(mkin_benchmarks[, 4:5]) +kable(mkin_benchmarks[, c(1:4, 5:6)]) ``` ### One metabolite @@ -133,7 +158,7 @@ Constant variance (t3), two-component error model (t4), and variance by variable for three models fitted to one dataset, i.e. three fits for each test. ```{r, echo = FALSE} -kable(mkin_benchmarks[, 6:8]) +kable(mkin_benchmarks[, c(1:4, 7:9)]) ``` ### Two metabolites @@ -143,5 +168,5 @@ variance by variable (t10 and t11) for one model fitted to one dataset, i.e. one fit for each test. ```{r, echo = FALSE} -kable(mkin_benchmarks[, 9:14]) +kable(mkin_benchmarks[, c(1:4, 10:15)]) ``` diff --git a/vignettes/web_only/mkin_benchmarks.rda b/vignettes/web_only/mkin_benchmarks.rda index 93adfb61..73f59b1a 100644 Binary files a/vignettes/web_only/mkin_benchmarks.rda and b/vignettes/web_only/mkin_benchmarks.rda differ -- cgit v1.2.1