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. It provides stable functionality for kinetic evaluations according to the FOCUS guidance (see below for details). In addition, it provides functionality to do hierarchical kinetics based on nonlinear mixed-effects models.
You can install the latest released version from CRAN from within R:
install.packages("mkin")
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 various helpful tools have been developed as detailed in 'Credits and historical remarks' below. This package aims to provide a one stop solution for degradation kinetics, addressing modellers that are willing to, or even prefer to work with R.
For a start, have a look at the code examples provided for
plot.mkinfit
and
plot.mmkin
, and
at the package vignettes
FOCUS L
and
FOCUS D
.
The HTML documentation of the latest version released to CRAN is available at jrwb.de and github.
Documentation of the development version is found in the 'dev' subdirectory. In the articles section of this documentation, you can also find demonstrations of the application of nonlinear hierarchical models, also known as nonlinear mixed-effects models, to more complex data, including transformation products and covariates.
mkinmod
,
including equilibrium reactions and using the single first-order reversible
binding (SFORB) model, which will automatically create two state variables
for the observed variable.mkinpredict
is performed either using the analytical solution for the case of
parent only degradation or some simple models involving a single transformation
product, , 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
).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.error_model = "obs"
.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"
.transform_odeparms
so their estimators can more reasonably be expected to follow
a normal distribution.saemix
package as a backend. Analytical
solutions suitable for use with this package have been implemented for parent
only models and the most important models including one metabolite (SFO-SFO
and DFOP-SFO). Fitting other models with saem.mmkin
, while it makes use
of the compiled ODE models that mkin provides, has longer run times (from a couple
of minutes to more than an hour).plot.mmkin
.compiled_models
.
The autogeneration of C code was
inspired by the ccSolve
package. Thanks
to Karline Soetaert for her work on that.There is a graphical user interface that may be useful. Please refer to its documentation page for installation instructions and a manual. It only supports evaluations using (generalised) nonlinear regression, but not simultaneous fits using nonlinear mixed-effects models.
There is a list of changes for the latest CRAN release and one for each github branch, e.g. the main branch.
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
in 2014.
Also, it was inspired by the first version of KinGUI developed by BayerCropScience, which is based on the MatLab runtime environment.
The companion package kinfit (now deprecated) was started in 2008 and first published on CRAN on 01 May 2010.
The first mkin
code was
published on 11 May 2010 and the
first CRAN version
on 18 May 2010.
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 some further development of the scripts used for KinGUII.
Thanks to René Lehmann, formerly working at the Umweltbundesamt, for the nice 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
Thanks to everyone involved for collaboration and support!
Thanks are due also to Emmanuelle Comets, maintainer of the saemix package, for her interest and support for using the SAEM algorithm and its implementation in saemix for the evaluation of chemical degradation data.
Regarding the application of nonlinear mixed-effects models to degradation data, von Götz et al (1999) have already proposed to use this technique in the context of environmental risk assessments of pesticides. However, this work was apparently not followed up, which is why we had to independently arrive at the idea and missed to cite this previous work on the topic in our first publications.
Contributions are welcome!
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.