From 6ddb7575f37d9d534f014cbd105b2f07660d59c6 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 2 May 2019 18:54:22 +0200 Subject: Remove reference to archived kinfit package from vignettes/mkin.Rmd Static documentation rebuilt by pkgdown --- vignettes/FOCUS_D.html | 135 ++-- vignettes/FOCUS_L.html | 351 +++++----- vignettes/mkin.Rmd | 25 +- vignettes/mkin.html | 1447 ++++++++++++++++++++++++++++++++++++++++- vignettes/mkin_benchmarks.rda | Bin 801 -> 801 bytes vignettes/references.bib | 8 - 6 files changed, 1676 insertions(+), 290 deletions(-) (limited to 'vignettes') diff --git a/vignettes/FOCUS_D.html b/vignettes/FOCUS_D.html index cb512e99..7a12d221 100644 --- a/vignettes/FOCUS_D.html +++ b/vignettes/FOCUS_D.html @@ -11,7 +11,7 @@ - + Example evaluation of FOCUS Example Dataset D @@ -256,9 +256,7 @@ h6 { - - - - + + + + + + + +
+ +
@@ -1543,8 +1549,8 @@ div.tocify {

Example evaluation of FOCUS Laboratory Data L1 to L3

-

Johannes Ranke

-

2019-04-04

+

Johannes Ranke

+

2019-05-02

@@ -1563,32 +1569,32 @@ 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 used for fitting:    0.9.49.1 
-## R version used for fitting:       3.5.3 
-## Date of fit:     Thu Apr  4 17:00:02 2019 
-## Date of summary: Thu Apr  4 17:00:02 2019 
+
## mkin version used for fitting:    0.9.49.4 
+## R version used for fitting:       3.6.0 
+## Date of fit:     Thu May  2 18:43:50 2019 
+## Date of summary: Thu May  2 18:43:50 2019 
 ## 
 ## Equations:
 ## d_parent/dt = - k_parent_sink * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method using 98 model solutions performed in 0.237 s
+## Fitted using 133 model solutions performed in 0.283 s
 ## 
 ## Error model:
-## NULL
+## Constant variance 
 ## 
 ## Starting values for parameters to be optimised:
-##               value   type
-## parent_0      89.85  state
-## k_parent_sink  0.10 deparm
-## sigma          1.00  error
+##                   value   type
+## parent_0      89.850000  state
+## k_parent_sink  0.100000 deparm
+## sigma          2.779827  error
 ## 
 ## Starting values for the transformed parameters actually optimised:
 ##                       value lower upper
 ## parent_0          89.850000  -Inf   Inf
 ## log_k_parent_sink -2.302585  -Inf   Inf
-## sigma              1.000000     0   Inf
+## sigma              2.779827     0   Inf
 ## 
 ## Fixed parameter values:
 ## None
@@ -1601,9 +1607,9 @@ summary(m.L1.SFO)
## ## Parameter correlation: ## parent_0 log_k_parent_sink sigma -## parent_0 1.000e+00 6.186e-01 -3.757e-07 -## log_k_parent_sink 6.186e-01 1.000e+00 -5.541e-07 -## sigma -3.757e-07 -5.541e-07 1.000e+00 +## parent_0 1.000e+00 6.186e-01 -1.712e-09 +## log_k_parent_sink 6.186e-01 1.000e+00 -3.237e-09 +## sigma -1.712e-09 -3.237e-09 1.000e+00 ## ## Backtransformed parameters: ## Confidence intervals for internally transformed parameters are asymmetric. @@ -1614,9 +1620,9 @@ summary(m.L1.SFO)
## k_parent_sink 0.09561 26.57 2.487e-14 0.08824 0.1036 ## sigma 2.78000 6.00 1.216e-05 1.79200 3.7670 ## -## Chi2 error levels in percent: +## FOCUS Chi2 error levels in percent: ## err.min n.optim df -## All data 3.619 3 6 +## All data 3.424 2 7 ## parent 3.424 2 7 ## ## Resulting formation fractions: @@ -1641,8 +1647,8 @@ summary(m.L1.SFO) ## 5 parent 59.4 57.330 2.0699 ## 7 parent 47.0 47.352 -0.3515 ## 7 parent 45.1 47.352 -2.2515 -## 14 parent 27.7 24.247 3.4527 -## 14 parent 27.3 24.247 3.0527 +## 14 parent 27.7 24.247 3.4528 +## 14 parent 27.3 24.247 3.0528 ## 21 parent 10.0 12.416 -2.4163 ## 21 parent 10.4 12.416 -2.0163 ## 30 parent 2.9 5.251 -2.3513 @@ -1652,80 +1658,87 @@ summary(m.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)
-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)
## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
## Warning in cov2cor(ans$cov.unscaled): diag(.) had 0 or NA entries; non-
 ## finite result is doubtful
-
## mkin version used for fitting:    0.9.49.1 
-## R version used for fitting:       3.5.3 
-## Date of fit:     Thu Apr  4 17:00:04 2019 
-## Date of summary: Thu Apr  4 17:00:04 2019 
+
## mkin version used for fitting:    0.9.49.4 
+## R version used for fitting:       3.6.0 
+## Date of fit:     Thu May  2 18:43:51 2019 
+## Date of summary: Thu May  2 18:43:51 2019 
+## 
+## 
+## Warning: Optimisation did not converge:
+## false convergence (8) 
+## 
 ## 
 ## Equations:
 ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method using 414 model solutions performed in 0.966 s
+## Fitted using 599 model solutions performed in 1.239 s
 ## 
 ## Error model:
-## NULL
+## Constant variance 
 ## 
 ## Starting values for parameters to be optimised:
-##          value   type
-## parent_0 89.85  state
-## alpha     1.00 deparm
-## beta     10.00 deparm
-## sigma     1.00  error
+##              value   type
+## parent_0 89.850000  state
+## alpha     1.000000 deparm
+## beta     10.000000 deparm
+## sigma     2.779868  error
 ## 
 ## Starting values for the transformed parameters actually optimised:
 ##               value lower upper
 ## parent_0  89.850000  -Inf   Inf
 ## log_alpha  0.000000  -Inf   Inf
 ## log_beta   2.302585  -Inf   Inf
-## sigma      1.000000     0   Inf
+## sigma      2.779868     0   Inf
 ## 
 ## Fixed parameter values:
 ## None
 ## 
 ## Optimised, transformed parameters with symmetric confidence intervals:
-##           Estimate Std. Error  Lower Upper
-## parent_0     92.47     1.2820 89.720 95.22
-## log_alpha    12.01        NaN    NaN   NaN
-## log_beta     14.36        NaN    NaN   NaN
-## sigma         2.78     0.4618  1.789  3.77
+##           Estimate Std. Error  Lower  Upper
+## parent_0     92.47     1.2810 89.720 95.220
+## log_alpha    10.66        NaN    NaN    NaN
+## log_beta     13.01        NaN    NaN    NaN
+## sigma         2.78     0.4599  1.794  3.766
 ## 
 ## Parameter correlation:
-##            parent_0 log_alpha log_beta     sigma
-## parent_0  1.0000000       NaN      NaN 0.0004281
-## log_alpha       NaN         1      NaN       NaN
-## log_beta        NaN       NaN        1       NaN
-## sigma     0.0004281       NaN      NaN 1.0000000
+##           parent_0 log_alpha log_beta    sigma
+## parent_0  1.000000       NaN      NaN 0.003475
+## log_alpha      NaN         1      NaN      NaN
+## log_beta       NaN       NaN        1      NaN
+## sigma     0.003475       NaN      NaN 1.000000
 ## 
 ## 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 9.247e+01      NA     NA 89.720 95.22
-## alpha    1.649e+05      NA     NA     NA    NA
-## beta     1.725e+06      NA     NA     NA    NA
-## sigma    2.780e+00      NA     NA  1.789  3.77
+##           Estimate  t value    Pr(>t)  Lower  Upper
+## parent_0     92.47 72.13000 1.052e-19 89.720 95.220
+## alpha     42700.00  0.02298 4.910e-01     NA     NA
+## beta     446600.00  0.02298 4.910e-01     NA     NA
+## sigma         2.78  6.00000 1.628e-05  1.794  3.766
 ## 
-## Chi2 error levels in percent:
+## FOCUS Chi2 error levels in percent:
 ##          err.min n.optim df
-## All data   3.860       4  5
+## All data   3.619       3  6
 ## parent     3.619       3  6
 ## 
 ## Estimated disappearance times:
 ##         DT50  DT90 DT50back
-## parent 7.249 24.08    7.249
+## parent 7.249 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 2014).

@@ -1745,7 +1758,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.

@@ -1756,36 +1769,36 @@ 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 used for fitting:    0.9.49.1 
-## R version used for fitting:       3.5.3 
-## Date of fit:     Thu Apr  4 17:00:05 2019 
-## Date of summary: Thu Apr  4 17:00:05 2019 
+
## mkin version used for fitting:    0.9.49.4 
+## R version used for fitting:       3.6.0 
+## Date of fit:     Thu May  2 18:43:52 2019 
+## Date of summary: Thu May  2 18:43:52 2019 
 ## 
 ## Equations:
 ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method using 107 model solutions performed in 0.249 s
+## Fitted using 240 model solutions performed in 0.483 s
 ## 
 ## Error model:
-## NULL
+## Constant variance 
 ## 
 ## Starting values for parameters to be optimised:
-##          value   type
-## parent_0 93.95  state
-## alpha     1.00 deparm
-## beta     10.00 deparm
-## sigma     1.00  error
+##              value   type
+## parent_0 93.950000  state
+## alpha     1.000000 deparm
+## beta     10.000000 deparm
+## sigma     2.275722  error
 ## 
 ## Starting values for the transformed parameters actually optimised:
 ##               value lower upper
 ## parent_0  93.950000  -Inf   Inf
 ## log_alpha  0.000000  -Inf   Inf
 ## log_beta   2.302585  -Inf   Inf
-## sigma      1.000000     0   Inf
+## sigma      2.275722     0   Inf
 ## 
 ## Fixed parameter values:
 ## None
@@ -1799,10 +1812,10 @@ plot(m.L2.FOMC, show_residuals = TRUE,
 ## 
 ## Parameter correlation:
 ##             parent_0  log_alpha   log_beta      sigma
-## parent_0   1.000e+00 -0.1150844 -2.085e-01  3.562e-06
-## log_alpha -1.151e-01  1.0000000  9.741e-01 -5.400e-06
-## log_beta  -2.085e-01  0.9741278  1.000e+00 -5.088e-06
-## sigma      3.562e-06 -0.0000054 -5.088e-06  1.000e+00
+## parent_0   1.000e+00 -1.151e-01 -2.085e-01  1.606e-08
+## log_alpha -1.151e-01  1.000e+00  9.741e-01 -1.168e-07
+## log_beta  -2.085e-01  9.741e-01  1.000e+00 -1.029e-07
+## sigma      1.606e-08 -1.168e-07 -1.029e-07  1.000e+00
 ## 
 ## Backtransformed parameters:
 ## Confidence intervals for internally transformed parameters are asymmetric.
@@ -1814,9 +1827,9 @@ plot(m.L2.FOMC, show_residuals = TRUE,
 ## beta        1.234   4.012 1.942e-03  0.6945  2.192
 ## sigma       2.276   4.899 5.977e-04  1.2050  3.347
 ## 
-## Chi2 error levels in percent:
+## FOCUS Chi2 error levels in percent:
 ##          err.min n.optim df
-## All data   7.086       4  2
+## All data   6.205       3  3
 ## parent     6.205       3  3
 ## 
 ## Estimated disappearance times:
@@ -1830,12 +1843,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 used for fitting:    0.9.49.1 
-## R version used for fitting:       3.5.3 
-## Date of fit:     Thu Apr  4 17:00:07 2019 
-## Date of summary: Thu Apr  4 17:00:07 2019 
+
## mkin version used for fitting:    0.9.49.4 
+## R version used for fitting:       3.6.0 
+## Date of fit:     Thu May  2 18:43:54 2019 
+## Date of summary: Thu May  2 18:43:54 2019 
 ## 
 ## Equations:
 ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) *
@@ -1844,18 +1857,18 @@ plot(m.L2.DFOP, show_residuals = TRUE, show_errmin = TRUE,
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method using 489 model solutions performed in 1.185 s
+## Fitted using 587 model solutions performed in 1.211 s
 ## 
 ## Error model:
-## NULL
+## Constant variance 
 ## 
 ## Starting values for parameters to be optimised:
-##          value   type
-## parent_0 93.95  state
-## k1        0.10 deparm
-## k2        0.01 deparm
-## g         0.50 deparm
-## sigma     1.00  error
+##              value   type
+## parent_0 93.950000  state
+## k1        0.100000 deparm
+## k2        0.010000 deparm
+## g         0.500000 deparm
+## sigma     1.413899  error
 ## 
 ## Starting values for the transformed parameters actually optimised:
 ##              value lower upper
@@ -1863,46 +1876,46 @@ plot(m.L2.DFOP, show_residuals = TRUE, show_errmin = TRUE,
 ## log_k1   -2.302585  -Inf   Inf
 ## log_k2   -4.605170  -Inf   Inf
 ## g_ilr     0.000000  -Inf   Inf
-## sigma     1.000000     0   Inf
+## sigma     1.413899     0   Inf
 ## 
 ## Fixed parameter values:
 ## None
 ## 
 ## Optimised, transformed parameters with symmetric confidence intervals:
 ##          Estimate Std. Error      Lower     Upper
-## parent_0  93.9500    0.99980    91.5900   96.3100
-## log_k1     3.0480  972.30000 -2296.0000 2302.0000
-## log_k2    -1.0880    0.06285    -1.2370   -0.9394
-## g_ilr     -0.2821    0.07033    -0.4484   -0.1158
-## sigma      1.4140    0.28860     0.7314    2.0960
+## parent_0  93.9500  9.998e-01    91.5900   96.3100
+## log_k1     3.1330  2.265e+03 -5354.0000 5360.0000
+## log_k2    -1.0880  6.285e-02    -1.2370   -0.9394
+## g_ilr     -0.2821  7.033e-02    -0.4484   -0.1158
+## sigma      1.4140  2.886e-01     0.7314    2.0960
 ## 
 ## Parameter correlation:
 ##            parent_0     log_k1     log_k2      g_ilr      sigma
-## parent_0  1.000e+00  1.367e-06 -4.360e-10  2.665e-01 -1.520e-08
-## log_k1    1.367e-06  1.000e+00  2.264e-04 -4.454e-04 -2.092e-05
-## log_k2   -4.360e-10  2.264e-04  1.000e+00 -7.903e-01 -4.817e-10
-## g_ilr     2.665e-01 -4.454e-04 -7.903e-01  1.000e+00 -2.532e-09
-## sigma    -1.520e-08 -2.092e-05 -4.817e-10 -2.532e-09  1.000e+00
+## parent_0  1.000e+00  5.434e-07 -9.989e-11  2.665e-01 -3.978e-10
+## log_k1    5.434e-07  1.000e+00  8.888e-05 -1.748e-04 -8.207e-06
+## log_k2   -9.989e-11  8.888e-05  1.000e+00 -7.903e-01  5.751e-10
+## g_ilr     2.665e-01 -1.748e-04 -7.903e-01  1.000e+00 -7.109e-10
+## sigma    -3.978e-10 -8.207e-06  5.751e-10 -7.109e-10  1.000e+00
 ## 
 ## 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  93.9500 93.970000 2.036e-12 91.5900 96.3100
-## k1        21.0700  0.001054 4.996e-01  0.0000     Inf
-## k2         0.3369 15.910000 4.697e-07  0.2904  0.3909
-## g          0.4016 16.800000 3.238e-07  0.3466  0.4591
-## sigma      1.4140  4.899000 8.776e-04  0.7314  2.0960
+## parent_0  93.9500 9.397e+01 2.036e-12 91.5900 96.3100
+## k1        22.9300 4.514e-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
 ## 
-## Chi2 error levels in percent:
+## FOCUS Chi2 error levels in percent:
 ##          err.min n.optim df
-## All data    3.16       5  1
+## All data    2.53       4  2
 ## parent      2.53       4  2
 ## 
 ## Estimated disappearance times:
 ##          DT50  DT90 DT50_k1 DT50_k2
-## parent 0.5335 5.311  0.0329   2.058
+## parent 0.5335 5.311 0.03023 2.058

Here, the DFOP model is clearly the best-fit model for dataset L2 based on the chi^2 error level criterion. However, the failure to calculate the covariance matrix indicates that the parameter estimates correlate excessively. Therefore, the FOMC model may be preferred for this dataset.

@@ -1920,7 +1933,7 @@ FOCUS_2006_L3_mkin <- mkin_wide_to_long(FOCUS_2006_L3) mm.L3 <- mmkin(c("SFO", "FOMC", "DFOP"), cores = 1, list("FOCUS L3" = FOCUS_2006_L3_mkin), quiet = TRUE) plot(mm.L3) -

+

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

@@ -1928,10 +1941,10 @@ plot(mm.L3)

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

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

summary(mm.L3[["DFOP", 1]])
-
## mkin version used for fitting:    0.9.49.1 
-## R version used for fitting:       3.5.3 
-## Date of fit:     Thu Apr  4 17:00:09 2019 
-## Date of summary: Thu Apr  4 17:00:09 2019 
+
## mkin version used for fitting:    0.9.49.4 
+## R version used for fitting:       3.6.0 
+## Date of fit:     Thu May  2 18:43:55 2019 
+## Date of summary: Thu May  2 18:43:56 2019 
 ## 
 ## Equations:
 ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) *
@@ -1940,18 +1953,18 @@ plot(mm.L3)
## ## Model predictions using solution type analytical ## -## Fitted with method using 172 model solutions performed in 0.424 s +## Fitted using 372 model solutions performed in 0.761 s ## ## Error model: -## NULL +## Constant variance ## ## Starting values for parameters to be optimised: -## value type -## parent_0 97.80 state -## k1 0.10 deparm -## k2 0.01 deparm -## g 0.50 deparm -## sigma 1.00 error +## value type +## parent_0 97.800000 state +## k1 0.100000 deparm +## k2 0.010000 deparm +## g 0.500000 deparm +## sigma 1.017292 error ## ## Starting values for the transformed parameters actually optimised: ## value lower upper @@ -1959,7 +1972,7 @@ plot(mm.L3)
## log_k1 -2.302585 -Inf Inf ## log_k2 -4.605170 -Inf Inf ## g_ilr 0.000000 -Inf Inf -## sigma 1.000000 0 Inf +## sigma 1.017292 0 Inf ## ## Fixed parameter values: ## None @@ -1974,11 +1987,11 @@ plot(mm.L3) ## ## Parameter correlation: ## parent_0 log_k1 log_k2 g_ilr sigma -## parent_0 1.000e+00 1.732e-01 2.282e-02 4.009e-01 2.438e-07 -## log_k1 1.732e-01 1.000e+00 4.945e-01 -5.809e-01 -1.076e-07 -## log_k2 2.282e-02 4.945e-01 1.000e+00 -6.812e-01 -6.155e-08 -## g_ilr 4.009e-01 -5.809e-01 -6.812e-01 1.000e+00 -7.930e-08 -## sigma 2.438e-07 -1.076e-07 -6.155e-08 -7.930e-08 1.000e+00 +## parent_0 1.000e+00 1.732e-01 2.282e-02 4.009e-01 1.660e-07 +## log_k1 1.732e-01 1.000e+00 4.945e-01 -5.809e-01 6.635e-08 +## log_k2 2.282e-02 4.945e-01 1.000e+00 -6.812e-01 3.880e-07 +## g_ilr 4.009e-01 -5.809e-01 -6.812e-01 1.000e+00 -3.822e-07 +## sigma 1.660e-07 6.635e-08 3.880e-07 -3.822e-07 1.000e+00 ## ## Backtransformed parameters: ## Confidence intervals for internally transformed parameters are asymmetric. @@ -1991,9 +2004,9 @@ plot(mm.L3) ## g 0.45660 34.920 2.581e-05 0.41540 0.49850 ## sigma 1.01700 4.000 1.400e-02 0.20790 1.82700 ## -## Chi2 error levels in percent: +## FOCUS Chi2 error levels in percent: ## err.min n.optim df -## All data 2.452 5 3 +## All data 2.225 4 4 ## parent 2.225 4 4 ## ## Estimated disappearance times: @@ -2011,7 +2024,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.

@@ -2029,35 +2042,35 @@ 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 used for fitting:    0.9.49.1 
-## R version used for fitting:       3.5.3 
-## Date of fit:     Thu Apr  4 17:00:10 2019 
-## Date of summary: Thu Apr  4 17:00:11 2019 
+
## mkin version used for fitting:    0.9.49.4 
+## R version used for fitting:       3.6.0 
+## Date of fit:     Thu May  2 18:43:56 2019 
+## Date of summary: Thu May  2 18:43:57 2019 
 ## 
 ## Equations:
 ## d_parent/dt = - k_parent_sink * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method using 114 model solutions performed in 0.253 s
+## Fitted using 146 model solutions performed in 0.291 s
 ## 
 ## Error model:
-## NULL
+## Constant variance 
 ## 
 ## Starting values for parameters to be optimised:
-##               value   type
-## parent_0       96.6  state
-## k_parent_sink   0.1 deparm
-## sigma           1.0  error
+##                  value   type
+## parent_0      96.60000  state
+## k_parent_sink  0.10000 deparm
+## sigma          3.16181  error
 ## 
 ## Starting values for the transformed parameters actually optimised:
 ##                       value lower upper
 ## parent_0          96.600000  -Inf   Inf
 ## log_k_parent_sink -2.302585  -Inf   Inf
-## sigma              1.000000     0   Inf
+## sigma              3.161810     0   Inf
 ## 
 ## Fixed parameter values:
 ## None
@@ -2069,10 +2082,10 @@ plot(mm.L4)
## sigma 3.162 0.79050 1.130 5.194 ## ## Parameter correlation: -## parent_0 log_k_parent_sink sigma -## parent_0 1.000e+00 5.938e-01 9.573e-08 -## log_k_parent_sink 5.938e-01 1.000e+00 6.838e-08 -## sigma 9.573e-08 6.838e-08 1.000e+00 +## parent_0 log_k_parent_sink sigma +## parent_0 1.000e+00 5.938e-01 4.256e-10 +## log_k_parent_sink 5.938e-01 1.000e+00 -7.280e-10 +## sigma 4.256e-10 -7.280e-10 1.000e+00 ## ## Backtransformed parameters: ## Confidence intervals for internally transformed parameters are asymmetric. @@ -2083,9 +2096,9 @@ plot(mm.L4)
## k_parent_sink 0.006541 14.17 1.578e-05 0.005455 7.842e-03 ## sigma 3.162000 4.00 5.162e-03 1.130000 5.194e+00 ## -## Chi2 error levels in percent: +## FOCUS Chi2 error levels in percent: ## err.min n.optim df -## All data 3.506 3 5 +## All data 3.287 2 6 ## parent 3.287 2 6 ## ## Resulting formation fractions: @@ -2096,34 +2109,34 @@ plot(mm.L4) ## DT50 DT90 ## parent 106 352
summary(mm.L4[["FOMC", 1]], data = FALSE)
-
## mkin version used for fitting:    0.9.49.1 
-## R version used for fitting:       3.5.3 
-## Date of fit:     Thu Apr  4 17:00:11 2019 
-## Date of summary: Thu Apr  4 17:00:11 2019 
+
## mkin version used for fitting:    0.9.49.4 
+## R version used for fitting:       3.6.0 
+## Date of fit:     Thu May  2 18:43:56 2019 
+## Date of summary: Thu May  2 18:43:57 2019 
 ## 
 ## Equations:
 ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method using 111 model solutions performed in 0.257 s
+## Fitted using 224 model solutions performed in 0.451 s
 ## 
 ## Error model:
-## NULL
+## Constant variance 
 ## 
 ## Starting values for parameters to be optimised:
-##          value   type
-## parent_0  96.6  state
-## alpha      1.0 deparm
-## beta      10.0 deparm
-## sigma      1.0  error
+##              value   type
+## parent_0 96.600000  state
+## alpha     1.000000 deparm
+## beta     10.000000 deparm
+## sigma     1.830055  error
 ## 
 ## Starting values for the transformed parameters actually optimised:
 ##               value lower upper
 ## parent_0  96.600000  -Inf   Inf
 ## log_alpha  0.000000  -Inf   Inf
 ## log_beta   2.302585  -Inf   Inf
-## sigma      1.000000     0   Inf
+## sigma      1.830055     0   Inf
 ## 
 ## Fixed parameter values:
 ## None
@@ -2137,10 +2150,10 @@ plot(mm.L4)
## ## Parameter correlation: ## parent_0 log_alpha log_beta sigma -## parent_0 1.000e+00 -4.696e-01 -5.543e-01 -1.022e-06 -## log_alpha -4.696e-01 1.000e+00 9.889e-01 1.556e-06 -## log_beta -5.543e-01 9.889e-01 1.000e+00 1.437e-06 -## sigma -1.022e-06 1.556e-06 1.437e-06 1.000e+00 +## parent_0 1.000e+00 -4.696e-01 -5.543e-01 -2.473e-07 +## log_alpha -4.696e-01 1.000e+00 9.889e-01 2.429e-08 +## log_beta -5.543e-01 9.889e-01 1.000e+00 5.183e-08 +## sigma -2.473e-07 2.429e-08 5.183e-08 1.000e+00 ## ## Backtransformed parameters: ## Confidence intervals for internally transformed parameters are asymmetric. @@ -2152,9 +2165,9 @@ plot(mm.L4)
## beta 64.9800 2.540 3.201e-02 21.7800 193.900 ## sigma 1.8300 4.000 8.065e-03 0.5598 3.100 ## -## Chi2 error levels in percent: +## FOCUS Chi2 error levels in percent: ## err.min n.optim df -## All data 2.192 4 4 +## All data 2.029 3 5 ## parent 2.029 3 5 ## ## Estimated disappearance times: diff --git a/vignettes/mkin.Rmd b/vignettes/mkin.Rmd index 4f3ac7fc..b0d97f7e 100644 --- a/vignettes/mkin.Rmd +++ b/vignettes/mkin.Rmd @@ -69,17 +69,14 @@ plot_sep(f_SFO_SFO_SFO, lpos = c("topright", "bottomright", "bottomright")) Many approaches are possible regarding the evaluation of chemical degradation data. -The now deprecated `kinfit` package [@pkg:kinfit] in `R` [@rcore2016] -implements the approach recommended in the kinetics report provided by the -FOrum for Co-ordination of pesticide fate models and their USe [@FOCUS2006; --@FOCUSkinetics2014] for simple data series for one parent compound in one -compartment. - -The `mkin` package [@pkg:mkin] extends this approach to data series with -transformation products, commonly termed metabolites, and to more than one -compartment. It is also possible to include back reactions, so equilibrium -reactions and equilibrium partitioning can be specified, although this -oftentimes leads to an overparameterisation of the model. +The `mkin` package [@pkg:mkin] implements the approach recommended in the +kinetics report provided by the FOrum for Co-ordination of pesticide fate +models and their USe [@FOCUS2006; -@FOCUSkinetics2014] implements this approach +for simple decline data series, data series with transformation products, +commonly termed metabolites, data series for more than one compartment. It is +also possible to include back reactions, so equilibrium reactions and +equilibrium partitioning can be specified, although this oftentimes leads to an +overparameterisation of the model. When the first `mkin` code was published in 2010, the most commonly used tools for fitting more complex kinetic degradation models to experimental data were @@ -90,9 +87,9 @@ compartment based tool providing infrastructure for fitting dynamic simulation models based on differential equations to data. The code was first uploaded to the BerliOS platform. When this was taken down, -the version control history was imported into the R-Forge site, where the code -is still mirrored today (see *e.g.* -[the initial commit on 11 May 2010](http://cgit.jrwb.de/mkin/commit/?id=30cbb4092f6d2d3beff5800603374a0d009ad770)). +the version control history was imported into the R-Forge site (see *e.g.* +[the initial commit on 11 May 2010](http://cgit.jrwb.de/mkin/commit/?id=30cbb4092f6d2d3beff5800603374a0d009ad770)), +where the code is still occasionally updated. At that time, the R package `FME` (Flexible Modelling Environment) [@soetaert2010] was already available, and provided a good basis for diff --git a/vignettes/mkin.html b/vignettes/mkin.html index 635dd79e..34c1d1fa 100644 --- a/vignettes/mkin.html +++ b/vignettes/mkin.html @@ -11,23 +11,1335 @@ - + Introduction to mkin - + - - - - - - - - - - - + + + + + + + + + + + @@ -73,9 +1387,7 @@ h6 { - - -
- + + + @@ -122,7 +1499,6 @@ $(document).ready(function () { -