From c58ccd73951b2000a7a254fb36bbd9f0733db6cd Mon Sep 17 00:00:00 2001
From: Johannes Ranke
Date: Mon, 12 May 2025 22:16:10 +0200
Subject: Check and test locally
---
docs/articles/FOCUS_D.html | 14 +-
docs/articles/FOCUS_L.html | 66 +-
docs/articles/index.html | 2 +-
docs/articles/mkin.html | 212 +--
.../mkin_files/figure-html/unnamed-chunk-2-1.png | Bin 0 -> 91109 bytes
docs/articles/prebuilt/2022_cyan_pathway.html | 1480 ++++++++------------
docs/articles/prebuilt/2022_dmta_parent.html | 1039 +++++---------
docs/articles/prebuilt/2022_dmta_pathway.html | 1025 +++++---------
docs/articles/prebuilt/2023_mesotrione_parent.html | 1293 +++++++----------
docs/articles/twa.html | 4 +-
docs/articles/web_only/FOCUS_Z.html | 4 +-
docs/articles/web_only/NAFTA_examples.html | 36 +-
docs/articles/web_only/benchmarks.html | 62 +-
docs/articles/web_only/compiled_models.html | 20 +-
docs/articles/web_only/dimethenamid_2018.html | 84 +-
docs/articles/web_only/multistart.html | 4 +-
docs/articles/web_only/saem_benchmarks.html | 100 +-
17 files changed, 2172 insertions(+), 3273 deletions(-)
create mode 100644 docs/articles/mkin_files/figure-html/unnamed-chunk-2-1.png
(limited to 'docs/articles')
diff --git a/docs/articles/FOCUS_D.html b/docs/articles/FOCUS_D.html
index dab5f1ee..eb7b758d 100644
--- a/docs/articles/FOCUS_D.html
+++ b/docs/articles/FOCUS_D.html
@@ -20,7 +20,7 @@
mkin
- 1.2.9
+ 1.2.10
@@ -84,7 +84,7 @@
Ranke
Last change 31 January 2019
-(rebuilt 2025-02-13)
+(rebuilt 2025-05-12)
Source: vignettes/FOCUS_D.rmd
FOCUS_D.rmd
@@ -185,10 +185,10 @@ the mkinparplot
function.
summary
method for mkinfit
objects.
-## mkin version used for fitting: 1.2.9
-## R version used for fitting: 4.4.2
-## Date of fit: Thu Feb 13 15:49:53 2025
-## Date of summary: Thu Feb 13 15:49:53 2025
+## mkin version used for fitting: 1.2.10
+## R version used for fitting: 4.5.0
+## Date of fit: Mon May 12 21:54:24 2025
+## Date of summary: Mon May 12 21:54:24 2025
##
## Equations:
## d_parent/dt = - k_parent * parent
@@ -196,7 +196,7 @@ the mkinparplot
function.
##
## Model predictions using solution type analytical
##
-## Fitted using 401 model solutions performed in 0.053 s
+## Fitted using 401 model solutions performed in 0.054 s
##
## Error model: Constant variance
##
diff --git a/docs/articles/FOCUS_L.html b/docs/articles/FOCUS_L.html
index 30092709..85d82a27 100644
--- a/docs/articles/FOCUS_L.html
+++ b/docs/articles/FOCUS_L.html
@@ -20,7 +20,7 @@
mkin
- 1.2.9
+ 1.2.10
@@ -84,7 +84,7 @@
Ranke
Last change 18 May 2023
-(rebuilt 2025-02-13)
+(rebuilt 2025-05-12)
Source: vignettes/FOCUS_L.rmd
FOCUS_L.rmd
@@ -117,10 +117,10 @@ report.
m.L1.SFO <- mkinfit ( "SFO" , FOCUS_2006_L1_mkin , quiet = TRUE )
summary ( m.L1.SFO )
-## mkin version used for fitting: 1.2.9
-## R version used for fitting: 4.4.2
-## Date of fit: Thu Feb 13 15:49:54 2025
-## Date of summary: Thu Feb 13 15:49:54 2025
+## mkin version used for fitting: 1.2.10
+## R version used for fitting: 4.5.0
+## Date of fit: Mon May 12 21:54:26 2025
+## Date of summary: Mon May 12 21:54:26 2025
##
## Equations:
## d_parent/dt = - k_parent * parent
@@ -225,17 +225,17 @@ error level is checked.
## Warning in sqrt(diag(covar)): NaNs produced
## Warning in cov2cor(ans$covar): diag(V) had non-positive or NA entries; the
## non-finite result may be dubious
-## mkin version used for fitting: 1.2.9
-## R version used for fitting: 4.4.2
-## Date of fit: Thu Feb 13 15:49:55 2025
-## Date of summary: Thu Feb 13 15:49:55 2025
+## mkin version used for fitting: 1.2.10
+## R version used for fitting: 4.5.0
+## Date of fit: Mon May 12 21:54:26 2025
+## Date of summary: Mon May 12 21:54:26 2025
##
## Equations:
## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
##
## Model predictions using solution type analytical
##
-## Fitted using 342 model solutions performed in 0.023 s
+## Fitted using 342 model solutions performed in 0.024 s
##
## Error model: Constant variance
##
@@ -383,10 +383,10 @@ error level is checked.
-## mkin version used for fitting: 1.2.9
-## R version used for fitting: 4.4.2
-## Date of fit: Thu Feb 13 15:49:55 2025
-## Date of summary: Thu Feb 13 15:49:55 2025
+## mkin version used for fitting: 1.2.10
+## R version used for fitting: 4.5.0
+## Date of fit: Mon May 12 21:54:26 2025
+## Date of summary: Mon May 12 21:54:26 2025
##
## Equations:
## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
@@ -470,10 +470,10 @@ error level.
-## mkin version used for fitting: 1.2.9
-## R version used for fitting: 4.4.2
-## Date of fit: Thu Feb 13 15:49:55 2025
-## Date of summary: Thu Feb 13 15:49:55 2025
+## mkin version used for fitting: 1.2.10
+## R version used for fitting: 4.5.0
+## Date of fit: Mon May 12 21:54:27 2025
+## Date of summary: Mon May 12 21:54:27 2025
##
## Equations:
## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
@@ -593,10 +593,10 @@ 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.2.9
-## R version used for fitting: 4.4.2
-## Date of fit: Thu Feb 13 15:49:56 2025
-## Date of summary: Thu Feb 13 15:49:56 2025
+## mkin version used for fitting: 1.2.10
+## R version used for fitting: 4.5.0
+## Date of fit: Mon May 12 21:54:27 2025
+## Date of summary: Mon May 12 21:54:27 2025
##
## Equations:
## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
@@ -723,17 +723,17 @@ 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: 1.2.9
-## R version used for fitting: 4.4.2
-## Date of fit: Thu Feb 13 15:49:56 2025
-## Date of summary: Thu Feb 13 15:49:56 2025
+## mkin version used for fitting: 1.2.10
+## R version used for fitting: 4.5.0
+## Date of fit: Mon May 12 21:54:27 2025
+## Date of summary: Mon May 12 21:54:28 2025
##
## Equations:
## d_parent/dt = - k_parent * parent
##
## Model predictions using solution type analytical
##
-## Fitted using 142 model solutions performed in 0.009 s
+## Fitted using 142 model solutions performed in 0.01 s
##
## Error model: Constant variance
##
@@ -788,17 +788,17 @@ difference appears negligible.
## parent 106 352
summary ( mm.L4 [[ "FOMC" , 1 ] ] , data = FALSE )
-## mkin version used for fitting: 1.2.9
-## R version used for fitting: 4.4.2
-## Date of fit: Thu Feb 13 15:49:56 2025
-## Date of summary: Thu Feb 13 15:49:56 2025
+## mkin version used for fitting: 1.2.10
+## R version used for fitting: 4.5.0
+## Date of fit: Mon May 12 21:54:27 2025
+## Date of summary: Mon May 12 21:54:28 2025
##
## 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.013 s
+## Fitted using 224 model solutions performed in 0.014 s
##
## Error model: Constant variance
##
diff --git a/docs/articles/index.html b/docs/articles/index.html
index b1b9f39a..5883e462 100644
--- a/docs/articles/index.html
+++ b/docs/articles/index.html
@@ -7,7 +7,7 @@
mkin
- 1.2.9
+ 1.2.10
diff --git a/docs/articles/mkin.html b/docs/articles/mkin.html
index fcf37ee4..10239ccb 100644
--- a/docs/articles/mkin.html
+++ b/docs/articles/mkin.html
@@ -1,5 +1,18 @@
-Short introduction to mkin • mkin
+
+
+
+
+
+
+Short introduction to mkin • mkin
+
+
+
+
+
+
+
Skip to contents
@@ -7,7 +20,7 @@
mkin
- 1.2.9
+ 1.2.10
@@ -15,10 +28,12 @@
+
+
@@ -64,7 +84,7 @@
Ranke
Last change 18 May 2023
-(rebuilt 2025-02-13)
+(rebuilt 2025-05-12)
Source: vignettes/mkin.rmd
mkin.rmd
@@ -72,11 +92,12 @@ Ranke
-Wissenschaftlicher Berater, Kronacher
-Str. 12, 79639 Grenzach-Wyhlen, Germany Privatdozent at the
+
Wissenschaftlicher Berater, Kronacher
+Str. 12, 79639 Grenzach-Wyhlen, Germany Privatdozent at the
University of Freiburg
-
-
Abstract
+
+
Abstract
+
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
@@ -86,38 +107,40 @@ nonlinear optimisation. The R
add-on package
this guidance from within R and calculates some statistical measures for
data series within one or more compartments, for parent and
metabolites.
-
library ("mkin" , quietly = TRUE )
-# Define the kinetic model
- m_SFO_SFO_SFO <- mkinmod (parent = mkinsub ("SFO" , "M1" ),
- M1 = mkinsub ("SFO" , "M2" ),
- M2 = mkinsub ("SFO" ),
- use_of_ff = "max" , quiet = TRUE )
-
-
-# Produce model predictions using some arbitrary parameters
- sampling_times = c (0 , 1 , 3 , 7 , 14 , 28 , 60 , 90 , 120 )
- d_SFO_SFO_SFO <- mkinpredict (m_SFO_SFO_SFO,
- c (k_parent = 0.03 ,
- f_parent_to_M1 = 0.5 , k_M1 = log (2 )/ 100 ,
- f_M1_to_M2 = 0.9 , k_M2 = log (2 )/ 50 ),
- c (parent = 100 , M1 = 0 , M2 = 0 ),
- sampling_times)
-
-# Generate a dataset by adding normally distributed errors with
-# standard deviation 3, for two replicates at each sampling time
- d_SFO_SFO_SFO_err <- add_err (d_SFO_SFO_SFO, reps = 2 ,
- sdfunc = function (x) 3 ,
- n = 1 , seed = 123456789 )
-
-# Fit the model to the dataset
- f_SFO_SFO_SFO <- mkinfit (m_SFO_SFO_SFO, d_SFO_SFO_SFO_err[[1 ]], quiet = TRUE )
-
-# Plot the results separately for parent and metabolites
-plot_sep (f_SFO_SFO_SFO, lpos = c ("topright" , "bottomright" , "bottomright" ))
-
+
+library ( "mkin" , quietly = TRUE )
+# Define the kinetic model
+m_SFO_SFO_SFO <- mkinmod ( parent = mkinsub ( "SFO" , "M1" ) ,
+ M1 = mkinsub ( "SFO" , "M2" ) ,
+ M2 = mkinsub ( "SFO" ) ,
+ use_of_ff = "max" , quiet = TRUE )
+
+
+# Produce model predictions using some arbitrary parameters
+sampling_times = c ( 0 , 1 , 3 , 7 , 14 , 28 , 60 , 90 , 120 )
+d_SFO_SFO_SFO <- mkinpredict ( m_SFO_SFO_SFO ,
+ c ( k_parent = 0.03 ,
+ f_parent_to_M1 = 0.5 , k_M1 = log ( 2 ) / 100 ,
+ f_M1_to_M2 = 0.9 , k_M2 = log ( 2 ) / 50 ) ,
+ c ( parent = 100 , M1 = 0 , M2 = 0 ) ,
+ sampling_times )
+
+# Generate a dataset by adding normally distributed errors with
+# standard deviation 3, for two replicates at each sampling time
+d_SFO_SFO_SFO_err <- add_err ( d_SFO_SFO_SFO , reps = 2 ,
+ sdfunc = function ( x ) 3 ,
+ n = 1 , seed = 123456789 )
+
+# Fit the model to the dataset
+f_SFO_SFO_SFO <- mkinfit ( m_SFO_SFO_SFO , d_SFO_SFO_SFO_err [[ 1 ] ] , quiet = TRUE )
+
+# Plot the results separately for parent and metabolites
+plot_sep ( f_SFO_SFO_SFO , lpos = c ( "topright" , "bottomright" , "bottomright" ) )
+
-
-
Background
+
+
Background
+
The mkin
package (J. Ranke
2021) implements the approach to degradation kinetics recommended
in the kinetics report provided by the FOrum for Co-ordination of
@@ -138,8 +161,7 @@ purpose compartment based tool providing infrastructure for fitting
dynamic simulation models based on differential equations to data.
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
+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
@@ -162,8 +184,9 @@ times.
The possibility to specify back-reactions and a biphasic model
(SFORB) for metabolites were present in mkin
from the very
beginning.
-
-
-
+
+
diff --git a/docs/articles/mkin_files/figure-html/unnamed-chunk-2-1.png b/docs/articles/mkin_files/figure-html/unnamed-chunk-2-1.png
new file mode 100644
index 00000000..65c1a613
Binary files /dev/null and b/docs/articles/mkin_files/figure-html/unnamed-chunk-2-1.png differ
diff --git a/docs/articles/prebuilt/2022_cyan_pathway.html b/docs/articles/prebuilt/2022_cyan_pathway.html
index ea4dd035..3dd83fee 100644
--- a/docs/articles/prebuilt/2022_cyan_pathway.html
+++ b/docs/articles/prebuilt/2022_cyan_pathway.html
@@ -1,374 +1,100 @@
-
-
-
+
-
-
-
-
-
-
-
-
-
-
Testing hierarchical pathway kinetics with residue data on cyantraniliprole
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
Testing hierarchical pathway kinetics with residue data on cyantraniliprole • mkin
+
+
+
+
+
-
+
Skip to contents
+
+
+
+
+
mkin
+
+
1.2.10
+
+
+
+
+
+
+
-
-
-
-
-
-
+
-
Testing hierarchical pathway kinetics with
-residue data on cyantraniliprole
-Johannes Ranke
-Last change on 13 February 2023, last compiled on 13
-Februar 2025
-
+
+
-
-
Introduction
+
+
+
+
Introduction
+
The purpose of this document is to test demonstrate how nonlinear
hierarchical models (NLHM) based on the parent degradation models SFO,
FOMC, DFOP and HS, with serial formation of two or more metabolites can
@@ -377,7 +103,7 @@ be fitted with the mkin package.
173340 (Application of nonlinear hierarchical models to the kinetic
evaluation of chemical degradation data) of the German Environment
Agency carried out in 2022 and 2023.
-
The mkin package is used in version 1.2.9 which is currently under
+
The mkin package is used in version 1.2.10 which is currently under
development. The newly introduced functionality that is used here is a
simplification of excluding random effects for a set of fits based on a
related set of fits with a reduced model, and the documentation of the
@@ -389,47 +115,49 @@ but is also loaded to make the convergence plot function available.
also provides the
kable
function that is used to improve
the display of tabular data in R markdown documents. For parallel
processing, the
parallel
package is used.
-
library(mkin)
-library(knitr)
-library(saemix)
-library(parallel)
-n_cores <- detectCores()
-
-# We need to start a new cluster after defining a compiled model that is
-# saved as a DLL to the user directory, therefore we define a function
-# This is used again after defining the pathway model
-start_cluster <- function(n_cores) {
- if (Sys.info()["sysname"] == "Windows") {
- ret <- makePSOCKcluster(n_cores)
- } else {
- ret <- makeForkCluster(n_cores)
- }
- return(ret)
-}
-cl <- start_cluster(n_cores)
-
-
Test data
+
+library ( mkin )
+library ( knitr )
+library ( saemix )
+library ( parallel )
+n_cores <- detectCores ( )
+
+# We need to start a new cluster after defining a compiled model that is
+# saved as a DLL to the user directory, therefore we define a function
+# This is used again after defining the pathway model
+start_cluster <- function ( n_cores ) {
+ if ( Sys.info ( ) [ "sysname" ] == "Windows" ) {
+ ret <- makePSOCKcluster ( n_cores )
+ } else {
+ ret <- makeForkCluster ( n_cores )
+ }
+ return ( ret )
+}
+cl <- start_cluster ( n_cores )
+
+
Test data
+
The example data are taken from the final addendum to the DAR from
2014 and are distributed with the mkin package. Residue data and time
step normalisation factors are read in using the function
read_spreadsheet
from the mkin package. This function also
performs the time step normalisation.
-
data_file <- system.file(
- "testdata", "cyantraniliprole_soil_efsa_2014.xlsx",
- package = "mkin")
-cyan_ds <- read_spreadsheet(data_file, parent_only = FALSE)
+
+data_file <- system.file (
+ "testdata" , "cyantraniliprole_soil_efsa_2014.xlsx" ,
+ package = "mkin" )
+cyan_ds <- read_spreadsheet ( data_file , parent_only = FALSE )
The following tables show the covariate data and the 5 datasets that
were read in from the spreadsheet file.
-
pH <- attr(cyan_ds, "covariates")
-kable(pH, caption = "Covariate data")
-
+
+pH <- attr ( cyan_ds , "covariates" )
+kable ( pH , caption = "Covariate data" )
+
Covariate data
-
-
Nambsheim
@@ -453,25 +181,24 @@ kable(pH, caption = "Covariate data")
-for (ds_name in names(cyan_ds)) {
- print(
- kable(mkin_long_to_wide(cyan_ds[[ds_name]]),
- caption = paste("Dataset", ds_name),
- booktabs = TRUE, row.names = FALSE))
- cat("\n\\clearpage\n")
-}
-
+
+
Dataset Nambsheim
-
-
0.000000
@@ -683,17 +410,15 @@ kable(pH, caption = "Covariate data")
-
+
Dataset Tama
-
-
0.000000
@@ -879,17 +604,15 @@ kable(pH, caption = "Covariate data")
-
+
Dataset Gross-Umstadt
-
-
0.0000000
@@ -1145,17 +868,15 @@ kable(pH, caption = "Covariate data")
-
+
Dataset Sassafras
-
-
0.000000
@@ -1285,17 +1006,15 @@ kable(pH, caption = "Covariate data")
-
+
Dataset Lleida
-
-
0.000000
@@ -1427,25 +1146,25 @@ kable(pH, caption = "Covariate data")
-
-
Parent only evaluations
+
+
Parent only evaluations
+
As the pathway fits have very long run times, evaluations of the
parent data are performed first, in order to determine for each
hierarchical parent degradation model which random effects on the
degradation model parameters are ill-defined.
-
cyan_sep_const <- mmkin(c("SFO", "FOMC", "DFOP", "SFORB", "HS"),
- cyan_ds, quiet = TRUE, cores = n_cores)
-cyan_sep_tc <- update(cyan_sep_const, error_model = "tc")
-cyan_saem_full <- mhmkin(list(cyan_sep_const, cyan_sep_tc))
-status(cyan_saem_full) |> kable()
-