From 8bdb4cd437a9d4663e542f95869e8692aa38dadb Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 7 May 2020 08:59:29 +0200 Subject: Static documentation rebuilt by pkgdown --- R/DFOP.solution.R | 27 --- R/FOMC.solution.R | 36 ---- R/HS.solution.R | 29 --- R/IORE.solution.R | 37 ---- R/SFO.solution.R | 22 -- R/SFORB.solution.R | 35 ---- R/parent_solutions.R | 231 +++++++++++++++++++++ docs/404.html | 37 +++- docs/articles/FOCUS_D.html | 89 ++++---- docs/articles/FOCUS_D_files/figure-html/plot-1.png | Bin 97426 -> 101585 bytes docs/articles/index.html | 59 ++++-- docs/authors.html | 33 +-- docs/bootstrap-toc.css | 60 ++++++ docs/bootstrap-toc.js | 159 ++++++++++++++ docs/index.html | 55 ++--- docs/news/index.html | 171 +++++++-------- docs/pkgdown.css | 121 ++++++++++- docs/pkgdown.js | 5 - docs/pkgdown.yml | 3 +- docs/reference/DFOP.solution.html | 69 +++--- docs/reference/FOMC.solution.html | 66 +++--- docs/reference/HS.solution.html | 86 ++++---- docs/reference/IORE.solution.html | 80 +++---- docs/reference/SFO.solution.html | 71 ++++--- docs/reference/SFORB.solution.html | 75 ++++--- docs/reference/index.html | 101 ++++++--- docs/reference/logistic.solution-1.png | Bin 63262 -> 80598 bytes docs/reference/logistic.solution-2.png | Bin 29336 -> 80598 bytes docs/reference/logistic.solution.html | 125 +++++++---- docs/reference/mkinds.html | 57 ++--- docs/reference/mkinfit.html | 171 +++++---------- docs/reference/mkinmod.html | 57 +++-- docs/reference/mkinpredict.html | 205 ++++++++---------- man/DFOP.solution.Rd | 21 +- man/FOMC.solution.Rd | 16 +- man/HS.solution.Rd | 30 +-- man/IORE.solution.Rd | 17 +- man/SFO.solution.Rd | 23 +- man/SFORB.solution.Rd | 23 +- man/logistic.solution.Rd | 61 +++++- 40 files changed, 1531 insertions(+), 1032 deletions(-) delete mode 100644 R/DFOP.solution.R delete mode 100644 R/FOMC.solution.R delete mode 100644 R/HS.solution.R delete mode 100644 R/IORE.solution.R delete mode 100644 R/SFO.solution.R delete mode 100644 R/SFORB.solution.R create mode 100644 R/parent_solutions.R create mode 100644 docs/bootstrap-toc.css create mode 100644 docs/bootstrap-toc.js diff --git a/R/DFOP.solution.R b/R/DFOP.solution.R deleted file mode 100644 index 608e7e18..00000000 --- a/R/DFOP.solution.R +++ /dev/null @@ -1,27 +0,0 @@ -#' Double First-Order in Parallel kinetics -#' -#' Function describing decline from a defined starting value using the sum of -#' two exponential decline functions. -#' -#' @param t Time. -#' @param parent.0 Starting value for the response variable at time zero. -#' @param k1 First kinetic constant. -#' @param k2 Second kinetic constant. -#' @param g Fraction of the starting value declining according to the first -#' kinetic constant. -#' @return The value of the response variable at time \code{t}. -#' @references FOCUS (2006) \dQuote{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, -#' EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, -#' \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} -#' @examples -#' -#' plot(function(x) DFOP.solution(x, 100, 5, 0.5, 0.3), 0, 4, ylim = c(0,100)) -#' -#' @export -DFOP.solution <- function(t, parent.0, k1, k2, g) -{ - parent = g * parent.0 * exp(-k1 * t) + - (1 - g) * parent.0 * exp(-k2 * t) -} diff --git a/R/FOMC.solution.R b/R/FOMC.solution.R deleted file mode 100644 index f5e6a7ea..00000000 --- a/R/FOMC.solution.R +++ /dev/null @@ -1,36 +0,0 @@ -#' First-Order Multi-Compartment kinetics -#' -#' Function describing exponential decline from a defined starting value, with -#' a decreasing rate constant. -#' -#' The form given here differs slightly from the original reference by -#' Gustafson and Holden (1990). The parameter \code{beta} corresponds to 1/beta -#' in the original equation. -#' -#' @param t Time. -#' @param parent.0 Starting value for the response variable at time zero. -#' @param alpha Shape parameter determined by coefficient of variation of rate -#' constant values. -#' @param beta Location parameter. -#' @return The value of the response variable at time \code{t}. -#' @note The solution of the FOMC kinetic model reduces to the -#' \code{\link{SFO.solution}} for large values of \code{alpha} and -#' \code{beta} with \eqn{k = \frac{\beta}{\alpha}}{k = beta/alpha}. -#' @references FOCUS (2006) \dQuote{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, -#' EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, -#' \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} -#' -#' Gustafson DI and Holden LR (1990) Nonlinear pesticide dissipation in soil: -#' A new model based on spatial variability. \emph{Environmental Science and -#' Technology} \bold{24}, 1032-1038 -#' @examples -#' -#' plot(function(x) FOMC.solution(x, 100, 10, 2), 0, 2, ylim = c(0, 100)) -#' -#' @export -FOMC.solution <- function(t, parent.0, alpha, beta) -{ - parent = parent.0 / (t/beta + 1)^alpha -} diff --git a/R/HS.solution.R b/R/HS.solution.R deleted file mode 100644 index 890ad8ff..00000000 --- a/R/HS.solution.R +++ /dev/null @@ -1,29 +0,0 @@ -#' Hockey-Stick kinetics -#' -#' Function describing two exponential decline functions with a break point -#' between them. -#' -#' @param t Time. -#' @param parent.0 Starting value for the response variable at time zero. -#' @param k1 First kinetic constant. -#' @param k2 Second kinetic constant. -#' @param tb Break point. Before this time, exponential decline according to -#' \code{k1} is calculated, after this time, exponential decline proceeds -#' according to \code{k2}. -#' @return The value of the response variable at time \code{t}. -#' @references FOCUS (2006) \dQuote{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, -#' EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, -#' \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} -#' @examples -#' -#' plot(function(x) HS.solution(x, 100, 2, 0.3, 0.5), 0, 2, ylim=c(0,100)) -#' -#' @export -HS.solution <- function(t, parent.0, k1, k2, tb) -{ - parent = ifelse(t <= tb, - parent.0 * exp(-k1 * t), - parent.0 * exp(-k1 * tb) * exp(-k2 * (t - tb))) -} diff --git a/R/IORE.solution.R b/R/IORE.solution.R deleted file mode 100644 index 58807108..00000000 --- a/R/IORE.solution.R +++ /dev/null @@ -1,37 +0,0 @@ -#' Indeterminate order rate equation kinetics -#' -#' Function describing exponential decline from a defined starting value, with -#' a concentration dependent rate constant. -#' -#' @param t Time. -#' @param parent.0 Starting value for the response variable at time zero. -#' @param k__iore Rate constant. Note that this depends on the concentration -#' units used. -#' @param N Exponent describing the nonlinearity of the rate equation -#' @return The value of the response variable at time \code{t}. -#' @note The solution of the IORE kinetic model reduces to the -#' \code{\link{SFO.solution}} if N = 1. The parameters of the IORE model can -#' be transformed to equivalent parameters of the FOMC mode - see the NAFTA -#' guidance for details. -#' @references NAFTA Technical Working Group on Pesticides (not dated) Guidance -#' for Evaluating and Calculating Degradation Kinetics in Environmental Media -#' @keywords manip -#' @examples -#' -#' plot(function(x) IORE.solution(x, 100, 0.2, 1.3), 0, 2, ylim = c(0, 100)) -#' \dontrun{ -#' fit.fomc <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE) -#' fit.iore <- mkinfit("IORE", FOCUS_2006_C, quiet = TRUE) -#' fit.iore.deS <- mkinfit("IORE", FOCUS_2006_C, solution_type = "deSolve", quiet = TRUE) -#' -#' print(data.frame(fit.fomc$par, fit.iore$par, fit.iore.deS$par, -#' row.names = paste("model par", 1:4))) -#' print(rbind(fomc = endpoints(fit.fomc)$distimes, iore = endpoints(fit.iore)$distimes, -#' iore.deS = endpoints(fit.iore)$distimes)) -#' } -#' -#' @export -IORE.solution <- function(t, parent.0, k__iore, N) -{ - parent = (parent.0^(1 - N) - (1 - N) * k__iore * t)^(1/(1 - N)) -} diff --git a/R/SFO.solution.R b/R/SFO.solution.R deleted file mode 100644 index 17c16a4d..00000000 --- a/R/SFO.solution.R +++ /dev/null @@ -1,22 +0,0 @@ -#' Single First-Order kinetics -#' -#' Function describing exponential decline from a defined starting value. -#' -#' @param t Time. -#' @param parent.0 Starting value for the response variable at time zero. -#' @param k Kinetic constant. -#' @return The value of the response variable at time \code{t}. -#' @references FOCUS (2006) \dQuote{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, -#' EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, -#' \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} -#' @examples -#' -#' \dontrun{plot(function(x) SFO.solution(x, 100, 3), 0, 2)} -#' -#' @export -SFO.solution <- function(t, parent.0, k) -{ - parent = parent.0 * exp(-k * t) -} diff --git a/R/SFORB.solution.R b/R/SFORB.solution.R deleted file mode 100644 index 2abe4577..00000000 --- a/R/SFORB.solution.R +++ /dev/null @@ -1,35 +0,0 @@ -#' Single First-Order Reversible Binding kinetics -#' -#' Function describing the solution of the differential equations describing -#' the kinetic model with first-order terms for a two-way transfer from a free -#' to a bound fraction, and a first-order degradation term for the free -#' fraction. The initial condition is a defined amount in the free fraction -#' and no substance in the bound fraction. -#' -#' @param t Time. -#' @param parent.0 Starting value for the response variable at time zero. -#' @param k_12 Kinetic constant describing transfer from free to bound. -#' @param k_21 Kinetic constant describing transfer from bound to free. -#' @param k_1output Kinetic constant describing degradation of the free -#' fraction. -#' @return The value of the response variable, which is the sum of free and -#' bound fractions at time \code{t}. -#' @references FOCUS (2006) \dQuote{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, -#' EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, -#' \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} -#' @examples -#' -#' \dontrun{plot(function(x) SFORB.solution(x, 100, 0.5, 2, 3), 0, 2)} -#' -#' @export -SFORB.solution = function(t, parent.0, k_12, k_21, k_1output) { - sqrt_exp = sqrt(1/4 * (k_12 + k_21 + k_1output)^2 + k_12 * k_21 - (k_12 + k_1output) * k_21) - b1 = 0.5 * (k_12 + k_21 + k_1output) + sqrt_exp - b2 = 0.5 * (k_12 + k_21 + k_1output) - sqrt_exp - - parent = parent.0 * - (((k_12 + k_21 - b1)/(b2 - b1)) * exp(-b1 * t) + - ((k_12 + k_21 - b2)/(b1 - b2)) * exp(-b2 * t)) -} diff --git a/R/parent_solutions.R b/R/parent_solutions.R new file mode 100644 index 00000000..f3d3e963 --- /dev/null +++ b/R/parent_solutions.R @@ -0,0 +1,231 @@ +#' Single First-Order kinetics +#' +#' Function describing exponential decline from a defined starting value. +#' +#' @family parent solutions +#' @param t Time. +#' @param parent_0 Starting value for the response variable at time zero. +#' @param k Kinetic rate constant. +#' @return The value of the response variable at time \code{t}. +#' @references +#' FOCUS (2006) \dQuote{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, +#' EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, +#' \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +#' FOCUS (2014) \dQuote{Generic guidance for Estimating Persistence +#' and Degradation Kinetics from Environmental Fate Studies on Pesticides in +#' EU Registration} Report of the FOCUS Work Group on Degradation Kinetics, +#' Version 1.1, 18 December 2014 +#' \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +#' @examples +#' +#' \dontrun{plot(function(x) SFO.solution(x, 100, 3), 0, 2)} +#' +#' @export +SFO.solution <- function(t, parent_0, k) +{ + parent = parent_0 * exp(-k * t) +} + +#' First-Order Multi-Compartment kinetics +#' +#' Function describing exponential decline from a defined starting value, with +#' a decreasing rate constant. +#' +#' The form given here differs slightly from the original reference by +#' Gustafson and Holden (1990). The parameter \code{beta} corresponds to 1/beta +#' in the original equation. +#' +#' @family parent solutions +#' @inherit SFO.solution +#' @param alpha Shape parameter determined by coefficient of variation of rate +#' constant values. +#' @param beta Location parameter. +#' @note The solution of the FOMC kinetic model reduces to the +#' \code{\link{SFO.solution}} for large values of \code{alpha} and +#' \code{beta} with \eqn{k = \frac{\beta}{\alpha}}{k = beta/alpha}. +#' @references FOCUS (2006) \dQuote{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, +#' EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, +#' \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +#' +#' Gustafson DI and Holden LR (1990) Nonlinear pesticide dissipation in soil: +#' A new model based on spatial variability. \emph{Environmental Science and +#' Technology} \bold{24}, 1032-1038 +#' @examples +#' +#' plot(function(x) FOMC.solution(x, 100, 10, 2), 0, 2, ylim = c(0, 100)) +#' +#' @export +FOMC.solution <- function(t, parent_0, alpha, beta) +{ + parent = parent_0 / (t/beta + 1)^alpha +} + +#' Indeterminate order rate equation kinetics +#' +#' Function describing exponential decline from a defined starting value, with +#' a concentration dependent rate constant. +#' +#' @family parent solutions +#' @inherit SFO.solution +#' @param k__iore Rate constant. Note that this depends on the concentration +#' units used. +#' @param N Exponent describing the nonlinearity of the rate equation +#' @note The solution of the IORE kinetic model reduces to the +#' \code{\link{SFO.solution}} if N = 1. The parameters of the IORE model can +#' be transformed to equivalent parameters of the FOMC mode - see the NAFTA +#' guidance for details. +#' @references NAFTA Technical Working Group on Pesticides (not dated) Guidance +#' for Evaluating and Calculating Degradation Kinetics in Environmental Media +#' @examples +#' +#' plot(function(x) IORE.solution(x, 100, 0.2, 1.3), 0, 2, ylim = c(0, 100)) +#' \dontrun{ +#' fit.fomc <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE) +#' fit.iore <- mkinfit("IORE", FOCUS_2006_C, quiet = TRUE) +#' fit.iore.deS <- mkinfit("IORE", FOCUS_2006_C, solution_type = "deSolve", quiet = TRUE) +#' +#' print(data.frame(fit.fomc$par, fit.iore$par, fit.iore.deS$par, +#' row.names = paste("model par", 1:4))) +#' print(rbind(fomc = endpoints(fit.fomc)$distimes, iore = endpoints(fit.iore)$distimes, +#' iore.deS = endpoints(fit.iore)$distimes)) +#' } +#' +#' @export +IORE.solution <- function(t, parent_0, k__iore, N) +{ + parent = (parent_0^(1 - N) - (1 - N) * k__iore * t)^(1/(1 - N)) +} + +#' Double First-Order in Parallel kinetics +#' +#' Function describing decline from a defined starting value using the sum of +#' two exponential decline functions. +#' +#' @family parent solutions +#' @inherit SFO.solution +#' @param t Time. +#' @param k1 First kinetic constant. +#' @param k2 Second kinetic constant. +#' @param g Fraction of the starting value declining according to the first +#' kinetic constant. +#' @examples +#' +#' plot(function(x) DFOP.solution(x, 100, 5, 0.5, 0.3), 0, 4, ylim = c(0,100)) +#' +#' @export +DFOP.solution <- function(t, parent_0, k1, k2, g) +{ + parent = g * parent_0 * exp(-k1 * t) + + (1 - g) * parent_0 * exp(-k2 * t) +} + +#' Hockey-Stick kinetics +#' +#' Function describing two exponential decline functions with a break point +#' between them. +#' +#' @family parent solutions +#' @inherit HS.solution +#' @param tb Break point. Before this time, exponential decline according to +#' \code{k1} is calculated, after this time, exponential decline proceeds +#' according to \code{k2}. +#' @examples +#' +#' plot(function(x) HS.solution(x, 100, 2, 0.3, 0.5), 0, 2, ylim=c(0,100)) +#' +#' @export +HS.solution <- function(t, parent_0, k1, k2, tb) +{ + parent = ifelse(t <= tb, + parent_0 * exp(-k1 * t), + parent_0 * exp(-k1 * tb) * exp(-k2 * (t - tb))) +} + +#' Single First-Order Reversible Binding kinetics +#' +#' Function describing the solution of the differential equations describing +#' the kinetic model with first-order terms for a two-way transfer from a free +#' to a bound fraction, and a first-order degradation term for the free +#' fraction. The initial condition is a defined amount in the free fraction +#' and no substance in the bound fraction. +#' +#' @family parent solutions +#' @inherit HS.solution +#' @param k_12 Kinetic constant describing transfer from free to bound. +#' @param k_21 Kinetic constant describing transfer from bound to free. +#' @param k_1output Kinetic constant describing degradation of the free +#' fraction. +#' @return The value of the response variable, which is the sum of free and +#' bound fractions at time \code{t}. +#' @examples +#' +#' \dontrun{plot(function(x) SFORB.solution(x, 100, 0.5, 2, 3), 0, 2)} +#' +#' @export +SFORB.solution = function(t, parent_0, k_12, k_21, k_1output) { + sqrt_exp = sqrt(1/4 * (k_12 + k_21 + k_1output)^2 + k_12 * k_21 - (k_12 + k_1output) * k_21) + b1 = 0.5 * (k_12 + k_21 + k_1output) + sqrt_exp + b2 = 0.5 * (k_12 + k_21 + k_1output) - sqrt_exp + + parent = parent_0 * + (((k_12 + k_21 - b1)/(b2 - b1)) * exp(-b1 * t) + + ((k_12 + k_21 - b2)/(b1 - b2)) * exp(-b2 * t)) +} + +#' Logistic kinetics +#' +#' Function describing exponential decline from a defined starting value, with +#' an increasing rate constant, supposedly caused by microbial growth +#' +#' @family parent solutions +#' @inherit SFO.solution +#' @param kmax Maximum rate constant. +#' @param k0 Minumum rate constant effective at time zero. +#' @param r Growth rate of the increase in the rate constant. +#' @note The solution of the logistic model reduces to the +#' \code{\link{SFO.solution}} if \code{k0} is equal to \code{kmax}. +#' @examples +#' +#' # Reproduce the plot on page 57 of FOCUS (2014) +#' plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.2), +#' from = 0, to = 100, ylim = c(0, 100), +#' xlab = "Time", ylab = "Residue") +#' plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.4), +#' from = 0, to = 100, add = TRUE, lty = 2, col = 2) +#' plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.8), +#' from = 0, to = 100, add = TRUE, lty = 3, col = 3) +#' plot(function(x) logistic.solution(x, 100, 0.08, 0.001, 0.2), +#' from = 0, to = 100, add = TRUE, lty = 4, col = 4) +#' plot(function(x) logistic.solution(x, 100, 0.08, 0.08, 0.2), +#' from = 0, to = 100, add = TRUE, lty = 5, col = 5) +#' legend("topright", inset = 0.05, +#' legend = paste0("k0 = ", c(0.0001, 0.0001, 0.0001, 0.001, 0.08), +#' ", r = ", c(0.2, 0.4, 0.8, 0.2, 0.2)), +#' lty = 1:5, col = 1:5) +#' +#' # Fit with synthetic data +#' logistic <- mkinmod(parent = mkinsub("logistic")) +#' +#' sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) +#' parms_logistic <- c(kmax = 0.08, k0 = 0.0001, r = 0.2) +#' d_logistic <- mkinpredict(logistic, +#' parms_logistic, c(parent = 100), +#' sampling_times) +#' d_2_1 <- add_err(d_logistic, +#' sdfunc = function(x) sigma_twocomp(x, 0.5, 0.07), +#' n = 1, reps = 2, digits = 5, LOD = 0.1, seed = 123456)[[1]] +#' +#' m <- mkinfit("logistic", d_2_1, quiet = TRUE) +#' plot_sep(m) +#' summary(m)$bpar +#' endpoints(m)$distimes +#' +#' @export +logistic.solution <- function(t, parent_0, kmax, k0, r) +{ + parent = parent_0 * (kmax / (kmax - k0 + k0 * exp (r * t))) ^(kmax/r) +} diff --git a/docs/404.html b/docs/404.html index b3193a23..12d9b275 100644 --- a/docs/404.html +++ b/docs/404.html @@ -10,23 +10,27 @@ - + - + - + + + + + - - + + - + - - + + @@ -53,7 +57,7 @@ - +
@@ -132,6 +141,12 @@ Content not found. Please use links in the navbar.
+ + @@ -142,7 +157,7 @@ Content not found. Please use links in the navbar.
-

Site built with pkgdown 1.4.1.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/articles/FOCUS_D.html b/docs/articles/FOCUS_D.html index 42361b92..e9c6b005 100644 --- a/docs/articles/FOCUS_D.html +++ b/docs/articles/FOCUS_D.html @@ -6,19 +6,19 @@ Example evaluation of FOCUS Example Dataset D • mkin - - - - + + + + + - - + - +
@@ -87,12 +94,12 @@
@@ -100,8 +107,8 @@

This is just a very simple vignette showing how to fit a degradation model for a parent compound with one transformation product using mkin. After loading the library we look at the data. We have observed concentrations in the column named value at the times specified in column time for the two observed variables named parent and m1.

-
library(mkin, quietly = TRUE)
-print(FOCUS_2006_D)
+
library(mkin, quietly = TRUE)
+print(FOCUS_2006_D)
##      name time  value
 ## 1  parent    0  99.46
 ## 2  parent    0 102.04
@@ -149,29 +156,29 @@
 ## 44     m1  120  33.31

Next we specify the degradation model: The parent compound degrades with simple first-order kinetics (SFO) to one metabolite named m1, which also degrades with SFO kinetics.

The call to mkinmod returns a degradation model. The differential equations represented in R code can be found in the character vector $diffs of the mkinmod object. If a C compiler (gcc) is installed and functional, the differential equation model will be compiled from auto-generated C code.

-
SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
+
SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
## Successfully compiled differential equation model from auto-generated C code.
-
print(SFO_SFO$diffs)
+
print(SFO_SFO$diffs)
##                                                       parent 
 ## "d_parent = - k_parent_sink * parent - k_parent_m1 * parent" 
 ##                                                           m1 
 ##             "d_m1 = + k_parent_m1 * parent - k_m1_sink * m1"

We do the fitting without progress report (quiet = TRUE).

-
fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
-
## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE): Observations with
-## value of zero were removed from the data
+
fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
+
## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE): Observations with value
+## of zero were removed from the data

A plot of the fit including a residual plot for both observed variables is obtained using the plot_sep method for mkinfit objects, which shows separate graphs for all compounds and their residuals.

-
plot_sep(fit, lpos = c("topright", "bottomright"))
+
plot_sep(fit, lpos = c("topright", "bottomright"))

Confidence intervals for the parameter estimates are obtained using the mkinparplot function.

- +

A comprehensive report of the results is obtained using the summary method for mkinfit objects.

-
summary(fit)
-
## mkin version used for fitting:    0.9.49.6 
-## R version used for fitting:       3.6.1 
-## Date of fit:     Fri Nov  1 10:10:44 2019 
-## Date of summary: Fri Nov  1 10:10:44 2019 
+
summary(fit)
+
## mkin version used for fitting:    0.9.49.11 
+## R version used for fitting:       4.0.0 
+## Date of fit:     Thu May  7 08:59:27 2020 
+## Date of summary: Thu May  7 08:59:27 2020 
 ## 
 ## Equations:
 ## d_parent/dt = - k_parent_sink * parent - k_parent_m1 * parent
@@ -179,7 +186,7 @@
 ## 
 ## Model predictions using solution type deSolve 
 ## 
-## Fitted using 389 model solutions performed in 1.015 s
+## Fitted using 389 model solutions performed in 1.031 s
 ## 
 ## Error model: Constant variance 
 ## 
@@ -212,18 +219,18 @@
 ## sigma                3.126    0.35850  2.396   3.855
 ## 
 ## Parameter correlation:
-##                     parent_0 log_k_parent_sink log_k_parent_m1
-## parent_0           1.000e+00         6.067e-01      -6.372e-02
-## log_k_parent_sink  6.067e-01         1.000e+00      -8.550e-02
-## log_k_parent_m1   -6.372e-02        -8.550e-02       1.000e+00
-## log_k_m1_sink     -1.688e-01        -6.252e-01       4.731e-01
-## sigma              1.164e-09        -8.908e-10       1.652e-08
-##                   log_k_m1_sink      sigma
-## parent_0             -1.688e-01  1.164e-09
-## log_k_parent_sink    -6.252e-01 -8.908e-10
-## log_k_parent_m1       4.731e-01  1.652e-08
-## log_k_m1_sink         1.000e+00 -1.340e-10
-## sigma                -1.340e-10  1.000e+00
+##                     parent_0 log_k_parent_sink log_k_parent_m1 log_k_m1_sink
+## parent_0           1.000e+00         6.067e-01      -6.372e-02    -1.688e-01
+## log_k_parent_sink  6.067e-01         1.000e+00      -8.550e-02    -6.252e-01
+## log_k_parent_m1   -6.372e-02        -8.550e-02       1.000e+00     4.731e-01
+## log_k_m1_sink     -1.688e-01        -6.252e-01       4.731e-01     1.000e+00
+## sigma              5.287e-10         3.306e-09       4.421e-08    -3.319e-10
+##                        sigma
+## parent_0           5.287e-10
+## log_k_parent_sink  3.306e-09
+## log_k_parent_m1    4.421e-08
+## log_k_m1_sink     -3.319e-10
+## sigma              1.000e+00
 ## 
 ## Backtransformed parameters:
 ## Confidence intervals for internally transformed parameters are asymmetric.
@@ -295,7 +302,7 @@
 ##   120       m1    33.31  28.78984  4.520e+00
-
-

Site built with pkgdown 1.4.1.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/articles/FOCUS_D_files/figure-html/plot-1.png b/docs/articles/FOCUS_D_files/figure-html/plot-1.png index 6f4fa093..a7944b84 100644 Binary files a/docs/articles/FOCUS_D_files/figure-html/plot-1.png and b/docs/articles/FOCUS_D_files/figure-html/plot-1.png differ diff --git a/docs/articles/index.html b/docs/articles/index.html index 9b0cce06..40f16c15 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -10,23 +10,27 @@ - + - + - + + + + + - - + + - + - - + + @@ -53,7 +57,7 @@ - +
@@ -132,16 +141,24 @@

All vignettes

- +
+
Example evaluation of FOCUS Example Dataset D
+
+
Example evaluation of FOCUS Laboratory Data L1 to L3
+
+
Introduction to mkin
+
+
Calculation of time weighted average concentrations with mkin
+
+
Example evaluation of FOCUS dataset Z
+
+
Evaluation of example datasets from Attachment 1 to the US EPA SOP for the NAFTA guidance
+
+
Benchmark timings for mkin on various systems
+
+
Performance benefit by using compiled model definitions in mkin
+
+
@@ -153,7 +170,7 @@
-

Site built with pkgdown 1.4.1.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/authors.html b/docs/authors.html index 55121d7c..9bba91ac 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -10,23 +10,27 @@ - + - + - + + + + + - - + + - + - - + + @@ -53,7 +57,7 @@ - +
@@ -130,7 +139,7 @@
  • -

    Johannes Ranke. Author, maintainer, copyright holder. ORCID +

    Johannes Ranke. Author, maintainer, copyright holder.

  • @@ -159,7 +168,7 @@
-

Site built with pkgdown 1.4.1.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/bootstrap-toc.css b/docs/bootstrap-toc.css new file mode 100644 index 00000000..5a859415 --- /dev/null +++ b/docs/bootstrap-toc.css @@ -0,0 +1,60 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ + +/* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ + +/* All levels of nav */ +nav[data-toggle='toc'] .nav > li > a { + display: block; + padding: 4px 20px; + font-size: 13px; + font-weight: 500; + color: #767676; +} +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 19px; + color: #563d7c; + text-decoration: none; + background-color: transparent; + border-left: 1px solid #563d7c; +} +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 18px; + font-weight: bold; + color: #563d7c; + background-color: transparent; + border-left: 2px solid #563d7c; +} + +/* Nav: second level (shown on .active) */ +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} +nav[data-toggle='toc'] .nav .nav > li > a { + padding-top: 1px; + padding-bottom: 1px; + padding-left: 30px; + font-size: 12px; + font-weight: normal; +} +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 29px; +} +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 28px; + font-weight: 500; +} + +/* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ +nav[data-toggle='toc'] .nav > .active > ul { + display: block; +} diff --git a/docs/bootstrap-toc.js b/docs/bootstrap-toc.js new file mode 100644 index 00000000..1cdd573b --- /dev/null +++ b/docs/bootstrap-toc.js @@ -0,0 +1,159 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ +(function() { + 'use strict'; + + window.Toc = { + helpers: { + // return all matching elements in the set, or their descendants + findOrFilter: function($el, selector) { + // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ + // http://stackoverflow.com/a/12731439/358804 + var $descendants = $el.find(selector); + return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); + }, + + generateUniqueIdBase: function(el) { + var text = $(el).text(); + var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); + return anchor || el.tagName.toLowerCase(); + }, + + generateUniqueId: function(el) { + var anchorBase = this.generateUniqueIdBase(el); + for (var i = 0; ; i++) { + var anchor = anchorBase; + if (i > 0) { + // add suffix + anchor += '-' + i; + } + // check if ID already exists + if (!document.getElementById(anchor)) { + return anchor; + } + } + }, + + generateAnchor: function(el) { + if (el.id) { + return el.id; + } else { + var anchor = this.generateUniqueId(el); + el.id = anchor; + return anchor; + } + }, + + createNavList: function() { + return $(''); + }, + + createChildNavList: function($parent) { + var $childList = this.createNavList(); + $parent.append($childList); + return $childList; + }, + + generateNavEl: function(anchor, text) { + var $a = $(''); + $a.attr('href', '#' + anchor); + $a.text(text); + var $li = $('
  • '); + $li.append($a); + return $li; + }, + + generateNavItem: function(headingEl) { + var anchor = this.generateAnchor(headingEl); + var $heading = $(headingEl); + var text = $heading.data('toc-text') || $heading.text(); + return this.generateNavEl(anchor, text); + }, + + // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). + getTopLevel: function($scope) { + for (var i = 1; i <= 6; i++) { + var $headings = this.findOrFilter($scope, 'h' + i); + if ($headings.length > 1) { + return i; + } + } + + return 1; + }, + + // returns the elements for the top level, and the next below it + getHeadings: function($scope, topLevel) { + var topSelector = 'h' + topLevel; + + var secondaryLevel = topLevel + 1; + var secondarySelector = 'h' + secondaryLevel; + + return this.findOrFilter($scope, topSelector + ',' + secondarySelector); + }, + + getNavLevel: function(el) { + return parseInt(el.tagName.charAt(1), 10); + }, + + populateNav: function($topContext, topLevel, $headings) { + var $context = $topContext; + var $prevNav; + + var helpers = this; + $headings.each(function(i, el) { + var $newNav = helpers.generateNavItem(el); + var navLevel = helpers.getNavLevel(el); + + // determine the proper $context + if (navLevel === topLevel) { + // use top level + $context = $topContext; + } else if ($prevNav && $context === $topContext) { + // create a new level of the tree and switch to it + $context = helpers.createChildNavList($prevNav); + } // else use the current $context + + $context.append($newNav); + + $prevNav = $newNav; + }); + }, + + parseOps: function(arg) { + var opts; + if (arg.jquery) { + opts = { + $nav: arg + }; + } else { + opts = arg; + } + opts.$scope = opts.$scope || $(document.body); + return opts; + } + }, + + // accepts a jQuery object, or an options object + init: function(opts) { + opts = this.helpers.parseOps(opts); + + // ensure that the data attribute is in place for styling + opts.$nav.attr('data-toggle', 'toc'); + + var $topContext = this.helpers.createChildNavList(opts.$nav); + var topLevel = this.helpers.getTopLevel(opts.$scope); + var $headings = this.helpers.getHeadings(opts.$scope, topLevel); + this.helpers.populateNav($topContext, topLevel, $headings); + } + }; + + $(function() { + $('nav[data-toggle="toc"]').each(function(i, el) { + var $nav = $(el); + Toc.init($nav); + }); + }); +})(); diff --git a/docs/index.html b/docs/index.html index 5baaa718..546f9143 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,10 +6,11 @@ Kinetic Evaluation of Chemical Degradation Data • mkin - - - - + + + + + - - +
    @@ -101,7 +108,7 @@

    Installation

    You can install the latest released version from CRAN from within R:

    - +

    @@ -141,7 +148,7 @@

    GUI

    -

    There is a graphical user interface that I consider useful for real work. Please refer to its documentation page for installation instructions and a manual.

    +

    There is a graphical user interface that may be useful. Please refer to its documentation page for installation instructions and a manual.

    @@ -164,18 +171,16 @@

    References

    - - + + + + + +
    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 -
    +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 +
    @@ -186,12 +191,14 @@

    -
    -

    Site built with pkgdown 1.4.1.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/reference/SFORB.solution.html b/docs/reference/SFORB.solution.html index fbf067af..c9f1b471 100644 --- a/docs/reference/SFORB.solution.html +++ b/docs/reference/SFORB.solution.html @@ -10,23 +10,27 @@ - + - + - + + + + + - - + + - + - - + + @@ -41,7 +45,6 @@ the kinetic model with first-order terms for a two-way transfer from a free to a bound fraction, and a first-order degradation term for the free fraction. The initial condition is a defined amount in the free fraction and no substance in the bound fraction." /> - @@ -59,7 +62,7 @@ and no substance in the bound fraction." /> - +
    @@ -117,7 +120,12 @@ and no substance in the bound fraction." />
    @@ -132,7 +140,7 @@ and no substance in the bound fraction." />
    @@ -144,19 +152,11 @@ fraction. The initial condition is a defined amount in the free fraction and no substance in the bound fraction.

    -
    SFORB.solution(t, parent.0, k_12, k_21, k_1output)
    +
    SFORB.solution(t, parent_0, k_12, k_21, k_1output)

    Arguments

    - - - - - - - - @@ -176,28 +176,25 @@ fraction.

    The value of the response variable, which is the sum of free and bound fractions at time t.

    -

    References

    +

    See also

    -

    FOCUS (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, - EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, - http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    +

    Examples

    - plot(function(x) SFORB.solution(x, 100, 0.5, 2, 3), 0, 2)
    + plot(function(x) SFORB.solution(x, 100, 0.5, 2, 3), 0, 2)
    - @@ -208,7 +205,7 @@ fraction.

    -

    Site built with pkgdown 1.4.1.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/reference/index.html b/docs/reference/index.html index e6a373d6..f77881fe 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -10,23 +10,27 @@ - + - + - + + + + + - - + + - + - - + + @@ -53,7 +57,7 @@ - +
    @@ -143,6 +152,11 @@

    Essential functionality

    + + + + +

    Functions working with mkinfit objects

    + + + + +

    Functions working with aggregated results

    + + + + +

    Create and work with nonlinear mixed models

    + + + + +

    + + + + +

    + + + + +

    + + + + +

    Parent only model solutions

    + + + + + @@ -571,6 +620,11 @@ kinetic models fitted with mkinfit

    + + + + +

    Functions that have been superseded

    + + + + +
    t

    Time.

    parent.0

    Starting value for the response variable at time zero.

    k_12

    Kinetic constant describing transfer from free to bound.

    @@ -176,6 +190,11 @@ more datasets

    @@ -251,6 +270,11 @@ with mkinfit

    @@ -278,6 +302,11 @@ of an mmkin object

    @@ -310,6 +339,11 @@ of an mmkin object

    @@ -402,6 +436,11 @@ of an mmkin object

    @@ -422,6 +461,11 @@ of an mmkin object

    @@ -521,6 +565,11 @@ kinetic models fitted with mkinfit

    @@ -560,7 +609,7 @@ kinetic models fitted with mkinfit

    -

    logistic.solution()

    +

    logistic.solution() logistic.solution()

    Logistic kinetics

    @@ -585,6 +639,11 @@ kinetic models fitted with mkinfit

    @@ -596,20 +655,10 @@ kinetic models fitted with mkinfit

    - @@ -620,7 +669,7 @@ kinetic models fitted with mkinfit

    -

    Site built with pkgdown 1.4.1.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/reference/logistic.solution-1.png b/docs/reference/logistic.solution-1.png index b9fb891c..fd11d0c0 100644 Binary files a/docs/reference/logistic.solution-1.png and b/docs/reference/logistic.solution-1.png differ diff --git a/docs/reference/logistic.solution-2.png b/docs/reference/logistic.solution-2.png index 78a31f93..fd11d0c0 100644 Binary files a/docs/reference/logistic.solution-2.png and b/docs/reference/logistic.solution-2.png differ diff --git a/docs/reference/logistic.solution.html b/docs/reference/logistic.solution.html index b2f24d45..3e87b90d 100644 --- a/docs/reference/logistic.solution.html +++ b/docs/reference/logistic.solution.html @@ -10,23 +10,27 @@ - + - + - + + + + + - - + + - + - - + + @@ -37,8 +41,9 @@ - @@ -56,7 +61,7 @@ an increasing rate constant, supposedly caused by microbial growth" /> - +
    @@ -114,7 +119,12 @@ an increasing rate constant, supposedly caused by microbial growth" />
    @@ -129,16 +139,20 @@ an increasing rate constant, supposedly caused by microbial growth" />

    Function describing exponential decline from a defined starting value, with +an increasing rate constant, supposedly caused by microbial growth

    +

    Function describing exponential decline from a defined starting value, with an increasing rate constant, supposedly caused by microbial growth

    -
    logistic.solution(t, parent.0, kmax, k0, r)
    +
    logistic.solution(t, parent_0, kmax, k0, r)
    +
    +logistic.solution(t, parent_0, kmax, k0, r)

    Arguments

    @@ -148,7 +162,7 @@ an increasing rate constant, supposedly caused by microbial growth

    - + @@ -163,6 +177,10 @@ an increasing rate constant, supposedly caused by microbial growth

    + + + +

    Time.

    parent.0parent_0

    Starting value for the response variable at time zero.

    r

    Growth rate of the increase in the rate constant.

    parent.0

    Starting value for the response variable at time zero.

    Value

    @@ -171,6 +189,8 @@ an increasing rate constant, supposedly caused by microbial growth

    Note

    The solution of the logistic model reduces to the + SFO.solution if k0 is equal to kmax.

    +

    The solution of the logistic model reduces to the SFO.solution if k0 is equal to kmax.

    References

    @@ -179,16 +199,25 @@ an increasing rate constant, supposedly caused by microbial growth

    EU Registration” Report of the FOCUS Work Group on Degradation Kinetics, Version 1.1, 18 December 2014 http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    +

    See also

    + +

    Other parent solutions: +DFOP.solution(), +FOMC.solution(), +HS.solution(), +IORE.solution(), +SFO.solution(), +SFORB.solution()

    Examples

    # Reproduce the plot on page 57 of FOCUS (2014) - plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.2), + plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.2), from = 0, to = 100, ylim = c(0, 100), - xlab = "Time", ylab = "Residue")
    plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.4), - from = 0, to = 100, add = TRUE, lty = 2, col = 2)
    plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.8), - from = 0, to = 100, add = TRUE, lty = 3, col = 3)
    plot(function(x) logistic.solution(x, 100, 0.08, 0.001, 0.2), - from = 0, to = 100, add = TRUE, lty = 4, col = 4)
    plot(function(x) logistic.solution(x, 100, 0.08, 0.08, 0.2), + xlab = "Time", ylab = "Residue")
    plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.4), + from = 0, to = 100, add = TRUE, lty = 2, col = 2)
    plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.8), + from = 0, to = 100, add = TRUE, lty = 3, col = 3)
    plot(function(x) logistic.solution(x, 100, 0.08, 0.001, 0.2), + from = 0, to = 100, add = TRUE, lty = 4, col = 4)
    plot(function(x) logistic.solution(x, 100, 0.08, 0.08, 0.2), from = 0, to = 100, add = TRUE, lty = 5, col = 5)
    legend("topright", inset = 0.05, legend = paste0("k0 = ", c(0.0001, 0.0001, 0.0001, 0.001, 0.08), ", r = ", c(0.2, 0.4, 0.8, 0.2, 0.2)), @@ -205,32 +234,38 @@ an increasing rate constant, supposedly caused by microbial growth

    sdfunc = function(x) sigma_twocomp(x, 0.5, 0.07), n = 1, reps = 2, digits = 5, LOD = 0.1, seed = 123456)[[1]] - m <- mkinfit("logistic", d_2_1, quiet = TRUE) - plot_sep(m)
    summary(m)$bpar
    #> Estimate se_notrans t value Pr(>t) Lower -#> parent_0 1.057896e+02 1.9023449649 55.610120 3.768361e-16 1.016451e+02 -#> kmax 6.398190e-02 0.0143201029 4.467978 3.841828e-04 3.929235e-02 -#> k0 1.612775e-04 0.0005866813 0.274898 3.940351e-01 5.846685e-08 -#> r 2.263946e-01 0.1718110773 1.317695 1.061044e-01 4.335843e-02 -#> sigma 5.332935e+00 0.9145907310 5.830952 4.036926e-05 3.340213e+00 -#> Upper -#> parent_0 109.9341588 -#> kmax 0.1041853 -#> k0 0.4448750 -#> r 1.1821121 -#> sigma 7.3256566
    endpoints(m)$distimes
    #> DT50 DT90 DT50_k0 DT50_kmax -#> parent 36.86533 62.41511 4297.854 10.83349
    + m <- mkinfit("logistic", d_2_1, quiet = TRUE)
    #> Error in (function (t, parent_0, kmax, k0, r) { parent = parent_0 * (kmax/(kmax - k0 + k0 * exp(r * t)))^(kmax/r)})(t = c(0, 1, 1.21212121212121, 2.42424242424242, 3, 3.63636363636364, 4.84848484848485, 6.06060606060606, 7, 7.27272727272727, 8.48484848484848, 9.6969696969697, 10.9090909090909, 12.1212121212121, 13.3333333333333, 14, 14.5454545454545, 15.7575757575758, 16.969696969697, 18.1818181818182, 19.3939393939394, 20.6060606060606, 21.8181818181818, 23.030303030303, 24.2424242424242, 25.4545454545455, 26.6666666666667, 27.8787878787879, 28, 29.0909090909091, 30.3030303030303, 31.5151515151515, 32.7272727272727, 33.9393939393939, 35.1515151515152, 36.3636363636364, 37.5757575757576, 38.7878787878788, 40, 41.2121212121212, 42.4242424242424, 43.6363636363636, 44.8484848484849, 46.0606060606061, 47.2727272727273, 48.4848484848485, 49.6969696969697, 50.9090909090909, 52.1212121212121, 53.3333333333333, 54.5454545454545, 55.7575757575758, 56.969696969697, 58.1818181818182, 59.3939393939394, 60, 60.6060606060606, 61.8181818181818, 63.030303030303, 64.2424242424242, 65.4545454545455, 66.6666666666667, 67.8787878787879, 69.0909090909091, 70.3030303030303, 71.5151515151515, 72.7272727272727, 73.9393939393939, 75.1515151515152, 76.3636363636364, 77.5757575757576, 78.7878787878788, 80, 81.2121212121212, 82.4242424242424, 83.6363636363636, 84.8484848484848, 86.0606060606061, 87.2727272727273, 88.4848484848485, 89.6969696969697, 90, 90.9090909090909, 92.1212121212121, 93.3333333333333, 94.5454545454545, 95.7575757575758, 96.969696969697, 98.1818181818182, 99.3939393939394, 100.606060606061, 101.818181818182, 103.030303030303, 104.242424242424, 105.454545454545, 106.666666666667, 107.878787878788, 109.090909090909, 110.30303030303, 111.515151515152, 112.727272727273, 113.939393939394, 115.151515151515, 116.363636363636, 117.575757575758, 118.787878787879, 120), parent.0 = c(parent = 101.95687), kmax = 0.1, k0 = 1e-04, r = 0.2): unbenutztes Argument (parent.0 = 101.95687)
    #> Timing stopped at: 0.001 0 0.001
    #> Error in identical(fit$err_mod, "const"): Objekt 'm' nicht gefunden
    summary(m)$bpar
    #> Error in summary(m): Objekt 'm' nicht gefunden
    endpoints(m)$distimes
    #> Error in endpoints(m): Objekt 'm' nicht gefunden
    + + # Reproduce the plot on page 57 of FOCUS (2014) + plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.2), + from = 0, to = 100, ylim = c(0, 100), + xlab = "Time", ylab = "Residue")
    plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.4), + from = 0, to = 100, add = TRUE, lty = 2, col = 2)
    plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.8), + from = 0, to = 100, add = TRUE, lty = 3, col = 3)
    plot(function(x) logistic.solution(x, 100, 0.08, 0.001, 0.2), + from = 0, to = 100, add = TRUE, lty = 4, col = 4)
    plot(function(x) logistic.solution(x, 100, 0.08, 0.08, 0.2), + from = 0, to = 100, add = TRUE, lty = 5, col = 5)
    legend("topright", inset = 0.05, + legend = paste0("k0 = ", c(0.0001, 0.0001, 0.0001, 0.001, 0.08), + ", r = ", c(0.2, 0.4, 0.8, 0.2, 0.2)), + lty = 1:5, col = 1:5)
    + # Fit with synthetic data + logistic <- mkinmod(parent = mkinsub("logistic")) + + sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) + parms_logistic <- c(kmax = 0.08, k0 = 0.0001, r = 0.2) + d_logistic <- mkinpredict(logistic, + parms_logistic, c(parent = 100), + sampling_times) + d_2_1 <- add_err(d_logistic, + sdfunc = function(x) sigma_twocomp(x, 0.5, 0.07), + n = 1, reps = 2, digits = 5, LOD = 0.1, seed = 123456)[[1]] + + m <- mkinfit("logistic", d_2_1, quiet = TRUE)
    #> Error in (function (t, parent_0, kmax, k0, r) { parent = parent_0 * (kmax/(kmax - k0 + k0 * exp(r * t)))^(kmax/r)})(t = c(0, 1, 1.21212121212121, 2.42424242424242, 3, 3.63636363636364, 4.84848484848485, 6.06060606060606, 7, 7.27272727272727, 8.48484848484848, 9.6969696969697, 10.9090909090909, 12.1212121212121, 13.3333333333333, 14, 14.5454545454545, 15.7575757575758, 16.969696969697, 18.1818181818182, 19.3939393939394, 20.6060606060606, 21.8181818181818, 23.030303030303, 24.2424242424242, 25.4545454545455, 26.6666666666667, 27.8787878787879, 28, 29.0909090909091, 30.3030303030303, 31.5151515151515, 32.7272727272727, 33.9393939393939, 35.1515151515152, 36.3636363636364, 37.5757575757576, 38.7878787878788, 40, 41.2121212121212, 42.4242424242424, 43.6363636363636, 44.8484848484849, 46.0606060606061, 47.2727272727273, 48.4848484848485, 49.6969696969697, 50.9090909090909, 52.1212121212121, 53.3333333333333, 54.5454545454545, 55.7575757575758, 56.969696969697, 58.1818181818182, 59.3939393939394, 60, 60.6060606060606, 61.8181818181818, 63.030303030303, 64.2424242424242, 65.4545454545455, 66.6666666666667, 67.8787878787879, 69.0909090909091, 70.3030303030303, 71.5151515151515, 72.7272727272727, 73.9393939393939, 75.1515151515152, 76.3636363636364, 77.5757575757576, 78.7878787878788, 80, 81.2121212121212, 82.4242424242424, 83.6363636363636, 84.8484848484848, 86.0606060606061, 87.2727272727273, 88.4848484848485, 89.6969696969697, 90, 90.9090909090909, 92.1212121212121, 93.3333333333333, 94.5454545454545, 95.7575757575758, 96.969696969697, 98.1818181818182, 99.3939393939394, 100.606060606061, 101.818181818182, 103.030303030303, 104.242424242424, 105.454545454545, 106.666666666667, 107.878787878788, 109.090909090909, 110.30303030303, 111.515151515152, 112.727272727273, 113.939393939394, 115.151515151515, 116.363636363636, 117.575757575758, 118.787878787879, 120), parent.0 = c(parent = 101.95687), kmax = 0.1, k0 = 1e-04, r = 0.2): unbenutztes Argument (parent.0 = 101.95687)
    #> Timing stopped at: 0 0 0
    #> Error in identical(fit$err_mod, "const"): Objekt 'm' nicht gefunden
    summary(m)$bpar
    #> Error in summary(m): Objekt 'm' nicht gefunden
    endpoints(m)$distimes
    #> Error in endpoints(m): Objekt 'm' nicht gefunden
    - @@ -241,7 +276,7 @@ an increasing rate constant, supposedly caused by microbial growth

    -

    Site built with pkgdown 1.4.1.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/reference/mkinds.html b/docs/reference/mkinds.html index 4f5d9f67..778c5132 100644 --- a/docs/reference/mkinds.html +++ b/docs/reference/mkinds.html @@ -10,23 +10,27 @@ - + - + - + + + + + - - + + - + - - + + @@ -40,7 +44,6 @@ mkinfit does not take mkinds datasets as argument, but works with dataframes such as the on contained in the data field of mkinds objects. Some datasets provided by this package come as mkinds objects nevertheless." /> - @@ -58,7 +61,7 @@ provided by this package come as mkinds objects nevertheless." /> - +
    @@ -131,7 +139,7 @@ provided by this package come as mkinds objects nevertheless." />
    @@ -149,7 +157,7 @@ provided by this package come as mkinds objects nevertheless.

    The S3 printing method print.mkinds

    Public fields

    -

    +

    title

    A full title for the dataset

    sampling_times

    The sampling times

    @@ -178,10 +186,10 @@ and value in order to be compatible with mkinfit


    Method new()

    Create a new mkinds object

    Usage

    -

    mkinds$new(title = "", data, time_unit = NA, unit = NA)

    +

    mkinds$new(title = "", data, time_unit = NA, unit = NA)

    Arguments

    -

    +

    title

    The dataset title

    data

    The data

    @@ -194,10 +202,10 @@ and value in order to be compatible with mkinfit


    Method clone()

    The objects of this class are cloneable with this method.

    Usage

    -

    mkinds$clone(deep = FALSE)

    +

    mkinds$clone(deep = FALSE)

    Arguments

    -

    +

    deep

    Whether to make a deep clone.

    @@ -213,15 +221,10 @@ and value in order to be compatible with mkinfit

    #> With a maximum of 1 replicates
    - @@ -232,7 +235,7 @@ and value in order to be compatible with mkinfit

    -

    Site built with pkgdown 1.4.1.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/reference/mkinfit.html b/docs/reference/mkinfit.html index 09837505..62823c58 100644 --- a/docs/reference/mkinfit.html +++ b/docs/reference/mkinfit.html @@ -10,23 +10,27 @@ - + - + - + + + + + - - + + - + - - + + @@ -43,7 +47,6 @@ kinetic model is solved using the function mkinpredict. The parameters of the selected error model are fitted simultaneously with the degradation model parameters, as both of them are arguments of the likelihood function." /> - @@ -61,7 +64,7 @@ likelihood function." /> - +
    @@ -134,7 +142,7 @@ likelihood function." />
    @@ -168,8 +176,8 @@ likelihood function.

    rtol = 1e-10, n.outtimes = 100, error_model = c("const", "obs", "tc"), - error_model_algorithm = c("auto", "d_3", "direct", "twostep", "threestep", "fourstep", - "IRLS", "OLS"), + error_model_algorithm = c("auto", "d_3", "direct", "twostep", "threestep", + "fourstep", "IRLS", "OLS"), reweight.tol = 1e-08, reweight.max.iter = 10, trace_parms = FALSE, @@ -414,82 +422,7 @@ estimators.

    Examples

    # Use shorthand notation for parent only degradation -fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE) -summary(fit)
    #> mkin version used for fitting: 0.9.49.11 -#> R version used for fitting: 3.6.3 -#> Date of fit: Mon Apr 20 18:52:22 2020 -#> Date of summary: Mon Apr 20 18:52:22 2020 -#> -#> Equations: -#> d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent -#> -#> Model predictions using solution type analytical -#> -#> Fitted using 222 model solutions performed in 0.473 s -#> -#> Error model: Constant variance -#> -#> Error model algorithm: OLS -#> -#> Starting values for parameters to be optimised: -#> value type -#> parent_0 85.1 state -#> alpha 1.0 deparm -#> beta 10.0 deparm -#> -#> Starting values for the transformed parameters actually optimised: -#> value lower upper -#> parent_0 85.100000 -Inf Inf -#> log_alpha 0.000000 -Inf Inf -#> log_beta 2.302585 -Inf Inf -#> -#> Fixed parameter values: -#> None -#> -#> Optimised, transformed parameters with symmetric confidence intervals: -#> Estimate Std. Error Lower Upper -#> parent_0 85.87000 1.8070 81.23000 90.5200 -#> log_alpha 0.05192 0.1353 -0.29580 0.3996 -#> log_beta 0.65100 0.2287 0.06315 1.2390 -#> sigma 1.85700 0.4378 0.73200 2.9830 -#> -#> Parameter correlation: -#> parent_0 log_alpha log_beta sigma -#> parent_0 1.000e+00 -1.565e-01 -3.142e-01 4.758e-08 -#> log_alpha -1.565e-01 1.000e+00 9.564e-01 1.007e-07 -#> log_beta -3.142e-01 9.564e-01 1.000e+00 8.568e-08 -#> sigma 4.758e-08 1.007e-07 8.568e-08 1.000e+00 -#> -#> Backtransformed parameters: -#> Confidence intervals for internally transformed parameters are asymmetric. -#> t-test (unrealistically) based on the assumption of normal distribution -#> for estimators of untransformed parameters. -#> Estimate t value Pr(>t) Lower Upper -#> parent_0 85.870 47.530 3.893e-08 81.2300 90.520 -#> alpha 1.053 7.393 3.562e-04 0.7439 1.491 -#> beta 1.917 4.373 3.601e-03 1.0650 3.451 -#> sigma 1.857 4.243 4.074e-03 0.7320 2.983 -#> -#> FOCUS Chi2 error levels in percent: -#> err.min n.optim df -#> All data 6.657 3 6 -#> parent 6.657 3 6 -#> -#> Estimated disappearance times: -#> DT50 DT90 DT50back -#> parent 1.785 15.15 4.56 -#> -#> Data: -#> time variable observed predicted residual -#> 0 parent 85.1 85.875 -0.7749 -#> 1 parent 57.9 55.191 2.7091 -#> 3 parent 29.9 31.845 -1.9452 -#> 7 parent 14.6 17.012 -2.4124 -#> 14 parent 9.7 9.241 0.4590 -#> 28 parent 6.6 4.754 1.8460 -#> 63 parent 4.0 2.102 1.8977 -#> 91 parent 3.9 1.441 2.4590 -#> 119 parent 0.6 1.092 -0.4919
    +fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE)
    #> Error in (function (t, parent_0, alpha, beta) { parent = parent_0/(t/beta + 1)^alpha})(t = c(0, 1, 1.2020202020202, 2.4040404040404, 3, 3.60606060606061, 4.80808080808081, 6.01010101010101, 7, 7.21212121212121, 8.41414141414141, 9.61616161616162, 10.8181818181818, 12.020202020202, 13.2222222222222, 14, 14.4242424242424, 15.6262626262626, 16.8282828282828, 18.030303030303, 19.2323232323232, 20.4343434343434, 21.6363636363636, 22.8383838383838, 24.040404040404, 25.2424242424242, 26.4444444444444, 27.6464646464646, 28, 28.8484848484848, 30.050505050505, 31.2525252525253, 32.4545454545455, 33.6565656565657, 34.8585858585859, 36.0606060606061, 37.2626262626263, 38.4646464646465, 39.6666666666667, 40.8686868686869, 42.0707070707071, 43.2727272727273, 44.4747474747475, 45.6767676767677, 46.8787878787879, 48.0808080808081, 49.2828282828283, 50.4848484848485, 51.6868686868687, 52.8888888888889, 54.0909090909091, 55.2929292929293, 56.4949494949495, 57.6969696969697, 58.8989898989899, 60.1010101010101, 61.3030303030303, 62.5050505050505, 63, 63.7070707070707, 64.9090909090909, 66.1111111111111, 67.3131313131313, 68.5151515151515, 69.7171717171717, 70.9191919191919, 72.1212121212121, 73.3232323232323, 74.5252525252525, 75.7272727272727, 76.9292929292929, 78.1313131313131, 79.3333333333333, 80.5353535353535, 81.7373737373737, 82.9393939393939, 84.1414141414141, 85.3434343434343, 86.5454545454545, 87.7474747474747, 88.9494949494949, 90.1515151515152, 91, 91.3535353535353, 92.5555555555556, 93.7575757575758, 94.959595959596, 96.1616161616162, 97.3636363636364, 98.5656565656566, 99.7676767676768, 100.969696969697, 102.171717171717, 103.373737373737, 104.575757575758, 105.777777777778, 106.979797979798, 108.181818181818, 109.383838383838, 110.585858585859, 111.787878787879, 112.989898989899, 114.191919191919, 115.393939393939, 116.59595959596, 117.79797979798, 119), parent.0 = c(parent = 85.1), alpha = 1, beta = 10): unbenutztes Argument (parent.0 = 85.1)
    #> Timing stopped at: 0 0 0.001
    summary(fit)
    #> Error in summary(fit): Objekt 'fit' nicht gefunden
    # One parent compound, one metabolite, both single first order. # Use mkinsub for convenience in model formulation. Pathway to sink included per default. SFO_SFO <- mkinmod( @@ -497,7 +430,8 @@ estimators.

    m1 = mkinsub("SFO"))
    #> Successfully compiled differential equation model from auto-generated C code.
    # Fit the model to the FOCUS example dataset D using defaults print(system.time(fit <- mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "eigen", quiet = TRUE)))
    #> Warning: Observations with value of zero were removed from the data
    #> User System verstrichen -#> 1.465 0.003 1.474
    coef(fit)
    #> NULL
    #> $ff +#> 1.526 0.000 1.526
    parms(fit)
    #> parent_0 k_parent_sink k_parent_m1 k_m1_sink sigma +#> 99.598483069 0.047920122 0.050777612 0.005260651 3.125503875
    #> $ff #> parent_sink parent_m1 m1_sink #> 0.485524 0.514476 1.000000 #> @@ -567,7 +501,8 @@ estimators.

    #> Sum of squared residuals at call 126: 371.2134 #> Sum of squared residuals at call 135: 371.2134 #> Negative log-likelihood at call 145: 97.22429
    #> Optimisation successfully terminated.
    #> User System verstrichen -#> 1.052 0.000 1.068
    coef(fit.deSolve)
    #> NULL
    endpoints(fit.deSolve)
    #> $ff +#> 1.084 0.000 1.085
    parms(fit.deSolve)
    #> parent_0 k_parent_sink k_parent_m1 k_m1_sink sigma +#> 99.598483072 0.047920122 0.050777612 0.005260651 3.125503874
    endpoints(fit.deSolve)
    #> $ff #> parent_sink parent_m1 m1_sink #> 0.485524 0.514476 1.000000 #> @@ -583,25 +518,23 @@ estimators.

    parent = mkinsub("FOMC", "m1"), m1 = mkinsub("SFO"))
    #> Successfully compiled differential equation model from auto-generated C code.
    # Fit the model to the FOCUS example dataset D using defaults fit.FOMC_SFO <- mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    # Use starting parameters from parent only FOMC fit -fit.FOMC = mkinfit("FOMC", FOCUS_2006_D, quiet = TRUE) -fit.FOMC_SFO <- mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE, - parms.ini = fit.FOMC$bparms.ode)
    #> Warning: Observations with value of zero were removed from the data
    +fit.FOMC = mkinfit("FOMC", FOCUS_2006_D, quiet = TRUE)
    #> Error in (function (t, parent_0, alpha, beta) { parent = parent_0/(t/beta + 1)^alpha})(t = c(0, 0.757575757575758, 1, 1.51515151515152, 2.27272727272727, 3, 3.03030303030303, 3.78787878787879, 4.54545454545454, 5.3030303030303, 6.06060606060606, 6.81818181818182, 7, 7.57575757575758, 8.33333333333333, 9.09090909090909, 9.84848484848485, 10.6060606060606, 11.3636363636364, 12.1212121212121, 12.8787878787879, 13.6363636363636, 14, 14.3939393939394, 15.1515151515152, 15.9090909090909, 16.6666666666667, 17.4242424242424, 18.1818181818182, 18.9393939393939, 19.6969696969697, 20.4545454545455, 21, 21.2121212121212, 21.969696969697, 22.7272727272727, 23.4848484848485, 24.2424242424242, 25, 25.7575757575758, 26.5151515151515, 27.2727272727273, 28.030303030303, 28.7878787878788, 29.5454545454545, 30.3030303030303, 31.0606060606061, 31.8181818181818, 32.5757575757576, 33.3333333333333, 34.0909090909091, 34.8484848484849, 35, 35.6060606060606, 36.3636363636364, 37.1212121212121, 37.8787878787879, 38.6363636363636, 39.3939393939394, 40.1515151515151, 40.9090909090909, 41.6666666666667, 42.4242424242424, 43.1818181818182, 43.9393939393939, 44.6969696969697, 45.4545454545455, 46.2121212121212, 46.969696969697, 47.7272727272727, 48.4848484848485, 49.2424242424242, 50, 50.7575757575758, 51.5151515151515, 52.2727272727273, 53.030303030303, 53.7878787878788, 54.5454545454545, 55.3030303030303, 56.0606060606061, 56.8181818181818, 57.5757575757576, 58.3333333333333, 59.0909090909091, 59.8484848484849, 60.6060606060606, 61.3636363636364, 62.1212121212121, 62.8787878787879, 63.6363636363636, 64.3939393939394, 65.1515151515152, 65.9090909090909, 66.6666666666667, 67.4242424242424, 68.1818181818182, 68.9393939393939, 69.6969696969697, 70.4545454545455, 71.2121212121212, 71.969696969697, 72.7272727272727, 73.4848484848485, 74.2424242424242, 75), parent.0 = c(parent = 100.75), alpha = 1, beta = 10): unbenutztes Argument (parent.0 = 100.75)
    #> Timing stopped at: 0 0 0.001
    fit.FOMC_SFO <- mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE, + parms.ini = fit.FOMC$bparms.ode)
    #> Warning: Observations with value of zero were removed from the data
    #> Error in mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE, parms.ini = fit.FOMC$bparms.ode): Objekt 'fit.FOMC' nicht gefunden
    # Use stepwise fitting, using optimised parameters from parent only fit, SFORB SFORB_SFO <- mkinmod( parent = list(type = "SFORB", to = "m1", sink = TRUE), m1 = list(type = "SFO"))
    #> Successfully compiled differential equation model from auto-generated C code.
    # Fit the model to the FOCUS example dataset D using defaults fit.SFORB_SFO <- mkinfit(SFORB_SFO, FOCUS_2006_D, quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    fit.SFORB_SFO.deSolve <- mkinfit(SFORB_SFO, FOCUS_2006_D, solution_type = "deSolve", quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    # Use starting parameters from parent only SFORB fit (not really needed in this case) -fit.SFORB = mkinfit("SFORB", FOCUS_2006_D, quiet = TRUE) -fit.SFORB_SFO <- mkinfit(SFORB_SFO, FOCUS_2006_D, parms.ini = fit.SFORB$bparms.ode, quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    # } +fit.SFORB = mkinfit("SFORB", FOCUS_2006_D, quiet = TRUE)
    #> Error in (function (t, parent_0, k_12, k_21, k_1output) { sqrt_exp = sqrt(1/4 * (k_12 + k_21 + k_1output)^2 + k_12 * k_21 - (k_12 + k_1output) * k_21) b1 = 0.5 * (k_12 + k_21 + k_1output) + sqrt_exp b2 = 0.5 * (k_12 + k_21 + k_1output) - sqrt_exp parent = parent_0 * (((k_12 + k_21 - b1)/(b2 - b1)) * exp(-b1 * t) + ((k_12 + k_21 - b2)/(b1 - b2)) * exp(-b2 * t))})(t = c(0, 0.757575757575758, 1, 1.51515151515152, 2.27272727272727, 3, 3.03030303030303, 3.78787878787879, 4.54545454545454, 5.3030303030303, 6.06060606060606, 6.81818181818182, 7, 7.57575757575758, 8.33333333333333, 9.09090909090909, 9.84848484848485, 10.6060606060606, 11.3636363636364, 12.1212121212121, 12.8787878787879, 13.6363636363636, 14, 14.3939393939394, 15.1515151515152, 15.9090909090909, 16.6666666666667, 17.4242424242424, 18.1818181818182, 18.9393939393939, 19.6969696969697, 20.4545454545455, 21, 21.2121212121212, 21.969696969697, 22.7272727272727, 23.4848484848485, 24.2424242424242, 25, 25.7575757575758, 26.5151515151515, 27.2727272727273, 28.030303030303, 28.7878787878788, 29.5454545454545, 30.3030303030303, 31.0606060606061, 31.8181818181818, 32.5757575757576, 33.3333333333333, 34.0909090909091, 34.8484848484849, 35, 35.6060606060606, 36.3636363636364, 37.1212121212121, 37.8787878787879, 38.6363636363636, 39.3939393939394, 40.1515151515151, 40.9090909090909, 41.6666666666667, 42.4242424242424, 43.1818181818182, 43.9393939393939, 44.6969696969697, 45.4545454545455, 46.2121212121212, 46.969696969697, 47.7272727272727, 48.4848484848485, 49.2424242424242, 50, 50.7575757575758, 51.5151515151515, 52.2727272727273, 53.030303030303, 53.7878787878788, 54.5454545454545, 55.3030303030303, 56.0606060606061, 56.8181818181818, 57.5757575757576, 58.3333333333333, 59.0909090909091, 59.8484848484849, 60.6060606060606, 61.3636363636364, 62.1212121212121, 62.8787878787879, 63.6363636363636, 64.3939393939394, 65.1515151515152, 65.9090909090909, 66.6666666666667, 67.4242424242424, 68.1818181818182, 68.9393939393939, 69.6969696969697, 70.4545454545455, 71.2121212121212, 71.969696969697, 72.7272727272727, 73.4848484848485, 74.2424242424242, 75), parent.0 = c(parent_free = 100.75), k_1output = 0.1, k_12 = 0.1, k_21 = 0.02): unbenutztes Argument (parent.0 = 100.75)
    #> Timing stopped at: 0.001 0 0.001
    fit.SFORB_SFO <- mkinfit(SFORB_SFO, FOCUS_2006_D, parms.ini = fit.SFORB$bparms.ode, quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    #> Error in mkinfit(SFORB_SFO, FOCUS_2006_D, parms.ini = fit.SFORB$bparms.ode, quiet = TRUE): Objekt 'fit.SFORB' nicht gefunden
    # } # \dontrun{ # Weighted fits, including IRLS SFO_SFO.ff <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"), use_of_ff = "max")
    #> Successfully compiled differential equation model from auto-generated C code.
    f.noweight <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    summary(f.noweight)
    #> mkin version used for fitting: 0.9.49.11 -#> R version used for fitting: 3.6.3 -#> Date of fit: Mon Apr 20 18:52:37 2020 -#> Date of summary: Mon Apr 20 18:52:37 2020 +#> R version used for fitting: 4.0.0 +#> Date of fit: Thu May 7 08:59:03 2020 +#> Date of summary: Thu May 7 08:59:03 2020 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -609,7 +542,7 @@ estimators.

    #> #> Model predictions using solution type deSolve #> -#> Fitted using 422 model solutions performed in 1.087 s +#> Fitted using 422 model solutions performed in 1.106 s #> #> Error model: Constant variance #> @@ -716,9 +649,9 @@ estimators.

    #> 100 m1 33.13 31.98163 1.148e+00 #> 120 m1 25.15 28.78984 -3.640e+00 #> 120 m1 33.31 28.78984 4.520e+00
    f.obs <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "obs", quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    summary(f.obs)
    #> mkin version used for fitting: 0.9.49.11 -#> R version used for fitting: 3.6.3 -#> Date of fit: Mon Apr 20 18:52:40 2020 -#> Date of summary: Mon Apr 20 18:52:40 2020 +#> R version used for fitting: 4.0.0 +#> Date of fit: Thu May 7 08:59:06 2020 +#> Date of summary: Thu May 7 08:59:06 2020 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -726,7 +659,7 @@ estimators.

    #> #> Model predictions using solution type deSolve #> -#> Fitted using 979 model solutions performed in 2.518 s +#> Fitted using 979 model solutions performed in 2.604 s #> #> Error model: Variance unique to each observed variable #> @@ -848,9 +781,9 @@ estimators.

    #> 100 m1 33.13 31.98773 1.142e+00 #> 120 m1 25.15 28.80429 -3.654e+00 #> 120 m1 33.31 28.80429 4.506e+00
    f.tc <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "tc", quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    summary(f.tc)
    #> mkin version used for fitting: 0.9.49.11 -#> R version used for fitting: 3.6.3 -#> Date of fit: Mon Apr 20 18:52:50 2020 -#> Date of summary: Mon Apr 20 18:52:50 2020 +#> R version used for fitting: 4.0.0 +#> Date of fit: Thu May 7 08:59:16 2020 +#> Date of summary: Thu May 7 08:59:16 2020 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -858,7 +791,7 @@ estimators.

    #> #> Model predictions using solution type deSolve #> -#> Fitted using 2552 model solutions performed in 10.186 s +#> Fitted using 2552 model solutions performed in 10.544 s #> #> Error model: Two-component variance function #> @@ -977,20 +910,10 @@ estimators.

    - @@ -1001,7 +924,7 @@ estimators.

    -

    Site built with pkgdown 1.4.1.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/reference/mkinmod.html b/docs/reference/mkinmod.html index b25f2da3..d1204e2e 100644 --- a/docs/reference/mkinmod.html +++ b/docs/reference/mkinmod.html @@ -10,23 +10,27 @@ - + - + - + + + + + - - + + - + - - + + @@ -40,7 +44,6 @@ name to a list, specifying the kinetic model type and reaction or transfer to other observed compartments. Instead of specifying several expressions, a list of lists can be given in the speclist argument." /> - @@ -58,7 +61,7 @@ list of lists can be given in the speclist argument." /> - +
    @@ -116,7 +119,12 @@ list of lists can be given in the speclist argument." />
    @@ -131,7 +139,7 @@ list of lists can be given in the speclist argument." />
    @@ -205,7 +213,7 @@ applicable to give detailed information about the C function being built.

    use_of_ff

    The content of use_of_ff is passed on in this list component.

    coefmat

    The coefficient matrix, if the system of differential equations can be represented by one.

    -
    ll

    The likelihood function, taking the parameter vector as the first argument.

    +
    cf

    If generated, the compiled function as returned by cfunction.

    Details

    @@ -244,7 +252,7 @@ in the FOCUS and NAFTA guidance documents are used.

    SFO_SFO <- mkinmod( parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"), verbose = TRUE)
    #> Compilation argument: -#> /usr/lib/R/bin/R CMD SHLIB file414965c335f6.c 2> file414965c335f6.c.err.txt +#> /usr/lib/R/bin/R CMD SHLIB file66a9718e919b.c 2> file66a9718e919b.c.err.txt #> Program source: #> 1: #include <R.h> #> 2: @@ -277,19 +285,10 @@ in the FOCUS and NAFTA guidance documents are used.

    quiet = TRUE) # }
    - @@ -300,7 +299,7 @@ in the FOCUS and NAFTA guidance documents are used.

    -

    Site built with pkgdown 1.4.1.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/reference/mkinpredict.html b/docs/reference/mkinpredict.html index fe5bc975..689fb7c7 100644 --- a/docs/reference/mkinpredict.html +++ b/docs/reference/mkinpredict.html @@ -10,23 +10,27 @@ - + - + - + + + + + - - + + - + - - + + @@ -39,7 +43,6 @@ - @@ -57,7 +60,7 @@ kinetic parameters and initial values for the state variables." /> - +
    @@ -115,7 +118,12 @@ kinetic parameters and initial values for the state variables." />
    @@ -130,7 +138,7 @@ kinetic parameters and initial values for the state variables." />
    @@ -258,32 +266,11 @@ solver is used.

    Examples

    - SFO <- mkinmod(degradinol = mkinsub("SFO")) - # Compare solution types - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - solution_type = "analytical")
    #> time degradinol -#> 1 0 100.0000000 -#> 2 1 74.0818221 -#> 3 2 54.8811636 -#> 4 3 40.6569660 -#> 5 4 30.1194212 -#> 6 5 22.3130160 -#> 7 6 16.5298888 -#> 8 7 12.2456428 -#> 9 8 9.0717953 -#> 10 9 6.7205513 -#> 11 10 4.9787068 -#> 12 11 3.6883167 -#> 13 12 2.7323722 -#> 14 13 2.0241911 -#> 15 14 1.4995577 -#> 16 15 1.1108997 -#> 17 16 0.8229747 -#> 18 17 0.6096747 -#> 19 18 0.4516581 -#> 20 19 0.3345965 -#> 21 20 0.2478752
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - solution_type = "deSolve")
    #> time degradinol +SFO <- mkinmod(degradinol = mkinsub("SFO")) +# Compare solution types +mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + solution_type = "analytical")
    #> Error in (function (t, parent_0, k) { parent = parent_0 * exp(-k * t)})(t = 0:20, parent.0 = c(degradinol = 100), k = 0.3): unbenutztes Argument (parent.0 = 100)
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + solution_type = "deSolve")
    #> time degradinol #> 1 0 100.0000000 #> 2 1 74.0818221 #> 3 2 54.8811636 @@ -304,8 +291,8 @@ solver is used.

    #> 18 17 0.6096747 #> 19 18 0.4516581 #> 20 19 0.3345965 -#> 21 20 0.2478752
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - solution_type = "deSolve", use_compiled = FALSE)
    #> time degradinol +#> 21 20 0.2478752
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + solution_type = "deSolve", use_compiled = FALSE)
    #> time degradinol #> 1 0 100.0000000 #> 2 1 74.0818221 #> 3 2 54.8811636 @@ -326,8 +313,8 @@ solver is used.

    #> 18 17 0.6096747 #> 19 18 0.4516581 #> 20 19 0.3345965 -#> 21 20 0.2478752
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - solution_type = "eigen")
    #> time degradinol +#> 21 20 0.2478752
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + solution_type = "eigen")
    #> time degradinol #> 1 0 100.0000000 #> 2 1 74.0818221 #> 3 2 54.8811636 @@ -349,92 +336,68 @@ solver is used.

    #> 19 18 0.4516581 #> 20 19 0.3345965 #> 21 20 0.2478752
    - - # Compare integration methods to analytical solution - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - solution_type = "analytical")[21,]
    #> time degradinol -#> 21 20 0.2478752
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - method = "lsoda")[21,]
    #> time degradinol -#> 21 20 0.2478752
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - method = "ode45")[21,]
    #> time degradinol -#> 21 20 0.2478752
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - method = "rk4")[21,]
    #> time degradinol -#> 21 20 0.2480043
    # rk4 is not as precise here - - # The number of output times used to make a lot of difference until the - # default for atol was adjusted - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), - seq(0, 20, by = 0.1))[201,]
    #> time degradinol -#> 201 20 0.2478752
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), - seq(0, 20, by = 0.01))[2001,]
    #> time degradinol +# Compare integration methods to analytical solution +mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + solution_type = "analytical")[21,]
    #> Error in (function (t, parent_0, k) { parent = parent_0 * exp(-k * t)})(t = 0:20, parent.0 = c(degradinol = 100), k = 0.3): unbenutztes Argument (parent.0 = 100)
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + method = "lsoda")[21,]
    #> time degradinol +#> 21 20 0.2478752
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + method = "ode45")[21,]
    #> time degradinol +#> 21 20 0.2478752
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + method = "rk4")[21,]
    #> time degradinol +#> 21 20 0.2480043
    # rk4 is not as precise here + +# The number of output times used to make a lot of difference until the +# default for atol was adjusted +mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), + seq(0, 20, by = 0.1))[201,]
    #> time degradinol +#> 201 20 0.2478752
    mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), + seq(0, 20, by = 0.01))[2001,]
    #> time degradinol #> 2001 20 0.2478752
    - # Check compiled model versions - they are faster than the eigenvalue based solutions! - SFO_SFO = mkinmod(parent = list(type = "SFO", to = "m1"), - m1 = list(type = "SFO"))
    #> Successfully compiled differential equation model from auto-generated C code.
    system.time( - print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), - c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), - solution_type = "eigen")[201,]))
    #> time parent m1 -#> 201 20 4.978707 27.46227
    #> User System verstrichen -#> 0.003 0.000 0.003
    system.time( - print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), - c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), - solution_type = "deSolve")[201,]))
    #> time parent m1 -#> 201 20 4.978707 27.46227
    #> User System verstrichen -#> 0.002 0.000 0.002
    system.time( - print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), - c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), - solution_type = "deSolve", use_compiled = FALSE)[201,]))
    #> time parent m1 -#> 201 20 4.978707 27.46227
    #> User System verstrichen -#> 0.021 0.000 0.021
    - # \dontrun{ - # Predict from a fitted model - f <- mkinfit(SFO_SFO, FOCUS_2006_C)
    #> Ordinary least squares optimisation
    #> Sum of squared residuals at call 1: 552.5739 -#> Sum of squared residuals at call 3: 552.5739 -#> Sum of squared residuals at call 4: 552.5739 -#> Sum of squared residuals at call 6: 279.9345 -#> Sum of squared residuals at call 7: 279.9344 -#> Sum of squared residuals at call 8: 279.9294 -#> Sum of squared residuals at call 9: 279.9294 -#> Sum of squared residuals at call 12: 200.3629 -#> Sum of squared residuals at call 13: 200.3629 -#> Sum of squared residuals at call 18: 197.904 -#> Sum of squared residuals at call 22: 197.904 -#> Sum of squared residuals at call 25: 196.6753 -#> Sum of squared residuals at call 27: 196.6753 -#> Sum of squared residuals at call 32: 196.5742 -#> Sum of squared residuals at call 33: 196.5742 -#> Sum of squared residuals at call 34: 196.5742 -#> Sum of squared residuals at call 38: 196.5361 -#> Sum of squared residuals at call 40: 196.5361 -#> Sum of squared residuals at call 44: 196.5336 -#> Sum of squared residuals at call 45: 196.5336 -#> Sum of squared residuals at call 50: 196.5334 -#> Sum of squared residuals at call 51: 196.5334 -#> Sum of squared residuals at call 52: 196.5334 -#> Sum of squared residuals at call 56: 196.5334 -#> Sum of squared residuals at call 58: 196.5334 -#> Sum of squared residuals at call 59: 196.5334 -#> Sum of squared residuals at call 65: 196.5334 -#> Negative log-likelihood at call 75: 26.64668
    #> Optimisation successfully terminated.
    head(mkinpredict(f))
    #> time parent m1 +# Check compiled model versions - they are faster than the eigenvalue based solutions! +SFO_SFO = mkinmod(parent = list(type = "SFO", to = "m1"), + m1 = list(type = "SFO"))
    #> Successfully compiled differential equation model from auto-generated C code.
    if(require(rbenchmark)) { + benchmark( + eigen = mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), + c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), + solution_type = "eigen")[201,], + deSolve_compiled = mkinpredict(SFO_SFO, + c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), + c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), + solution_type = "deSolve")[201,], + deSolve = mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), + c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), + solution_type = "deSolve", use_compiled = FALSE)[201,], + replications = 10) +}
    #> Lade nötiges Paket: rbenchmark
    #> test replications elapsed relative user.self sys.self user.child +#> 3 deSolve 10 0.229 28.625 0.229 0 0 +#> 2 deSolve_compiled 10 0.008 1.000 0.008 0 0 +#> 1 eigen 10 0.025 3.125 0.026 0 0 +#> sys.child +#> 3 0 +#> 2 0 +#> 1 0
    +# Since mkin 0.9.49.11 we also have analytical solutions for some models, including SFO-SFO +# deSolve = mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), +# c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), +# solution_type = "analytical", use_compiled = FALSE)[201,], + +# \dontrun{ + # Predict from a fitted model + f <- mkinfit(SFO_SFO, FOCUS_2006_C, quiet = TRUE) + head(mkinpredict(f))
    #> time parent m1 #> 1 0.0 82.49216 0.000000 #> 2 0.1 80.00563 1.179963 #> 3 0.2 77.59404 2.312596 #> 4 0.3 75.25515 3.399443 #> 5 0.4 72.98675 4.442000 -#> 6 0.5 70.78673 5.441717
    # } +#> 6 0.5 70.78673 5.441717
    # }
    - @@ -445,7 +408,7 @@ solver is used.

    -

    Site built with pkgdown 1.4.1.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/man/DFOP.solution.Rd b/man/DFOP.solution.Rd index b145984a..8ada60c5 100644 --- a/man/DFOP.solution.Rd +++ b/man/DFOP.solution.Rd @@ -1,15 +1,15 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DFOP.solution.R +% Please edit documentation in R/parent_solutions.R \name{DFOP.solution} \alias{DFOP.solution} \title{Double First-Order in Parallel kinetics} \usage{ -DFOP.solution(t, parent.0, k1, k2, g) +DFOP.solution(t, parent_0, k1, k2, g) } \arguments{ \item{t}{Time.} -\item{parent.0}{Starting value for the response variable at time zero.} +\item{parent_0}{Starting value for the response variable at time zero.} \item{k1}{First kinetic constant.} @@ -36,4 +36,19 @@ FOCUS (2006) \dQuote{Guidance Document on Estimating Persistence EU Registration} Report of the FOCUS Work Group on Degradation Kinetics, EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +FOCUS (2014) \dQuote{Generic guidance for Estimating Persistence + and Degradation Kinetics from Environmental Fate Studies on Pesticides in + EU Registration} Report of the FOCUS Work Group on Degradation Kinetics, + Version 1.1, 18 December 2014 + \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +} +\seealso{ +Other parent solutions: +\code{\link{FOMC.solution}()}, +\code{\link{HS.solution}()}, +\code{\link{IORE.solution}()}, +\code{\link{SFO.solution}()}, +\code{\link{SFORB.solution}()}, +\code{\link{logistic.solution}()} } +\concept{parent solutions} diff --git a/man/FOMC.solution.Rd b/man/FOMC.solution.Rd index 54430dd1..d326f13a 100644 --- a/man/FOMC.solution.Rd +++ b/man/FOMC.solution.Rd @@ -1,15 +1,15 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FOMC.solution.R +% Please edit documentation in R/parent_solutions.R \name{FOMC.solution} \alias{FOMC.solution} \title{First-Order Multi-Compartment kinetics} \usage{ -FOMC.solution(t, parent.0, alpha, beta) +FOMC.solution(t, parent_0, alpha, beta) } \arguments{ \item{t}{Time.} -\item{parent.0}{Starting value for the response variable at time zero.} +\item{parent_0}{Starting value for the response variable at time zero.} \item{alpha}{Shape parameter determined by coefficient of variation of rate constant values.} @@ -49,3 +49,13 @@ FOCUS (2006) \dQuote{Guidance Document on Estimating Persistence A new model based on spatial variability. \emph{Environmental Science and Technology} \bold{24}, 1032-1038 } +\seealso{ +Other parent solutions: +\code{\link{DFOP.solution}()}, +\code{\link{HS.solution}()}, +\code{\link{IORE.solution}()}, +\code{\link{SFO.solution}()}, +\code{\link{SFORB.solution}()}, +\code{\link{logistic.solution}()} +} +\concept{parent solutions} diff --git a/man/HS.solution.Rd b/man/HS.solution.Rd index ba96b139..343f83f0 100644 --- a/man/HS.solution.Rd +++ b/man/HS.solution.Rd @@ -1,27 +1,16 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/HS.solution.R +% Please edit documentation in R/parent_solutions.R \name{HS.solution} \alias{HS.solution} \title{Hockey-Stick kinetics} \usage{ -HS.solution(t, parent.0, k1, k2, tb) +HS.solution(t, parent_0, k1, k2, tb) } \arguments{ -\item{t}{Time.} - -\item{parent.0}{Starting value for the response variable at time zero.} - -\item{k1}{First kinetic constant.} - -\item{k2}{Second kinetic constant.} - \item{tb}{Break point. Before this time, exponential decline according to \code{k1} is calculated, after this time, exponential decline proceeds according to \code{k2}.} } -\value{ -The value of the response variable at time \code{t}. -} \description{ Function describing two exponential decline functions with a break point between them. @@ -31,10 +20,13 @@ between them. plot(function(x) HS.solution(x, 100, 2, 0.3, 0.5), 0, 2, ylim=c(0,100)) } -\references{ -FOCUS (2006) \dQuote{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, - EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, - \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +\seealso{ +Other parent solutions: +\code{\link{DFOP.solution}()}, +\code{\link{FOMC.solution}()}, +\code{\link{IORE.solution}()}, +\code{\link{SFO.solution}()}, +\code{\link{SFORB.solution}()}, +\code{\link{logistic.solution}()} } +\concept{parent solutions} diff --git a/man/IORE.solution.Rd b/man/IORE.solution.Rd index ad2df3df..e1f1be1a 100644 --- a/man/IORE.solution.Rd +++ b/man/IORE.solution.Rd @@ -1,15 +1,15 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/IORE.solution.R +% Please edit documentation in R/parent_solutions.R \name{IORE.solution} \alias{IORE.solution} \title{Indeterminate order rate equation kinetics} \usage{ -IORE.solution(t, parent.0, k__iore, N) +IORE.solution(t, parent_0, k__iore, N) } \arguments{ \item{t}{Time.} -\item{parent.0}{Starting value for the response variable at time zero.} +\item{parent_0}{Starting value for the response variable at time zero.} \item{k__iore}{Rate constant. Note that this depends on the concentration units used.} @@ -48,4 +48,13 @@ The solution of the IORE kinetic model reduces to the NAFTA Technical Working Group on Pesticides (not dated) Guidance for Evaluating and Calculating Degradation Kinetics in Environmental Media } -\keyword{manip} +\seealso{ +Other parent solutions: +\code{\link{DFOP.solution}()}, +\code{\link{FOMC.solution}()}, +\code{\link{HS.solution}()}, +\code{\link{SFO.solution}()}, +\code{\link{SFORB.solution}()}, +\code{\link{logistic.solution}()} +} +\concept{parent solutions} diff --git a/man/SFO.solution.Rd b/man/SFO.solution.Rd index 03c0dce8..6892cccc 100644 --- a/man/SFO.solution.Rd +++ b/man/SFO.solution.Rd @@ -1,17 +1,17 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/SFO.solution.R +% Please edit documentation in R/parent_solutions.R \name{SFO.solution} \alias{SFO.solution} \title{Single First-Order kinetics} \usage{ -SFO.solution(t, parent.0, k) +SFO.solution(t, parent_0, k) } \arguments{ \item{t}{Time.} -\item{parent.0}{Starting value for the response variable at time zero.} +\item{parent_0}{Starting value for the response variable at time zero.} -\item{k}{Kinetic constant.} +\item{k}{Kinetic rate constant.} } \value{ The value of the response variable at time \code{t}. @@ -30,4 +30,19 @@ FOCUS (2006) \dQuote{Guidance Document on Estimating Persistence EU Registration} Report of the FOCUS Work Group on Degradation Kinetics, EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +FOCUS (2014) \dQuote{Generic guidance for Estimating Persistence + and Degradation Kinetics from Environmental Fate Studies on Pesticides in + EU Registration} Report of the FOCUS Work Group on Degradation Kinetics, + Version 1.1, 18 December 2014 + \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +} +\seealso{ +Other parent solutions: +\code{\link{DFOP.solution}()}, +\code{\link{FOMC.solution}()}, +\code{\link{HS.solution}()}, +\code{\link{IORE.solution}()}, +\code{\link{SFORB.solution}()}, +\code{\link{logistic.solution}()} } +\concept{parent solutions} diff --git a/man/SFORB.solution.Rd b/man/SFORB.solution.Rd index ce9dce73..c70ce13b 100644 --- a/man/SFORB.solution.Rd +++ b/man/SFORB.solution.Rd @@ -1,16 +1,12 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/SFORB.solution.R +% Please edit documentation in R/parent_solutions.R \name{SFORB.solution} \alias{SFORB.solution} \title{Single First-Order Reversible Binding kinetics} \usage{ -SFORB.solution(t, parent.0, k_12, k_21, k_1output) +SFORB.solution(t, parent_0, k_12, k_21, k_1output) } \arguments{ -\item{t}{Time.} - -\item{parent.0}{Starting value for the response variable at time zero.} - \item{k_12}{Kinetic constant describing transfer from free to bound.} \item{k_21}{Kinetic constant describing transfer from bound to free.} @@ -34,10 +30,13 @@ and no substance in the bound fraction. \dontrun{plot(function(x) SFORB.solution(x, 100, 0.5, 2, 3), 0, 2)} } -\references{ -FOCUS (2006) \dQuote{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, - EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, - \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +\seealso{ +Other parent solutions: +\code{\link{DFOP.solution}()}, +\code{\link{FOMC.solution}()}, +\code{\link{HS.solution}()}, +\code{\link{IORE.solution}()}, +\code{\link{SFO.solution}()}, +\code{\link{logistic.solution}()} } +\concept{parent solutions} diff --git a/man/logistic.solution.Rd b/man/logistic.solution.Rd index def776aa..589ee8ec 100644 --- a/man/logistic.solution.Rd +++ b/man/logistic.solution.Rd @@ -1,30 +1,40 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/logistic.solution.R +% Please edit documentation in R/logistic.solution.R, R/parent_solutions.R \name{logistic.solution} \alias{logistic.solution} \title{Logistic kinetics} \usage{ -logistic.solution(t, parent.0, kmax, k0, r) +logistic.solution(t, parent_0, kmax, k0, r) + +logistic.solution(t, parent_0, kmax, k0, r) } \arguments{ \item{t}{Time.} -\item{parent.0}{Starting value for the response variable at time zero.} +\item{parent_0}{Starting value for the response variable at time zero.} \item{kmax}{Maximum rate constant.} \item{k0}{Minumum rate constant effective at time zero.} \item{r}{Growth rate of the increase in the rate constant.} + +\item{parent.0}{Starting value for the response variable at time zero.} } \value{ The value of the response variable at time \code{t}. } \description{ +Function describing exponential decline from a defined starting value, with +an increasing rate constant, supposedly caused by microbial growth + Function describing exponential decline from a defined starting value, with an increasing rate constant, supposedly caused by microbial growth } \note{ +The solution of the logistic model reduces to the + \code{\link{SFO.solution}} if \code{k0} is equal to \code{kmax}. + The solution of the logistic model reduces to the \code{\link{SFO.solution}} if \code{k0} is equal to \code{kmax}. } @@ -64,6 +74,41 @@ The solution of the logistic model reduces to the summary(m)$bpar endpoints(m)$distimes + + # Reproduce the plot on page 57 of FOCUS (2014) + plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.2), + from = 0, to = 100, ylim = c(0, 100), + xlab = "Time", ylab = "Residue") + plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.4), + from = 0, to = 100, add = TRUE, lty = 2, col = 2) + plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.8), + from = 0, to = 100, add = TRUE, lty = 3, col = 3) + plot(function(x) logistic.solution(x, 100, 0.08, 0.001, 0.2), + from = 0, to = 100, add = TRUE, lty = 4, col = 4) + plot(function(x) logistic.solution(x, 100, 0.08, 0.08, 0.2), + from = 0, to = 100, add = TRUE, lty = 5, col = 5) + legend("topright", inset = 0.05, + legend = paste0("k0 = ", c(0.0001, 0.0001, 0.0001, 0.001, 0.08), + ", r = ", c(0.2, 0.4, 0.8, 0.2, 0.2)), + lty = 1:5, col = 1:5) + + # Fit with synthetic data + logistic <- mkinmod(parent = mkinsub("logistic")) + + sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) + parms_logistic <- c(kmax = 0.08, k0 = 0.0001, r = 0.2) + d_logistic <- mkinpredict(logistic, + parms_logistic, c(parent = 100), + sampling_times) + d_2_1 <- add_err(d_logistic, + sdfunc = function(x) sigma_twocomp(x, 0.5, 0.07), + n = 1, reps = 2, digits = 5, LOD = 0.1, seed = 123456)[[1]] + + m <- mkinfit("logistic", d_2_1, quiet = TRUE) + plot_sep(m) + summary(m)$bpar + endpoints(m)$distimes + } \references{ FOCUS (2014) \dQuote{Generic guidance for Estimating Persistence @@ -72,3 +117,13 @@ FOCUS (2014) \dQuote{Generic guidance for Estimating Persistence Version 1.1, 18 December 2014 \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} } +\seealso{ +Other parent solutions: +\code{\link{DFOP.solution}()}, +\code{\link{FOMC.solution}()}, +\code{\link{HS.solution}()}, +\code{\link{IORE.solution}()}, +\code{\link{SFO.solution}()}, +\code{\link{SFORB.solution}()} +} +\concept{parent solutions} -- cgit v1.2.1