From 48c463680b51fa767b4cd7bd62865f192d0354ac Mon Sep 17 00:00:00 2001
From: Johannes Ranke
Date: Sat, 6 Feb 2021 18:30:32 +0100
Subject: Reintroduce interface to saemix
Also after the upgrade from buster to bullseye of my local system, some
test results for saemix have changed.
---
docs/dev/reference/transform_odeparms.html | 80 ++++++++++++++++++------------
1 file changed, 47 insertions(+), 33 deletions(-)
(limited to 'docs/dev/reference/transform_odeparms.html')
diff --git a/docs/dev/reference/transform_odeparms.html b/docs/dev/reference/transform_odeparms.html
index 46b66073..6e19505f 100644
--- a/docs/dev/reference/transform_odeparms.html
+++ b/docs/dev/reference/transform_odeparms.html
@@ -77,7 +77,7 @@ the ilr transformation is used." />
mkin
- 0.9.50.4
+ 1.0.1.9000
@@ -126,7 +126,7 @@ the ilr transformation is used." />
#> Temporary DLL for differentials generated and loaded
+# Fit the model to the FOCUS example dataset D using defaults
+FOCUS_D<-subset(FOCUS_2006_D, value!=0)# remove zero values to avoid warning
+fit<-mkinfit(SFO_SFO, FOCUS_D, quiet =TRUE)
+fit.s<-summary(fit)# Transformed and backtransformed parametersprint(fit.s$par, 3)
-
# \dontrun{
-# Compare to the version without transforming rate parameters
-fit.2<-mkinfit(SFO_SFO, FOCUS_2006_D, transform_rates =FALSE, quiet =TRUE)
-
#> Warning: Observations with value of zero were removed from the data
#> Error in if (cost < cost.current) { assign("cost.current", cost, inherits = TRUE) if (!quiet) cat(ifelse(OLS, "Sum of squared residuals", "Negative log-likelihood"), " at call ", calls, ": ", signif(cost.current, 6), "\n", sep = "")}: missing value where TRUE/FALSE needed
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'fit.2' not found
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'print': object 'fit.2.s' not found
# }
+# Compare to the version without transforming rate parameters (does not work
+# with analytical solution, we get NA values for m1 in predictions)
+fit.2<-mkinfit(SFO_SFO, FOCUS_D, transform_rates =FALSE,
+ solution_type ="deSolve", quiet =TRUE)
+fit.2.s<-summary(fit.2)
+print(fit.2.s$par, 3)
+
# \dontrun{
-# The case of formation fractions
+# The case of formation fractions (this is now the default)SFO_SFO.ff<-mkinmod(
parent =list(type ="SFO", to ="m1", sink =TRUE),
m1 =list(type ="SFO"),
use_of_ff ="max")
#> Temporary DLL for differentials generated and loaded
#> Estimate Std. Error Lower Upper
#> parent_0 99.5985 1.5702 96.404 102.79
@@ -299,8 +313,8 @@ This is no problem for the internal use in mkinfit.
use_of_ff ="max")
#> Temporary DLL for differentials generated and loaded
## mkin version used for fitting: 1.0.3.9000
## R version used for fitting: 4.0.3
-## Date of fit: Mon Nov 30 16:01:52 2020
-## Date of summary: Mon Nov 30 16:01:52 2020
+## Date of fit: Mon Feb 15 17:13:39 2021
+## Date of summary: Mon Feb 15 17:13:39 2021
##
## Equations:
## d_parent/dt = - k_parent * parent
@@ -234,17 +233,17 @@
## 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: 0.9.50.4
+
## mkin version used for fitting: 1.0.3.9000
## R version used for fitting: 4.0.3
-## Date of fit: Mon Nov 30 16:01:53 2020
-## Date of summary: Mon Nov 30 16:01:53 2020
+## Date of fit: Mon Feb 15 17:13:40 2021
+## Date of summary: Mon Feb 15 17:13:40 2021
##
## Equations:
## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
##
## Model predictions using solution type analytical
##
-## Fitted using 380 model solutions performed in 0.087 s
+## Fitted using 369 model solutions performed in 0.084 s
##
## Error model: Constant variance
##
@@ -272,22 +271,22 @@
##
## Results:
##
-## AIC BIC logLik
-## 95.88778 99.44927 -43.94389
+## 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 16.92 NaN NaN NaN
-## log_beta 19.26 NaN NaN NaN
-## sigma 2.78 0.4501 1.814 3.745
+## 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.000000 NaN NaN 0.002218
-## log_alpha NaN 1 NaN NaN
-## log_beta NaN NaN 1 NaN
-## sigma 0.002218 NaN NaN 1.000000
+## parent_0 log_alpha log_beta sigma
+## parent_0 1.0000000 NaN NaN 0.0001671
+## log_alpha NaN 1 NaN NaN
+## log_beta NaN NaN 1 NaN
+## sigma 0.0001671 NaN NaN 1.0000000
##
## Backtransformed parameters:
## Confidence intervals for internally transformed parameters are asymmetric.
@@ -295,9 +294,9 @@
## for estimators of untransformed parameters.
## Estimate t value Pr(>t) Lower Upper
## parent_0 9.247e+01 NA NA 89.720 95.220
-## alpha 2.223e+07 NA NA NA NA
-## beta 2.325e+08 NA NA NA NA
-## sigma 2.780e+00 NA NA 1.814 3.745
+## 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
@@ -346,10 +345,10 @@
## mkin version used for fitting: 1.0.3.9000
## R version used for fitting: 4.0.3
-## Date of fit: Mon Nov 30 16:01:54 2020
-## Date of summary: Mon Nov 30 16:01:54 2020
+## Date of fit: Mon Feb 15 17:13:41 2021
+## Date of summary: Mon Feb 15 17:13:41 2021
##
## Equations:
## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
@@ -439,7 +438,7 @@
##
## Model predictions using solution type analytical
##
-## Fitted using 581 model solutions performed in 0.136 s
+## Fitted using 581 model solutions performed in 0.134 s
##
## Error model: Constant variance
##
@@ -470,18 +469,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.117 1.929e+03 -4558.0000 4564.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.459e-07 9.147e-11 2.665e-01 8.413e-11
-## log_k1 6.459e-07 1.000e+00 1.061e-04 -2.087e-04 -9.802e-06
-## log_k2 9.147e-11 1.061e-04 1.000e+00 -7.903e-01 -2.429e-09
-## g_qlogis 2.665e-01 -2.087e-04 -7.903e-01 1.000e+00 4.049e-09
-## sigma 8.413e-11 -9.802e-06 -2.429e-09 4.049e-09 1.000e+00
+## parent_0 log_k1 log_k2 g_qlogis sigma
+## 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.
@@ -489,7 +488,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.5800 5.303e-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
@@ -501,7 +500,7 @@
##
## Estimated disappearance times:
## DT50 DT90 DT50back DT50_k1 DT50_k2
-## parent 0.5335 5.311 1.599 0.0307 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. 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.
@@ -533,10 +532,10 @@
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.
## mkin version used for fitting: 1.0.3.9000
## R version used for fitting: 4.0.3
-## Date of fit: Mon Nov 30 16:01:55 2020
-## Date of summary: Mon Nov 30 16:01:55 2020
+## Date of fit: Mon Feb 15 17:13:41 2021
+## Date of summary: Mon Feb 15 17:13:42 2021
##
## Equations:
## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
@@ -545,7 +544,7 @@
##
## Model predictions using solution type analytical
##
-## Fitted using 376 model solutions performed in 0.081 s
+## Fitted using 376 model solutions performed in 0.082 s
##
## Error model: Constant variance
##
@@ -583,11 +582,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.671e-08
-## log_k1 1.732e-01 1.000e+00 4.945e-01 -5.809e-01 7.148e-07
+## 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.929e-07
-## sigma -9.671e-08 7.148e-07 1.022e-06 -7.929e-07 1.000e+00
+## 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.
@@ -646,10 +645,10 @@
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.
## mkin version used for fitting: 1.0.3.9000
## R version used for fitting: 4.0.3
-## Date of fit: Mon Nov 30 16:01:55 2020
-## Date of summary: Mon Nov 30 16:01:55 2020
+## Date of fit: Mon Feb 15 17:13:42 2021
+## Date of summary: Mon Feb 15 17:13:42 2021
##
## Equations:
## d_parent/dt = - k_parent * parent
@@ -711,17 +710,17 @@
## parent 106 352
Many approaches are possible regarding the evaluation of chemical degradation data.
-
The mkin package (Ranke 2019) implements the approach recommended in the kinetics report provided by the FOrum for Co-ordination of pesticide fate models and their USe (FOCUS Work Group on Degradation Kinetics 2006, 2014) for simple decline data series, data series with transformation products, commonly termed metabolites, and for 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.
+
The mkin package (Ranke 2021) implements the approach to degradation kinetics recommended in the kinetics report provided by the FOrum for Co-ordination of pesticide fate models and their USe (FOCUS Work Group on Degradation Kinetics 2006, 2014). It covers data series describing the decline of one compound, data series with transformation products (commonly termed metabolites) and data series for more than one compartment. It is possible to include back reactions. Therefore, equilibrium reactions and equilibrium partitioning can be specified, although this often 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 KinGUI (Schäfer et al. 2007), a MATLAB based tool with a graphical user interface that was specifically tailored to the task and included some output as proposed by the FOCUS Kinetics Workgroup, and ModelMaker, a general purpose 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 (see e.g.the initial commit on 11 May 2010), where the code is still occasionally updated.
-
At that time, the R package FME (Flexible Modelling Environment) (Soetaert and Petzoldt 2010) was already available, and provided a good basis for developing a package specifically tailored to the task. The remaining challenge was to make it as easy as possible for the users (including the author of this vignette) to specify the system of differential equations and to include the output requested by the FOCUS guidance, such as the relative standard deviation that has to be assumed for the residuals, such that the \(\chi^2\) goodness-of-fit test as defined by the FOCUS kinetics workgroup would pass using an significance level \(\alpha\) of 0.05. This relative error, expressed as a percentage, is often termed \(\chi^2\) error level or similar.
-
Also, mkin introduced using analytical solutions for parent only kinetics for improved optimization speed. Later, Eigenvalue based solutions were introduced to mkin for the case of linear differential equations (i.e. where the FOMC or DFOP models were not used for the parent compound), greatly improving the optimization speed for these cases. This, however, has become somehow obsolete, as the use of compiled code described below gives even smaller execution times.
+
The ‘mkin’ code was first uploaded to the BerliOS development platform. When this was taken down, the version control history was imported into the R-Forge site (see e.g.the initial commit on 11 May 2010), where the code is still being updated.
+
At that time, the R package FME (Flexible Modelling Environment) (Soetaert and Petzoldt 2010) was already available, and provided a good basis for developing a package specifically tailored to the task. The remaining challenge was to make it as easy as possible for the users (including the author of this vignette) to specify the system of differential equations and to include the output requested by the FOCUS guidance, such as the \(\chi^2\) error level as defined in this guidance.
+
Also, mkin introduced using analytical solutions for parent only kinetics for improved optimization speed. Later, Eigenvalue based solutions were introduced to mkin for the case of linear differential equations (i.e. where the FOMC or DFOP models were not used for the parent compound), greatly improving the optimization speed for these cases. This, has become somehow obsolete, as the use of compiled code described below gives even faster execution times.
The possibility to specify back-reactions and a biphasic model (SFORB) for metabolites were present in mkin from the very beginning.
Derived software tools
-
Soon after the publication of mkin, two derived tools were published, namely KinGUII (available from Bayer Crop Science) and CAKE (commissioned to Tessella by Syngenta), which added a graphical user interface (GUI), and added fitting by iteratively reweighted least squares (IRLS) and characterisation of likely parameter distributions by Markov Chain Monte Carlo (MCMC) sampling.
-
CAKE focuses on a smooth use experience, sacrificing some flexibility in the model definition, originally allowing only two primary metabolites in parallel. The current version 3.3 of CAKE release in March 2016 uses a basic scheme for up to six metabolites in a flexible arrangement, but does not support back-reactions (non-instantaneous equilibria) or biphasic kinetics for metabolites.
+
Soon after the publication of mkin, two derived tools were published, namely KinGUII (developed at Bayer Crop Science) and CAKE (commissioned to Tessella by Syngenta), which added a graphical user interface (GUI), and added fitting by iteratively reweighted least squares (IRLS) and characterisation of likely parameter distributions by Markov Chain Monte Carlo (MCMC) sampling.
+
CAKE focuses on a smooth use experience, sacrificing some flexibility in the model definition, originally allowing only two primary metabolites in parallel. The current version 3.4 of CAKE released in May 2020 uses a scheme for up to six metabolites in a flexible arrangement and supports biphasic modelling of metabolites, but does not support back-reactions (non-instantaneous equilibria).
KinGUI offers an even more flexible widget for specifying complex kinetic models. Back-reactions (non-instantaneous equilibria) were supported early on, but until 2014, only simple first-order models could be specified for transformation products. Starting with KinGUII version 2.1, biphasic modelling of metabolites was also available in KinGUII.
A further graphical user interface (GUI) that has recently been brought to a decent degree of maturity is the browser based GUI named gmkin. Please see its documentation page and manual for further information.
A comparison of scope, usability and numerical results obtained with these tools has been recently been published by Ranke, Wöltjen, and Meinecke (2018).
-
-
-Recent developments
-
Currently (July 2019), the main features available in mkin which are not present in KinGUII or CAKE, are the speed increase by using compiled code when a compiler is present, parallel model fitting on multicore machines using the mmkin function, and the estimation of parameter confidence intervals based on transformed parameters.
-
In addition, the possibility to use two alternative error models to constant variance have been integrated. The variance by variable error model introduced by Gao et al. (2011) has been available via an iteratively reweighted least squares (IRLS) procedure since mkin version 0.9-22. With release 0.9.49.5, the IRLS algorithm has been replaced by direct or step-wise maximisation of the likelihood function, which makes it possible not only to fit the variance by variable error model but also a two-component error model inspired by error models developed in analytical chemistry.
+
+
+Unique features
+
Currently, the main unique features available in mkin are
+
+
the speed increase by using compiled code when a compiler is present,
+
parallel model fitting on multicore machines using the mmkin function,
+
the estimation of parameter confidence intervals based on transformed parameters (see below) and
The iteratively reweighted least squares fitting of different variances for each variable as introduced by Gao et al. (2011) has been available in mkin since version 0.9-22. With release 0.9.49.5, the IRLS algorithm has been complemented by direct or step-wise maximisation of the likelihood function, which makes it possible not only to fit the variance by variable error model but also a two-component error model inspired by error models developed in analytical chemistry (Ranke and Meinecke 2019).
@@ -179,13 +184,13 @@
For rate constants, the log transformation is used, as proposed by Bates and Watts (1988, 77, 149). Approximate intervals are constructed for the transformed rate constants (compare Bates and Watts 1988, 135), i.e. for their logarithms. Confidence intervals for the rate constants are then obtained using the appropriate backtransformation using the exponential function.
In the first version of mkin allowing for specifying models using formation fractions, a home-made reparameterisation was used in order to ensure that the sum of formation fractions would not exceed unity.
This method is still used in the current version of KinGUII (v2.1 from April 2014), with a modification that allows for fixing the pathway to sink to zero. CAKE uses penalties in the objective function in order to enforce this constraint.
-
In 2012, an alternative reparameterisation of the formation fractions was proposed together with René Lehmann (Ranke and Lehmann 2012), based on isometric logratio transformation (ILR). The aim was to improve the validity of the linear approximation of the objective function during the parameter estimation procedure as well as in the subsequent calculation of parameter confidence intervals.
+
In 2012, an alternative reparameterisation of the formation fractions was proposed together with René Lehmann (Ranke and Lehmann 2012), based on isometric logratio transformation (ILR). The aim was to improve the validity of the linear approximation of the objective function during the parameter estimation procedure as well as in the subsequent calculation of parameter confidence intervals. In the current version of mkin, a logit transformation is used for parameters that are bound between 0 and 1, such as the g parameter of the DFOP model.
Confidence intervals based on transformed parameters
In the first attempt at providing improved parameter confidence intervals introduced to mkin in 2013, confidence intervals obtained from FME on the transformed parameters were simply all backtransformed one by one to yield asymmetric confidence intervals for the backtransformed parameters.
However, while there is a 1:1 relation between the rate constants in the model and the transformed parameters fitted in the model, the parameters obtained by the isometric logratio transformation are calculated from the set of formation fractions that quantify the paths to each of the compounds formed from a specific parent compound, and no such 1:1 relation exists.
-
Therefore, parameter confidence intervals for formation fractions obtained with this method only appear valid for the case of a single transformation product, where only one formation fraction is to be estimated, directly corresponding to one component of the ilr transformed parameter.
+
Therefore, parameter confidence intervals for formation fractions obtained with this method only appear valid for the case of a single transformation product, where currently the logit transformation is used for the formation fraction.
The confidence intervals obtained by backtransformation for the cases where a 1:1 relation between transformed and original parameter exist are considered by the author of this vignette to be more accurate than those obtained using a re-estimation of the Hessian matrix after backtransformation, as implemented in the FME package.
@@ -200,36 +205,39 @@
References
-
+
Bates, D., and D. Watts. 1988. Nonlinear Regression and Its Applications. Wiley-Interscience.
-
FOCUS Work Group on Degradation Kinetics. 2006. Guidance Document on Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in Eu Registration. Report of the Focus Work Group on Degradation Kinetics. http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics.
+
FOCUS Work Group on Degradation Kinetics. 2006. Guidance Document on Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in Eu Registration. Report of the Focus Work Group on Degradation Kinetics. http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics.
Gao, Z., J.W. Green, J. Vanderborght, and W. Schmitt. 2011. “Improving Uncertainty Analysis in Kinetic Evaluations Using Iteratively Reweighted Least Squares.” Journal. Environmental Science and Technology 45: 4429–37.
+
Gao, Z., J. W. Green, J. Vanderborght, and W. Schmitt. 2011. “Improving Uncertainty Analysis in Kinetic Evaluations Using Iteratively Reweighted Least Squares.” Journal. Environmental Science and Technology 45: 4429–37.
Ranke, J., and R. Lehmann. 2012. “Parameter Reliability in Kinetic Evaluation of Environmental Metabolism Data - Assessment and the Influence of Model Specification.” In SETAC World 20-24 May. Berlin.
Ranke, Johannes, and Stefan Meinecke. 2019. “Error Models for the Kinetic Evaluation of Chemical Degradation Data.” Environments 6 (12). https://doi.org/10.3390/environments6120124.
-
Ranke, Johannes, Janina Wöltjen, and Stefan Meinecke. 2018. “Comparison of Software Tools for Kinetic Evaluation of Chemical Degradation Data.” Environmental Sciences Europe 30 (1): 17. https://doi.org/10.1186/s12302-018-0145-1.
+
Ranke, Johannes, Janina Wöltjen, and Stefan Meinecke. 2018. “Comparison of Software Tools for Kinetic Evaluation of Chemical Degradation Data.” Environmental Sciences Europe 30 (1): 17. https://doi.org/10.1186/s12302-018-0145-1.
Schäfer, D., B. Mikolasch, P. Rainbird, and B. Harvey. 2007. “KinGUI: A New Kinetic Software Tool for Evaluations According to FOCUS Degradation Kinetics.” In Proceedings of the Xiii Symposium Pesticide Chemistry, edited by Del Re A. A. M., Capri E., Fragoulis G., and Trevisan M., 916–23. Piacenza.
-
Soetaert, Karline, and Thomas Petzoldt. 2010. “Inverse Modelling, Sensitivity and Monte Carlo Analysis in R Using Package FME.” Journal of Statistical Software 33 (3): 1–28. https://www.jstatsoft.org/v33/i03/.
+
Soetaert, Karline, and Thomas Petzoldt. 2010. “Inverse Modelling, Sensitivity and Monte Carlo Analysis in R Using Package FME.” Journal of Statistical Software 33 (3): 1–28. https://www.jstatsoft.org/v33/i03/.
Note that a method for calculating maximum moving window time weighted average concentrations for a model fitted by ‘mkinfit’ or from parent decline model parameters is included in the max_twa_parent() function. If the same is needed for metabolites, the function pfm::max_twa() from the ‘pfm’ package can be used.
-
+
-
FOCUS Work Group on Degradation Kinetics. 2014. Generic Guidance for Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in Eu Registration. 1.1 ed. http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics.
+
FOCUS Work Group on Degradation Kinetics. 2014. Generic Guidance for Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in Eu Registration. 1.1 ed. http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics.
This fit corresponds to the final result chosen in Appendix 7 of the FOCUS report. Confidence intervals returned by mkin are based on internally transformed parameters, however.
@@ -353,13 +352,13 @@
##
## $SFORB
## Z0_b1 Z0_b2 Z3_b1 Z3_b2
-## 2.4471371 0.0075126 0.0800070 0.0000000
+## 2.4471322 0.0075125 0.0800069 0.0000000
##
## $distimes
## DT50 DT90 DT50back DT50_Z0_b1 DT50_Z0_b2 DT50_Z3_b1 DT50_Z3_b2
-## Z0 0.3043 1.1848 0.35666 0.28325 92.265 NA NA
+## Z0 0.3043 1.1848 0.35666 0.28325 92.266 NA NA
## Z1 1.5148 5.0320 NA NA NA NA NA
-## Z2 1.6414 5.4525 NA NA NA NA NA
+## Z2 1.6414 5.4526 NA NA NA NA NA
## Z3 NA NA NA NA NA 8.6636 Inf
It is clear the degradation rate of Z3 towards the end of the experiment is very low as DT50_Z3_b2 (the second Eigenvalue of the system of two differential equations representing the SFORB system for Z3, corresponding to the slower rate constant of the DFOP model) is reported to be infinity. However, this appears to be a feature of the data.
@@ -367,9 +366,9 @@
References
-
+
-
FOCUS Work Group on Degradation Kinetics. 2014. Generic Guidance for Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in Eu Registration. 1.1 ed. http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics.
+
FOCUS Work Group on Degradation Kinetics. 2014. Generic Guidance for Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in Eu Registration. 1.1 ed. http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics.
In this case, the DFOP fit reported for PestDF resulted in a negative value for the slower rate constant, which is not possible in mkin. The other results are in agreement.
## Warning in summary.mkinfit(x): Could not calculate correlation; no covariance
-## matrix
-
-## Warning in summary.mkinfit(x): Could not calculate correlation; no covariance
## matrix
+
## Warning in sqrt(diag(covar)): NaNs produced
+
## Warning in sqrt(diag(covar_notrans)): 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
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
## The half-life obtained from the IORE model may be used
## Sums of squares:
## SFO IORE DFOP
@@ -704,11 +707,11 @@
##
## $DFOP
## Estimate Pr(>t) Lower Upper
-## parent_0 97.6840 NA NaN NaN
-## k1 0.0589 NA NA NA
-## k2 0.0589 NA NA NA
-## g 0.6473 NA NA NA
-## sigma 3.4323 NA NaN NaN
+## parent_0 97.6840 NaN NaN NaN
+## k1 0.0589 NaN NA NA
+## k2 0.0589 NaN NA NA
+## g 0.6473 NaN NA NA
+## sigma 3.4323 NaN NaN NaN
##
##
## DTx values:
@@ -723,18 +726,14 @@
US EPA. 2015. “Standard Operating Procedure for Using the NAFTA Guidance to Calculate Representative Half-Life Values and Characterizing Pesticide Degradation.”
## Warning in mkinfit(models[[model_index]], datasets[[dataset_index]], ...): Optimisation did not converge:
-## iteration limit reached without convergence (10)
-
-## Warning in mkinfit(models[[model_index]], datasets[[dataset_index]], ...): Optimisation did not converge:
-## iteration limit reached without convergence (10)
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.
+
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.
Highly flexible model specification using mkinmod, including equilibrium reactions and using the single first-order reversible binding (SFORB) model, which will automatically create two latent state variables for the observed variable.
-
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.
-
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 log-ratio 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.
Summary and plotting functions. The summary of an mkinfit object is in fact a full report that should give enough information to be able to approximately reproduce the fit with other tools.
The chi-squared error level as defined in the FOCUS kinetics guidance (see below) is calculated for each observed variable.
-
When a metabolite decline phase is not described well by SFO kinetics, SFORB kinetics can be used for the metabolite.
-
Three different error models can be selected using the argument error_model to the mkinfit function.
The ‘variance by variable’ error model which is often fitted using Iteratively Reweighted Least Squares (IRLS) should now be specified as error_model = "obs".
-
A two-component error model similar to the one proposed by Rocke and Lorenzato can be selected using the argument error_model = "tc".
+
+
+
+
+Unique in mkin
+
+
Three different error models can be selected using the argument error_model to the mkinfit function. A two-component error model similar to the one proposed by Rocke and Lorenzato can be selected using the argument error_model = "tc".
+
Model comparisons using the Akaike Information Criterion (AIC) are supported which can also be used for non-constant variance. In such cases the FOCUS chi-squared error level is not meaningful.
+
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.
+
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 cannot occur in a single experiment with a single defined radiolabel position.
+
When a metabolite decline phase is not described well by SFO kinetics, SFORB kinetics can be used for the metabolite. Mathematically, the SFORB model is equivalent to the DFOP model used by other tools for biphasic metabolite curves. However, the SFORB model has the advantage that there is a mechanistic interpretation of the model parameters.
Nonlinear mixed-effects models can be created from fits of the same degradation model to different datasets for the same compound by using the nlme.mmkin method. Note that the convergence of the nlme fits depends on the quality of the data. Convergence is better for simple models and data for many groups (e.g. soils).
+
+
+Performance
+
+
Parallel fitting of several models to several datasets is supported, see for example plot.mmkin.
+
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.
+
Even if no compiler is installed, many degradation models still give very good performance, as current versions of mkin also have analytical solutions for some models with one metabolite, and if SFO or SFORB are used for the parent compound, Eigenvalue based solutions of the degradation model are available.
There is a list of changes for the latest CRAN release and one for each github branch, e.g. the main branch.
@@ -171,6 +188,16 @@
In 2011, Bayer Crop Science started to distribute an R based successor to KinGUI named KinGUII whose R code is based on mkin, but which added, among other refinements, a closed source graphical user interface (GUI), iteratively reweighted least squares (IRLS) optimisation of the variance for each of the observed variables, and Markov Chain Monte Carlo (MCMC) simulation functionality, similar to what is available e.g. in the FME package.
Somewhat in parallel, Syngenta has sponsored the development of an mkin and KinGUII based GUI application called CAKE, which also adds IRLS and MCMC, is more limited in the model formulation, but puts more weight on usability. CAKE is available for download from the CAKE website, where you can also find a zip archive of the R scripts derived from mkin, published under the GPL license.
Finally, there is KineticEval, which contains a further development of the scripts used for KinGUII, so the different tools will hopefully be able to learn from each other in the future as well.
+
Thanks to René Lehmann, formerly working at the Umweltbundesamt, for the nice cooperation cooperation on parameter transformations, especially the isometric log-ratio transformation that is now used for formation fractions in case there are more than two transformation targets.
+
Many inspirations for improvements of mkin resulted from doing kinetic evaluations of degradation data for my clients while working at Harlan Laboratories and at Eurofins Regulatory AG, and now as an independent consultant.
+
Funding was received from the Umweltbundesamt in the course of the projects
+
+
Grant Number 112407 (Testing and validation of modelling software as an alternative to ModelMaker 4.0, 2014-2015)
+
Project Number 56703 (Optimization of gmkin for routine use in the Umweltbundesamt, 2015)
+
Project Number 112407 (Testing the feasibility of using an error model according to Rocke and Lorenzato for more realistic parameter estimates in the kinetic evaluation of degradation data, 2018-2019)
+
Project Number 120667 (Development of objective criteria for the evaluation of the visual fit in the kinetic evaluation of degradation data, 2019-2020)
+
Project 146839 (Checking the feasibility of using mixed-effects models for the derivation of kinetic modelling parameters from degradation studies, 2020-2021)
@@ -187,8 +187,7 @@ dataframe if there are several fits in the column).
f<-mmkin(c("SFO", "FOMC", "DFOP"),
list("FOCUS A"=FOCUS_2006_A,
"FOCUS C"=FOCUS_2006_C), cores =1, quiet =TRUE)
-
#> Warning: Optimisation did not converge:
-#> false convergence (8)
# We get a warning because the FOMC model does not converge for the
+ # We get a warning because the FOMC model does not converge for the# FOCUS A dataset, as it is well described by SFOAIC(f["SFO", "FOCUS A"])# We get a single number for a single fit
@@ -199,15 +198,15 @@ dataframe if there are several fits in the column).
AIC(f[, "FOCUS A"])
diff --git a/docs/dev/reference/add_err-1.png b/docs/dev/reference/add_err-1.png
index d2ce797f..9ba106db 100644
Binary files a/docs/dev/reference/add_err-1.png and b/docs/dev/reference/add_err-1.png differ
diff --git a/docs/dev/reference/add_err-2.png b/docs/dev/reference/add_err-2.png
index ac220c9e..3088c40e 100644
Binary files a/docs/dev/reference/add_err-2.png and b/docs/dev/reference/add_err-2.png differ
diff --git a/docs/dev/reference/add_err-3.png b/docs/dev/reference/add_err-3.png
index 40465b71..493a761a 100644
Binary files a/docs/dev/reference/add_err-3.png and b/docs/dev/reference/add_err-3.png differ
diff --git a/docs/dev/reference/add_err.html b/docs/dev/reference/add_err.html
index 6ea30515..b94cef29 100644
--- a/docs/dev/reference/add_err.html
+++ b/docs/dev/reference/add_err.html
@@ -74,7 +74,7 @@ may depend on the predicted value and is specified as a standard deviation." />
mkin
- 0.9.50.4
+ 1.0.3.9000
@@ -123,7 +123,7 @@ may depend on the predicted value and is specified as a standard deviation." />
# Using more cores does not save much time here, as parent_0 takes up most of the time
+#> 4.295 1.008 3.959
# Using more cores does not save much time here, as parent_0 takes up most of the time# If we additionally exclude parent_0 (the confidence of which is often of# minor interest), we get a nice performance improvement if we use at least 4 coressystem.time(ci_profile_no_parent_0<-confint(f_d_1, method ="profile",
c("k_parent_sink", "k_parent_m1", "k_m1_sink", "sigma"), cores =n_cores))
# }
diff --git a/docs/dev/reference/dimethenamid_2018.html b/docs/dev/reference/dimethenamid_2018.html
index 21dea623..a06599df 100644
--- a/docs/dev/reference/dimethenamid_2018.html
+++ b/docs/dev/reference/dimethenamid_2018.html
@@ -77,7 +77,7 @@ constrained by data protection regulations." />
mkin
- 0.9.50.4
+ 1.0.3.9000
diff --git a/docs/dev/reference/endpoints.html b/docs/dev/reference/endpoints.html
index 301b454f..c9912f9c 100644
--- a/docs/dev/reference/endpoints.html
+++ b/docs/dev/reference/endpoints.html
@@ -78,7 +78,7 @@ advantage that the SFORB model can also be used for metabolites." />
mkin
- 1.0.2.9000
+ 1.0.3.9000
diff --git a/docs/dev/reference/experimental_data_for_UBA-1.png b/docs/dev/reference/experimental_data_for_UBA-1.png
index 24cb54c5..33946ded 100644
Binary files a/docs/dev/reference/experimental_data_for_UBA-1.png and b/docs/dev/reference/experimental_data_for_UBA-1.png differ
diff --git a/docs/dev/reference/experimental_data_for_UBA.html b/docs/dev/reference/experimental_data_for_UBA.html
index 78e57fb0..9904370f 100644
--- a/docs/dev/reference/experimental_data_for_UBA.html
+++ b/docs/dev/reference/experimental_data_for_UBA.html
@@ -100,7 +100,7 @@ Dataset 12 is from the Renewal Assessment Report (RAR) for thifensulfuron-methyl
mkin
- 0.9.50.4
+ 1.0.3.9000
@@ -149,7 +149,7 @@ Dataset 12 is from the Renewal Assessment Report (RAR) for thifensulfuron-methyl
# formation fraction from phenol to anisol is practically 1. As we cannot# fix formation fractions when using the ilr transformation, we can turn of# the sink in the model generation
@@ -215,28 +215,28 @@
quiet =TRUE)
#> Warning: Observations with value of zero were removed from the data
@@ -235,18 +235,16 @@
#> Status of individual fits:
#>
#> dataset
-#> model 1 2 3 4 5 6 7 8
-#> DFOP-SFO OK OK OK OK OK C OK OK
+#> model 1 2 3 4 5 6 7 8
+#> DFOP-SFO OK OK OK OK OK OK OK OK
#>
#> OK: No warnings
-#> C: Optimisation did not converge:
-#> iteration limit reached without convergence (10)
#>
#> Mean fitted parameters:
#> parent_0 log_k_m1 f_parent_qlogis log_k1 log_k2
-#> 100.606304 -8.759216 -0.002001 -3.350539 -3.989549
+#> 100.674757 -8.761916 -0.004347 -3.348812 -3.986853
#> g_qlogis
-#> -0.090353
#> test relative elapsed
-#> 3 analytical 1.000 0.526
-#> 1 deSolve_compiled 1.903 1.001
-#> 2 eigen 2.308 1.214
# }
+
#> test relative elapsed
+#> 3 analytical 1.000 0.563
+#> 1 deSolve_compiled 1.702 0.958
+#> 2 eigen 2.597 1.462
# }# Use stepwise fitting, using optimised parameters from parent only fit, FOMC-SFO# \dontrun{
@@ -587,22 +587,21 @@ doi: 10.3390/environments6
#> Temporary DLL for differentials generated and loaded
fit.FOMC_SFO<-mkinfit(FOMC_SFO, FOCUS_D, quiet =TRUE)# Again, we get a warning and try a more sophisticated error modelfit.FOMC_SFO.tc<-mkinfit(FOMC_SFO, FOCUS_D, quiet =TRUE, error_model ="tc")
-
#> Warning: Optimisation did not converge:
-#> iteration limit reached without convergence (10)
# This model has a higher likelihood, but not significantly so
+# This model has a higher likelihood, but not significantly solrtest(fit.tc, fit.FOMC_SFO.tc)
#> Likelihood ratio test
#>
#> Model 1: FOMC_SFO with error model tc and fixed parameter(s) m1_0
#> Model 2: SFO_SFO with error model tc and fixed parameter(s) m1_0
#> #Df LogLik Df Chisq Pr(>Chisq)
-#> 1 7 -64.870
-#> 2 6 -64.983 -1 0.2259 0.6346
# Also, the missing standard error for log_beta and the t-tests for alpha
+#> 1 7 -64.829
+#> 2 6 -64.983 -1 0.3075 0.5792
# Also, the missing standard error for log_beta and the t-tests for alpha# and beta indicate overparameterisationsummary(fit.FOMC_SFO.tc, data =FALSE)
-
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: diag(.) had 0 or NA entries; non-finite result is doubtful
#> mkin version used for fitting: 0.9.50.4
+
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: diag(.) had 0 or NA entries; non-finite result is doubtful
# We can easily use starting parameters from the parent only fit (only for illustration)fit.FOMC=mkinfit("FOMC", FOCUS_2006_D, quiet =TRUE, error_model ="tc")fit.FOMC_SFO<-mkinfit(FOMC_SFO, FOCUS_D, quiet =TRUE,
diff --git a/docs/dev/reference/mkinmod.html b/docs/dev/reference/mkinmod.html
index 9a7dac6f..413f0ae1 100644
--- a/docs/dev/reference/mkinmod.html
+++ b/docs/dev/reference/mkinmod.html
@@ -78,7 +78,7 @@ mkinmod." />
mkin
- 0.9.50.4
+ 1.0.3.9000
@@ -348,7 +348,7 @@ Evaluating and Calculating Degradation Kinetics in Environmental Media
parent =mkinsub("SFO", "m1", full_name ="Test compound"),
m1 =mkinsub("SFO", full_name ="Metabolite M1"),
name ="SFO_SFO", dll_dir =DLL_dir, unload =TRUE, overwrite =TRUE)
-
#> Copied DLL from /tmp/Rtmpy4eiQb/file554e573761a7.so to /home/jranke/.local/share/mkin/SFO_SFO.so
# Now we can save the model and restore it in a new session
+
#> Copied DLL from /tmp/Rtmp92fCb2/file133ad522561845.so to /home/jranke/.local/share/mkin/SFO_SFO.so
# Now we can save the model and restore it in a new sessionsaveRDS(SFO_SFO.2, file ="~/SFO_SFO.rds")# Terminate the R session here if you would like to check, and then dolibrary(mkin)
@@ -397,7 +397,7 @@ Evaluating and Calculating Degradation Kinetics in Environmental Media
#> })
#> return(predicted)
#> }
-#> <environment: 0x55555cac8d00>
+#> <environment: 0x5555572517f8>
# If we have several parallel metabolites# (compare tests/testthat/test_synthetic_data_for_UBA_2014.R)m_synth_DFOP_par<-mkinmod(
diff --git a/docs/dev/reference/mkinparplot-1.png b/docs/dev/reference/mkinparplot-1.png
index dcf3e4b5..c9ed49eb 100644
Binary files a/docs/dev/reference/mkinparplot-1.png and b/docs/dev/reference/mkinparplot-1.png differ
diff --git a/docs/dev/reference/mkinparplot.html b/docs/dev/reference/mkinparplot.html
index 0a989ef9..bac6e71c 100644
--- a/docs/dev/reference/mkinparplot.html
+++ b/docs/dev/reference/mkinparplot.html
@@ -73,7 +73,7 @@ mkinfit." />
mkin
- 0.9.50.4
+ 1.0.3.9000
diff --git a/docs/dev/reference/nlme.mmkin.html b/docs/dev/reference/nlme.mmkin.html
index 2649c111..925cf7cf 100644
--- a/docs/dev/reference/nlme.mmkin.html
+++ b/docs/dev/reference/nlme.mmkin.html
@@ -74,7 +74,7 @@ have been obtained by fitting the same model to a list of datasets." />
mkin
- 1.0.1.9000
+ 1.0.3.9000
@@ -157,7 +157,7 @@ have been obtained by fitting the same model to a list of datasets.
data ="auto",
fixed =lapply(as.list(names(mean_degparms(model))), function(el)eval(parse(text =paste(el, 1, sep ="~")))),
- random =pdDiag(fixed),
+ random =pdDiag(fixed),
groups,
start =mean_degparms(model, random =TRUE),
correlation =NULL,
diff --git a/docs/dev/reference/nobs.mkinfit.html b/docs/dev/reference/nobs.mkinfit.html
index 621eb622..0b6c963c 100644
--- a/docs/dev/reference/nobs.mkinfit.html
+++ b/docs/dev/reference/nobs.mkinfit.html
@@ -72,7 +72,7 @@
mkin
- 0.9.50.4
+ 1.0.3.9000
diff --git a/docs/dev/reference/parms.html b/docs/dev/reference/parms.html
index ba0e89bb..9f6f4225 100644
--- a/docs/dev/reference/parms.html
+++ b/docs/dev/reference/parms.html
@@ -74,7 +74,7 @@ considering the error structure that was assumed for the fit." />
mkin
- 0.9.50.4
+ 1.0.3.9000
@@ -123,7 +123,7 @@ considering the error structure that was assumed for the fit." />
# We can overlay the two variants if we generate predictionspred_nlme<-mkinpredict(dfop_sfo,
diff --git a/docs/dev/reference/plot.mkinfit-2.png b/docs/dev/reference/plot.mkinfit-2.png
index 376c812f..a11d1680 100644
Binary files a/docs/dev/reference/plot.mkinfit-2.png and b/docs/dev/reference/plot.mkinfit-2.png differ
diff --git a/docs/dev/reference/plot.mkinfit-5.png b/docs/dev/reference/plot.mkinfit-5.png
index bc44de88..6631aa68 100644
Binary files a/docs/dev/reference/plot.mkinfit-5.png and b/docs/dev/reference/plot.mkinfit-5.png differ
diff --git a/docs/dev/reference/plot.mkinfit-6.png b/docs/dev/reference/plot.mkinfit-6.png
index eb8cbd92..946b20c5 100644
Binary files a/docs/dev/reference/plot.mkinfit-6.png and b/docs/dev/reference/plot.mkinfit-6.png differ
diff --git a/docs/dev/reference/plot.mkinfit-7.png b/docs/dev/reference/plot.mkinfit-7.png
index 92a664f4..10807ea8 100644
Binary files a/docs/dev/reference/plot.mkinfit-7.png and b/docs/dev/reference/plot.mkinfit-7.png differ
diff --git a/docs/dev/reference/plot.mkinfit.html b/docs/dev/reference/plot.mkinfit.html
index c5bfb528..c5249ecd 100644
--- a/docs/dev/reference/plot.mkinfit.html
+++ b/docs/dev/reference/plot.mkinfit.html
@@ -74,7 +74,7 @@ observed data together with the solution of the fitted model." />
mkin
- 0.9.50.4
+ 1.0.3.9000
diff --git a/docs/dev/reference/plot.mmkin-1.png b/docs/dev/reference/plot.mmkin-1.png
index f12b7907..647dfb8a 100644
Binary files a/docs/dev/reference/plot.mmkin-1.png and b/docs/dev/reference/plot.mmkin-1.png differ
diff --git a/docs/dev/reference/plot.mmkin-2.png b/docs/dev/reference/plot.mmkin-2.png
index e3127554..1bc1c9db 100644
Binary files a/docs/dev/reference/plot.mmkin-2.png and b/docs/dev/reference/plot.mmkin-2.png differ
diff --git a/docs/dev/reference/plot.mmkin-3.png b/docs/dev/reference/plot.mmkin-3.png
index 5448976e..50d6ffac 100644
Binary files a/docs/dev/reference/plot.mmkin-3.png and b/docs/dev/reference/plot.mmkin-3.png differ
diff --git a/docs/dev/reference/plot.mmkin-4.png b/docs/dev/reference/plot.mmkin-4.png
index 9a25fc50..e049fa16 100644
Binary files a/docs/dev/reference/plot.mmkin-4.png and b/docs/dev/reference/plot.mmkin-4.png differ
diff --git a/docs/dev/reference/plot.mmkin-5.png b/docs/dev/reference/plot.mmkin-5.png
index 82b422b5..2421995b 100644
Binary files a/docs/dev/reference/plot.mmkin-5.png and b/docs/dev/reference/plot.mmkin-5.png differ
diff --git a/docs/dev/reference/plot.mmkin.html b/docs/dev/reference/plot.mmkin.html
index ee80c6e4..9ca0df94 100644
--- a/docs/dev/reference/plot.mmkin.html
+++ b/docs/dev/reference/plot.mmkin.html
@@ -76,7 +76,7 @@ the fit of at least one model to the same dataset is shown." />
mkin
- 0.9.50.4
+ 1.0.3.9000
diff --git a/docs/dev/reference/plot.nafta.html b/docs/dev/reference/plot.nafta.html
index 9fc59f94..c24fba99 100644
--- a/docs/dev/reference/plot.nafta.html
+++ b/docs/dev/reference/plot.nafta.html
@@ -73,7 +73,7 @@ function (SFO, then IORE, then DFOP)." />
mkin
- 0.9.50.4
+ 1.0.3.9000
@@ -122,7 +122,7 @@ function (SFO, then IORE, then DFOP)." />
diff --git a/docs/dev/reference/reexports.html b/docs/dev/reference/reexports.html
index f12a2690..371567d8 100644
--- a/docs/dev/reference/reexports.html
+++ b/docs/dev/reference/reexports.html
@@ -79,7 +79,7 @@ below to see their documentation.
mkin
- 0.9.50.4
+ 1.0.3.9000
@@ -128,7 +128,7 @@ below to see their documentation.
#> Running main SAEM algorithm
-#> [1] "Sat Feb 13 12:33:19 2021"
+#> [1] "Mon Feb 15 17:12:35 2021"
#> ....
#> Minimisation finished
-#> [1] "Sat Feb 13 12:33:20 2021"
f_saem_fomc<-saem(f_mmkin_parent["FOMC", ])
+#> [1] "Mon Feb 15 17:12:36 2021"
f_saem_fomc<-saem(f_mmkin_parent["FOMC", ])
#> Running main SAEM algorithm
-#> [1] "Sat Feb 13 12:33:20 2021"
+#> [1] "Mon Feb 15 17:12:36 2021"
#> ....
#> Minimisation finished
-#> [1] "Sat Feb 13 12:33:22 2021"
f_saem_dfop<-saem(f_mmkin_parent["DFOP", ])
+#> [1] "Mon Feb 15 17:12:38 2021"
f_saem_dfop<-saem(f_mmkin_parent["DFOP", ])
#> Running main SAEM algorithm
-#> [1] "Sat Feb 13 12:33:23 2021"
+#> [1] "Mon Feb 15 17:12:39 2021"
#> ....
#> Minimisation finished
-#> [1] "Sat Feb 13 12:33:25 2021"
+#> [1] "Mon Feb 15 17:12:42 2021"
# The returned saem.mmkin object contains an SaemixObject, therefore we can use# functions from saemixlibrary(saemix)
@@ -324,10 +324,10 @@ using mmkin.
f_mmkin_parent_tc<-update(f_mmkin_parent, error_model ="tc")f_saem_fomc_tc<-saem(f_mmkin_parent_tc["FOMC", ])
#> Running main SAEM algorithm
-#> [1] "Sat Feb 13 12:33:28 2021"
+#> [1] "Mon Feb 15 17:12:44 2021"
#> ....
#> Minimisation finished
-#> [1] "Sat Feb 13 12:33:32 2021"
compare.saemix(list(f_saem_fomc$so, f_saem_fomc_tc$so))
+#> [1] "Mon Feb 15 17:12:49 2021"
#> saemix version used for fitting: 3.1.9000
-#> mkin version used for pre-fitting: 1.0.2.9000
+#> mkin version used for pre-fitting: 1.0.3.9000
#> R version used for fitting: 4.0.3
-#> Date of fit: Sat Feb 13 12:33:48 2021
-#> Date of summary: Sat Feb 13 12:33:48 2021
+#> Date of fit: Mon Feb 15 17:13:05 2021
+#> Date of summary: Mon Feb 15 17:13:06 2021
#>
#> Equations:
#> d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
@@ -413,7 +413,7 @@ using mmkin.
#>
#> Model predictions using solution type analytical
#>
-#> Fitted in 8.875 s using 300, 100 iterations
+#> Fitted in 8.985 s using 300, 100 iterations
#>
#> Variance model: Constant variance
#>
diff --git a/docs/dev/reference/schaefer07_complex_case-1.png b/docs/dev/reference/schaefer07_complex_case-1.png
index 16e657dd..96aab2dc 100644
Binary files a/docs/dev/reference/schaefer07_complex_case-1.png and b/docs/dev/reference/schaefer07_complex_case-1.png differ
diff --git a/docs/dev/reference/schaefer07_complex_case.html b/docs/dev/reference/schaefer07_complex_case.html
index 83555b99..4ccad5c4 100644
--- a/docs/dev/reference/schaefer07_complex_case.html
+++ b/docs/dev/reference/schaefer07_complex_case.html
@@ -74,7 +74,7 @@
mkin
- 0.9.50.4
+ 1.0.3.9000
# }# Compare with the results obtained in the original publicationprint(schaefer07_complex_results)
diff --git a/docs/dev/reference/sigma_twocomp-1.png b/docs/dev/reference/sigma_twocomp-1.png
index 21db3145..6e61684e 100644
Binary files a/docs/dev/reference/sigma_twocomp-1.png and b/docs/dev/reference/sigma_twocomp-1.png differ
diff --git a/docs/dev/reference/sigma_twocomp.html b/docs/dev/reference/sigma_twocomp.html
index 8212e480..b7d295b2 100644
--- a/docs/dev/reference/sigma_twocomp.html
+++ b/docs/dev/reference/sigma_twocomp.html
@@ -73,7 +73,7 @@ dependence of the measured value \(y\):" />
mkin
- 0.9.50.4
+ 1.0.3.9000
@@ -122,7 +122,7 @@ dependence of the measured value \(y\):" />
Rocke, David M. and Lorenzato, Stefan (1995) A two-component model for
measurement error in analytical chemistry. Technometrics 37(2), 176-184.
+
Ranke J and Meinecke S (2019) Error Models for the Kinetic Evaluation of Chemical
+Degradation Data. Environments 6(12) 124
+doi: 10.3390/environments6120124
+.
#> mkin version used for fitting: 1.0.3.9000
#> R version used for fitting: 4.0.3
-#> Date of fit: Mon Nov 30 16:01:20 2020
-#> Date of summary: Mon Nov 30 16:01:20 2020
+#> Date of fit: Mon Feb 15 17:13:09 2021
+#> Date of summary: Mon Feb 15 17:13:09 2021
#>
#> Equations:
#> d_parent/dt = - k_parent * parent
#>
#> Model predictions using solution type analytical
#>
-#> Fitted using 131 model solutions performed in 0.028 s
+#> Fitted using 131 model solutions performed in 0.027 s
#>
#> Error model: Constant variance
#>
diff --git a/docs/dev/reference/summary.nlme.mmkin.html b/docs/dev/reference/summary.nlme.mmkin.html
index 2aeadc46..b2f6624a 100644
--- a/docs/dev/reference/summary.nlme.mmkin.html
+++ b/docs/dev/reference/summary.nlme.mmkin.html
@@ -76,7 +76,7 @@ endpoints such as formation fractions and DT50 values. Optionally
mkin
- 0.9.50.4
+ 1.0.3.9000
@@ -125,7 +125,7 @@ endpoints such as formation fractions and DT50 values. Optionally
@@ -263,12 +263,12 @@ José Pinheiro and Douglas Bates for the components inherited from nlme
f_mmkin<-mmkin("SFO", ds_sfo_syn, quiet =TRUE, error_model ="tc", cores =1)
#> Warning: Optimisation did not converge:
#> iteration limit reached without convergence (10)
diff --git a/docs/dev/reference/summary.saem.mmkin.html b/docs/dev/reference/summary.saem.mmkin.html
index 81054813..0d661ee9 100644
--- a/docs/dev/reference/summary.saem.mmkin.html
+++ b/docs/dev/reference/summary.saem.mmkin.html
@@ -76,7 +76,7 @@ endpoints such as formation fractions and DT50 values. Optionally
mkin
- 1.0.2.9000
+ 1.0.3.9000
@@ -260,15 +260,15 @@ saemix authors for the parts inherited from saemix.
quiet =TRUE, error_model ="tc", cores =5)f_saem_dfop_sfo<-saem(f_mmkin_dfop_sfo)
#> Running main SAEM algorithm
-#> [1] "Sat Feb 13 12:33:52 2021"
+#> [1] "Mon Feb 15 17:13:15 2021"
#> ....
#> Minimisation finished
-#> [1] "Sat Feb 13 12:34:03 2021"
summary(f_saem_dfop_sfo, data =TRUE)
+#> [1] "Mon Feb 15 17:13:26 2021"
#> saemix version used for fitting: 3.1.9000
-#> mkin version used for pre-fitting: 1.0.2.9000
+#> mkin version used for pre-fitting: 1.0.3.9000
#> R version used for fitting: 4.0.3
-#> Date of fit: Sat Feb 13 12:34:04 2021
-#> Date of summary: Sat Feb 13 12:34:04 2021
+#> Date of fit: Mon Feb 15 17:13:27 2021
+#> Date of summary: Mon Feb 15 17:13:27 2021
#>
#> Equations:
#> d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
@@ -283,7 +283,7 @@ saemix authors for the parts inherited from saemix.
#>
#> Model predictions using solution type analytical
#>
-#> Fitted in 11.899 s using 300, 100 iterations
+#> Fitted in 12.204 s using 300, 100 iterations
#>
#> Variance model: Two-component variance function
#>
diff --git a/docs/dev/reference/synthetic_data_for_UBA_2014-1.png b/docs/dev/reference/synthetic_data_for_UBA_2014-1.png
index 351b21aa..89975db5 100644
Binary files a/docs/dev/reference/synthetic_data_for_UBA_2014-1.png and b/docs/dev/reference/synthetic_data_for_UBA_2014-1.png differ
diff --git a/docs/dev/reference/synthetic_data_for_UBA_2014.html b/docs/dev/reference/synthetic_data_for_UBA_2014.html
index 1edc7c1e..33a0ace2 100644
--- a/docs/dev/reference/synthetic_data_for_UBA_2014.html
+++ b/docs/dev/reference/synthetic_data_for_UBA_2014.html
@@ -87,7 +87,7 @@ Compare also the code in the example section to see the degradation models." />
mkin
- 0.9.50.4
+ 1.0.3.9000
@@ -136,7 +136,7 @@ Compare also the code in the example section to see the degradation models." />
diff --git a/test.log b/test.log
index 7a755af8..2c77a113 100644
--- a/test.log
+++ b/test.log
@@ -9,34 +9,34 @@ Testing mkin
✔ | 7 | Fitting the SFORB model [3.6 s]
✔ | 5 | Analytical solutions for coupled models [3.3 s]
✔ | 5 | Calculation of Akaike weights
-✔ | 12 | Confidence intervals and p-values [1.1 s]
+✔ | 12 | Confidence intervals and p-values [1.0 s]
✔ | 14 | Error model fitting [4.6 s]
✔ | 5 | Time step normalisation
✔ | 4 | Test fitting the decline of metabolites from their maximum [0.3 s]
✔ | 1 | Fitting the logistic model [0.2 s]
-✔ | 34 1 | Nonlinear mixed-effects models [26.1 s]
+✔ | 34 1 | Nonlinear mixed-effects models [40.8 s]
────────────────────────────────────────────────────────────────────────────────
Skip (test_mixed.R:150:3): saem results are reproducible for biphasic fits
Reason: Fitting with saemix takes around 10 minutes when using deSolve
────────────────────────────────────────────────────────────────────────────────
✔ | 2 | Test dataset classes mkinds and mkindsg
-✔ | 1 | mkinfit features [0.3 s]
-✔ | 10 | Special cases of mkinfit calls [0.3 s]
-✔ | 8 | mkinmod model generation and printing [0.2 s]
-✔ | 3 | Model predictions with mkinpredict [0.3 s]
-✔ | 16 | Evaluations according to 2015 NAFTA guidance [1.7 s]
-✔ | 9 | Nonlinear mixed-effects models [8.5 s]
-✔ | 16 | Plotting [2.0 s]
+✔ | 1 | mkinfit features [0.5 s]
+✔ | 10 | Special cases of mkinfit calls [0.6 s]
+✔ | 8 | mkinmod model generation and printing [0.4 s]
+✔ | 3 | Model predictions with mkinpredict [0.7 s]
+✔ | 16 | Evaluations according to 2015 NAFTA guidance [3.1 s]
+✔ | 9 | Nonlinear mixed-effects models [14.5 s]
+✔ | 16 | Plotting [2.1 s]
✔ | 4 | Residuals extracted from mkinfit models
-✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.5 s]
-✔ | 4 | Summary [0.1 s]
+✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.7 s]
+✔ | 4 | Summary [0.2 s]
✔ | 1 | Summaries of old mkinfit objects
-✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.2 s]
-✔ | 9 | Hypothesis tests [8.3 s]
+✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.3 s]
+✔ | 9 | Hypothesis tests [8.4 s]
✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.5 s]
══ Results ═════════════════════════════════════════════════════════════════════
-Duration: 68.9 s
+Duration: 92.7 s
── Skipped tests ──────────────────────────────────────────────────────────────
● Fitting with saemix takes around 10 minutes when using deSolve (1)
diff --git a/vignettes/FOCUS_D.html b/vignettes/FOCUS_D.html
index f1f078db..a158629a 100644
--- a/vignettes/FOCUS_D.html
+++ b/vignettes/FOCUS_D.html
@@ -463,8 +463,8 @@ print(FOCUS_2006_D)
summary(fit)
## mkin version used for fitting: 1.0.3
## R version used for fitting: 4.0.3
-## Date of fit: Mon Feb 15 14:11:17 2021
-## Date of summary: Mon Feb 15 14:11:17 2021
+## Date of fit: Mon Feb 15 17:29:02 2021
+## Date of summary: Mon Feb 15 17:29:03 2021
##
## Equations:
## d_parent/dt = - k_parent * parent
diff --git a/vignettes/FOCUS_L.html b/vignettes/FOCUS_L.html
index 0ed46483..3d8e02c2 100644
--- a/vignettes/FOCUS_L.html
+++ b/vignettes/FOCUS_L.html
@@ -1561,8 +1561,8 @@ FOCUS_2006_L1_mkin <- mkin_wide_to_long(FOCUS_2006_L1)
summary(m.L1.SFO)
## mkin version used for fitting: 1.0.3
## R version used for fitting: 4.0.3
-## Date of fit: Mon Feb 15 14:11:19 2021
-## Date of summary: Mon Feb 15 14:11:19 2021
+## Date of fit: Mon Feb 15 17:29:04 2021
+## Date of summary: Mon Feb 15 17:29:04 2021
##
## Equations:
## d_parent/dt = - k_parent * parent
@@ -1662,15 +1662,15 @@ summary(m.L1.SFO)
## doubtful
## mkin version used for fitting: 1.0.3
## R version used for fitting: 4.0.3
-## Date of fit: Mon Feb 15 14:11:19 2021
-## Date of summary: Mon Feb 15 14:11:19 2021
+## Date of fit: Mon Feb 15 17:29:04 2021
+## Date of summary: Mon Feb 15 17:29:04 2021
##
## Equations:
## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
##
## Model predictions using solution type analytical
##
-## Fitted using 369 model solutions performed in 0.082 s
+## Fitted using 369 model solutions performed in 0.083 s
##
## Error model: Constant variance
##
@@ -1767,8 +1767,8 @@ plot(m.L2.FOMC, show_residuals = TRUE,
summary(m.L2.FOMC, data = FALSE)
## mkin version used for fitting: 1.0.3
## R version used for fitting: 4.0.3
-## Date of fit: Mon Feb 15 14:11:19 2021
-## Date of summary: Mon Feb 15 14:11:19 2021
+## Date of fit: Mon Feb 15 17:29:04 2021
+## Date of summary: Mon Feb 15 17:29:04 2021
##
## Equations:
## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
@@ -1845,8 +1845,8 @@ plot(m.L2.DFOP, show_residuals = TRUE, show_errmin = TRUE,
summary(m.L2.DFOP, data = FALSE)
## mkin version used for fitting: 1.0.3
## R version used for fitting: 4.0.3
-## Date of fit: Mon Feb 15 14:11:20 2021
-## Date of summary: Mon Feb 15 14:11:20 2021
+## Date of fit: Mon Feb 15 17:29:05 2021
+## Date of summary: Mon Feb 15 17:29:05 2021
##
## Equations:
## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
@@ -1945,8 +1945,8 @@ plot(mm.L3)
summary(mm.L3[["DFOP", 1]])
## mkin version used for fitting: 1.0.3
## R version used for fitting: 4.0.3
-## Date of fit: Mon Feb 15 14:11:20 2021
-## Date of summary: Mon Feb 15 14:11:20 2021
+## Date of fit: Mon Feb 15 17:29:05 2021
+## Date of summary: Mon Feb 15 17:29:05 2021
##
## Equations:
## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
@@ -2053,8 +2053,8 @@ plot(mm.L4)
summary(mm.L4[["SFO", 1]], data = FALSE)
## mkin version used for fitting: 1.0.3
## R version used for fitting: 4.0.3
-## Date of fit: Mon Feb 15 14:11:20 2021
-## Date of summary: Mon Feb 15 14:11:20 2021
+## Date of fit: Mon Feb 15 17:29:05 2021
+## Date of summary: Mon Feb 15 17:29:05 2021
##
## Equations:
## d_parent/dt = - k_parent * parent
@@ -2117,15 +2117,15 @@ plot(mm.L4)
summary(mm.L4[["FOMC", 1]], data = FALSE)
## mkin version used for fitting: 1.0.3
## R version used for fitting: 4.0.3
-## Date of fit: Mon Feb 15 14:11:20 2021
-## Date of summary: Mon Feb 15 14:11:20 2021
+## Date of fit: Mon Feb 15 17:29:05 2021
+## Date of summary: Mon Feb 15 17:29:05 2021
##
## 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.046 s
+## Fitted using 224 model solutions performed in 0.047 s
##
## Error model: Constant variance
##
diff --git a/vignettes/web_only/mkin_benchmarks.rda b/vignettes/web_only/mkin_benchmarks.rda
index d2b82805..8c3369a2 100644
Binary files a/vignettes/web_only/mkin_benchmarks.rda and b/vignettes/web_only/mkin_benchmarks.rda differ
--
cgit v1.2.3