aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-02-22 09:46:39 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2019-02-22 09:46:39 +0100
commit39d5dc6988389f026d5165cac208ec63d0645a77 (patch)
tree9ad604208a70d9ff01fd3e77febbe3a7080dee06
parent5181a55b1619c153b690db97ee82698bf76525ff (diff)
Further adaptations for the logistic model
- Make mmkin compatible - Return DT50 values corresponding to k0 and kmax - Turn incompatible parameter names in parms.ini from an error to a warning, in order to make it possible to use this argument in calls to mmkin
-rw-r--r--R/endpoints.R5
-rw-r--r--R/mkinfit.R4
-rw-r--r--R/mmkin.R4
-rw-r--r--man/logistic.solution.Rd7
4 files changed, 13 insertions, 7 deletions
diff --git a/R/endpoints.R b/R/endpoints.R
index 80450185..f8a44c4d 100644
--- a/R/endpoints.R
+++ b/R/endpoints.R
@@ -166,6 +166,11 @@ endpoints <- function(fit) {
r = parms.all["r"]
DT50 = (1/r) * log(1 - ((kmax/k0) * (1 - 2^(r/kmax))))
DT90 = (1/r) * log(1 - ((kmax/k0) * (1 - 10^(r/kmax))))
+
+ DT50_k0 = log(2)/k0
+ DT50_kmax = log(2)/kmax
+ ep$distimes[obs_var, c("DT50_k0")] = DT50_k0
+ ep$distimes[obs_var, c("DT50_kmax")] = DT50_kmax
}
ep$distimes[obs_var, c("DT50", "DT90")] = c(DT50, DT90)
}
diff --git a/R/mkinfit.R b/R/mkinfit.R
index 40413125..2dec3a72 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -99,10 +99,10 @@ mkinfit <- function(mkinmod, observed,
# Define starting values for parameters where not specified by the user
if (parms.ini[[1]] == "auto") parms.ini = vector()
- # Prevent inital parameter specifications that are not in the model
+ # Warn for inital parameter specifications that are not in the model
wrongpar.names <- setdiff(names(parms.ini), mkinmod$parms)
if (length(wrongpar.names) > 0) {
- stop("Initial parameter(s) ", paste(wrongpar.names, collapse = ", "),
+ warning("Initial parameter(s) ", paste(wrongpar.names, collapse = ", "),
" not used in the model")
}
diff --git a/R/mmkin.R b/R/mmkin.R
index 63542f4f..b713ae74 100644
--- a/R/mmkin.R
+++ b/R/mmkin.R
@@ -1,4 +1,4 @@
-# Copyright (C) 2015 Johannes Ranke
+# Copyright (C) 2015,2019 Johannes Ranke
# Contact: jranke@uni-bremen.de
# The summary function is an adapted and extended version of summary.modFit
# from the FME package, v 1.1 by Soetart and Petzoldt, which was in turn
@@ -22,7 +22,7 @@
mmkin <- function(models = c("SFO", "FOMC", "DFOP"), datasets,
cores = round(detectCores()/2), cluster = NULL, ...)
{
- parent_models_available = c("SFO", "FOMC", "DFOP", "HS", "SFORB", "IORE")
+ parent_models_available = c("SFO", "FOMC", "DFOP", "HS", "SFORB", "IORE", "logistic")
n.m <- length(models)
n.d <- length(datasets)
n.fits <- n.m * n.d
diff --git a/man/logistic.solution.Rd b/man/logistic.solution.Rd
index 67e60983..05b6c0aa 100644
--- a/man/logistic.solution.Rd
+++ b/man/logistic.solution.Rd
@@ -2,7 +2,7 @@
\alias{logistic.solution}
\title{ Logistic kinetics }
\description{
- Function describing exponential decline from a defined starting value, with
+ Function describing exponential decline from a defined starting value, with
an increasing rate constant, supposedly caused by microbial growth
}
\usage{
@@ -28,11 +28,11 @@ logistic.solution(t, parent.0, kmax, k0, r)
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}
+ \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics}
}
\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),
@@ -63,5 +63,6 @@ logistic.solution(t, parent.0, kmax, k0, r)
m <- mkinfit("logistic", d_2_1, quiet = TRUE)
plot_sep(m)
summary(m)$bpar
+ endpoints(m)$distimes
}
\keyword{ manip }

Contact - Imprint