Kinetic Evaluation of Chemical Degradation Data
Calculation routines based on the FOCUS Kinetics Report (2006,
2014). Includes a function for conveniently defining differential equation
models, model solution based on eigenvalues if possible or using numerical
solvers. If a C compiler (on windows: 'Rtools') is installed, differential
equation models are solved using automatically generated C functions. Please
note that no warranty is implied for correctness of results or fitness for a
The R package mkin provides calculation routines for the analysis of chemical degradation data, including multicompartment kinetics as needed for modelling the formation and decline of transformation products, or if several degradation compartments are involved.
You can install the latest released version from CRAN from within R:
In the regulatory evaluation of chemical substances like plant protection products (pesticides), biocides and other chemicals, degradation data play an important role. For the evaluation of pesticide degradation experiments, detailed guidance and helpful tools have been developed as detailed in 'Credits and historical remarks' below.
- 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.
- Model solution (forward modelling) in the function
mkinpredictis 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
deSolvepackage (default is
- 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
mkinfitobject 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.
- The 'variance by variable' error model which is often fitted using
Iteratively Reweighted Least Squares (IRLS) should now be specified as
error_model = "obs".
Unique in mkin
- Three different error models can be selected using the argument
mkinfitfunction. 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_odeparmsso 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).
- Parallel fitting of several models to several datasets is supported, see for
- If a C compiler is installed, the kinetic models are compiled from automatically
generated C code, see
compiled_models. The autogeneration of C code was inspired by the
ccSolvepackage. 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 graphical user interface that may be useful. Please refer to its documentation page for installation instructions and a manual.
Credits and historical remarks
mkin would not be possible without the underlying software stack consisting of,
among others, R and the package deSolve.
In previous version,
mkin was also using the functionality of the
FME package. Please refer to the
package page on CRAN for the full list
of imported and suggested R packages. Also, Debian Linux,
the vim editor and the Nvim-R plugin have
been invaluable in its development.
mkin could not have been written without me being introduced to regulatory fate
modelling of pesticides by Adrian Gurney during my time at Harlan Laboratories
Ltd (formerly RCC Ltd).
mkin greatly profits from and largely follows
the work done by the
FOCUS Degradation Kinetics Workgroup,
as detailed in their guidance document from 2006, slightly updated in 2011 and
Also, it was inspired by the first version of KinGUI developed by BayerCropScience, which is based on the MatLab runtime environment.
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
Somewhat in parallel, Syngenta has sponsored the development of an
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
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)
|Ranke J, Meinecke S (2019) Error Models for the Kinetic Evaluation of Chemical Degradation Data Environments 6 (12) 124 doi:10.3390/environments6120124|
|Ranke J, Wöltjen J, Meinecke S (2018) Comparison of software tools for kinetic evaluation of chemical degradation data Environmental Sciences Europe 30 17 doi:10.1186/s12302-018-0145-1|
Contributions are welcome!
Functions in mkin
|AIC.mmkin||Calculate the AIC for a column of an mmkin object|
|D24_2014||Aerobic soil degradation data on 2,4-D from the EU assessment in 2014|
|DFOP.solution||Double First-Order in Parallel kinetics|
|[.mmkin||Subsetting method for mmkin objects|
|CAKE_export||Export a list of datasets format to a CAKE study file|
|FOCUS_2006_HS_ref_A_to_F||Results of fitting the HS model to Datasets A to F of FOCUS (2006)|
|FOCUS_2006_SFO_ref_A_to_F||Results of fitting the SFO model to Datasets A to F of FOCUS (2006)|
|FOCUS_2006_FOMC_ref_A_to_F||Results of fitting the FOMC model to Datasets A to F of FOCUS (2006)|
|NAFTA_SOP_Attachment||Example datasets from Attachment 1 to the NAFTA SOP published 2015|
|FOCUS_2006_DFOP_ref_A_to_B||Results of fitting the DFOP model to Datasets A to B of FOCUS (2006)|
|aw||Calculate Akaike weights for model averaging|
|loftest||Lack-of-fit test for models fitted to data with replicates|
|SFO.solution||Single First-Order kinetics|
|logLik.mkinfit||Calculated the log-likelihood of a fitted mkinfit object|
|mixed||Create a mixed effects model from an mmkin row object|
|create_deg_func||Create degradation functions for known analytical solutions|
|confint.mkinfit||Confidence intervals for parameters of mkinfit objects|
|dimethenamid_2018||Aerobic soil degradation data on dimethenamid and dimethenamid-P from the EU assessment in 2018|
|get_deg_func||Retrieve a degradation function from the mmkin namespace|
|FOCUS_2006_datasets||Datasets A to F from the FOCUS Kinetics report from 2006|
|add_err||Add normally distributed errors to simulated kinetic degradation data|
|endpoints||Function to calculate endpoints for further use from kinetic models fitted with mkinfit|
|SFORB.solution||Single First-Order Reversible Binding kinetics|
|ilr||Function to perform isometric log-ratio transformation|
|IORE.solution||Indeterminate order rate equation kinetics|
|mkin_wide_to_long||Convert a dataframe with observations over time into long format|
|NAFTA_SOP_2015||Example datasets from the NAFTA SOP published 2015|
|experimental_data_for_UBA_2019||Experimental datasets used for development and testing of error models|
|nafta||Evaluate parent kinetics using the NAFTA guidance|
|nlme.mmkin||Create an nlme model for an mmkin row object|
|mkin_long_to_wide||Convert a dataframe from long to wide format|
|nlme_function||Helper functions to create nlme models from mmkin row objects|
|nobs.mkinfit||Number of observations on which an mkinfit object was fitted|
|test_data_from_UBA_2014||Three experimental datasets from two water sediment systems and one soil|
|mkindsg||A class for dataset groups for mkin|
|mkinds||A dataset class for mkin|
|mkinresplot||Function to plot residuals stored in an mkin object|
|mkinerrmin||Calculate the minimum error to assume in order to pass the variance test|
|lrtest.mkinfit||Likelihood ratio test for mkinfit models|
|mccall81_245T||Datasets on aerobic soil metabolism of 2,4,5-T in six soils|
|max_twa_parent||Function to calculate maximum time weighted average concentrations from kinetic models fitted with mkinfit|
|mkinparplot||Function to plot the confidence intervals obtained using mkinfit|
|mkinmod||Function to set up a kinetic model with one or more state variables|
|f_time_norm_focus||Normalisation factors for aerobic soil degradation according to FOCUS guidance|
|FOMC.solution||First-Order Multi-Compartment kinetics|
|plot.nafta||Plot the results of the three models used in the NAFTA scheme.|
|reexports||Objects exported from other packages|
|focus_soil_moisture||FOCUS default values for soil moisture contents at field capacity, MWHC and 1/3 bar|
|mkinerrplot||Function to plot squared residuals and the error model for an mkin object|
|update.mkinfit||Update an mkinfit model with different arguments|
|parms||Extract model parameters from mkinfit models|
|mmkin||Fit one or more kinetic models with one or more state variables to one or more datasets|
|plot.mkinfit||Plot the observed data and the fitted model of an mkinfit object|
|plot.mmkin||Plot model fits (observed and fitted) and the residuals for a row or column of an mmkin object|
|synthetic_data_for_UBA_2014||Synthetic datasets for one parent compound with two metabolites|
|mkinfit||Fit a kinetic model to data with one or more state variables|
|summary.nlme.mmkin||Summary method for class "nlme.mmkin"|
|transform_odeparms||Functions to transform and backtransform kinetic parameters for fitting|
|schaefer07_complex_case||Metabolism data set used for checking the software quality of KinGUI|
|summary.mkinfit||Summary method for class "mkinfit"|
|sigma_twocomp||Two-component error model|
|residuals.mkinfit||Extract residuals from an mkinfit model|
|mkinplot||Plot the observed data and the fitted model of an mkinfit object|
|mkinpredict||Produce predictions from a kinetic model using specific parameters|
|plot.mixed.mmkin||Plot predictions from a fitted nonlinear mixed model obtained via an mmkin row object|
Vignettes of mkin
Last month downloads
|Packaged||2021-02-15 14:18:06 UTC; jranke|
|Date/Publication||2021-02-15 15:30:03 UTC|
|suggests||benchmarkme , covr , knitr , rbenchmark , rmarkdown , stats4 , testthat , tibble , tikzDevice , vdiffr|
|imports||deSolve , graphics , inline (>= 0.3.17) , lmtest , methods , nlme (>= 3.1-151) , numDeriv , pkgbuild , purrr , R6 , stats|
|depends||parallel , R (>= 2.15.1)|
|Contributors||Eurofins Regulatory AG, Katrin Lindenberger, Ren<c3><a9> Lehmann|
Include our badge in your README