aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-11-08 07:56:50 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2022-11-08 07:56:50 +0100
commit7186006740aca909660e42dce8d92eb4735af533 (patch)
tree9a761988132a652301bc35e7935bd5827e82c4af
parentf9343a9f401dce52188fceec456865ba4f2eb95f (diff)
Simplify SFORB also in the endpoint function
-rw-r--r--R/endpoints.R21
-rw-r--r--log/test.log26
-rw-r--r--man/endpoints.Rd17
3 files changed, 31 insertions, 33 deletions
diff --git a/R/endpoints.R b/R/endpoints.R
index e81e7a0a..227671b5 100644
--- a/R/endpoints.R
+++ b/R/endpoints.R
@@ -10,18 +10,17 @@
#' Additional DT50 values are calculated from the FOMC DT90 and k1 and k2 from
#' HS and DFOP, as well as from Eigenvalues b1 and b2 of any SFORB models
#'
-#' @param fit An object of class [mkinfit], [nlme.mmkin] or [saem.mmkin],
-#' or another object that has list components
-#' mkinmod containing an [mkinmod] degradation model, and two numeric vectors,
-#' bparms.optim and bparms.fixed, that contain parameter values
-#' for that model.
+#' @param fit An object of class [mkinfit], [nlme.mmkin] or [saem.mmkin], or
+#' another object that has list components mkinmod containing an [mkinmod]
+#' degradation model, and two numeric vectors, bparms.optim and bparms.fixed,
+#' that contain parameter values for that model.
#' @importFrom stats optimize
-#' @return A list with a matrix of dissipation times named distimes,
-#' and, if applicable, a vector of formation fractions named ff
-#' and, if the SFORB model was in use, a vector of eigenvalues
-#' of these SFORB models, equivalent to DFOP rate constants
+#' @return A list with a matrix of dissipation times named distimes, and, if
+#' applicable, a vector of formation fractions named ff and, if the SFORB model
+#' was in use, a vector of eigenvalues of these SFORB models, equivalent to
+#' DFOP rate constants
#' @note The function is used internally by [summary.mkinfit],
-#' [summary.nlme.mmkin] and [summary.saem.mmkin].
+#' [summary.nlme.mmkin] and [summary.saem.mmkin].
#' @author Johannes Ranke
#' @examples
#'
@@ -160,7 +159,7 @@ endpoints <- function(fit) {
k_12 = degparms[paste("k", obs_var, "free", "bound", sep="_")]
k_21 = degparms[paste("k", obs_var, "bound", "free", sep="_")]
- sqrt_exp = sqrt(1/4 * (k_12 + k_21 + k_1output)^2 + k_12 * k_21 - (k_12 + k_1output) * k_21)
+ sqrt_exp = sqrt(1/4 * (k_12 + k_21 + k_1output)^2 - 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
diff --git a/log/test.log b/log/test.log
index 52b92245..b82e290f 100644
--- a/log/test.log
+++ b/log/test.log
@@ -1,53 +1,53 @@
ℹ Testing mkin
✔ | F W S OK | Context
✔ | 5 | AIC calculation
-✔ | 5 | Analytical solutions for coupled models [3.3s]
+✔ | 5 | Analytical solutions for coupled models [3.2s]
✔ | 5 | Calculation of Akaike weights
✔ | 3 | Export dataset for reading into CAKE
✔ | 12 | Confidence intervals and p-values [1.0s]
-✔ | 1 12 | Dimethenamid data from 2018 [31.5s]
+✔ | 1 12 | Dimethenamid data from 2018 [32.4s]
────────────────────────────────────────────────────────────────────────────────
Skip (test_dmta.R:98:3): Different backends get consistent results for SFO-SFO3+, dimethenamid data
Reason: Fitting this ODE model with saemix takes about 15 minutes on my system
────────────────────────────────────────────────────────────────────────────────
-✔ | 14 | Error model fitting [4.9s]
+✔ | 14 | Error model fitting [5.0s]
✔ | 5 | Time step normalisation
✔ | 4 | Calculation of FOCUS chi2 error levels [0.6s]
✔ | 14 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [0.8s]
-✔ | 4 | Test fitting the decline of metabolites from their maximum [0.4s]
+✔ | 4 | Test fitting the decline of metabolites from their maximum [0.3s]
✔ | 1 | Fitting the logistic model [0.2s]
-✔ | 10 | Batch fitting and diagnosing hierarchical kinetic models [23.7s]
+✔ | 10 | Batch fitting and diagnosing hierarchical kinetic models [24.5s]
✔ | 1 12 | Nonlinear mixed-effects models [0.3s]
────────────────────────────────────────────────────────────────────────────────
Skip (test_mixed.R:74:3): saemix results are reproducible for biphasic fits
Reason: Fitting with saemix takes around 10 minutes when using deSolve
────────────────────────────────────────────────────────────────────────────────
✔ | 3 | Test dataset classes mkinds and mkindsg
-✔ | 10 | Special cases of mkinfit calls [0.5s]
+✔ | 10 | Special cases of mkinfit calls [0.6s]
✔ | 3 | mkinfit features [0.7s]
✔ | 8 | mkinmod model generation and printing [0.2s]
✔ | 3 | Model predictions with mkinpredict [0.3s]
✔ | 7 | Multistart method for saem.mmkin models [36.3s]
-✔ | 16 | Evaluations according to 2015 NAFTA guidance [2.3s]
-✔ | 9 | Nonlinear mixed-effects models with nlme [8.9s]
-✔ | 16 | Plotting [10.0s]
+✔ | 16 | Evaluations according to 2015 NAFTA guidance [2.5s]
+✔ | 9 | Nonlinear mixed-effects models with nlme [9.1s]
+✔ | 16 | Plotting [10.3s]
✔ | 4 | Residuals extracted from mkinfit models
-✔ | 1 37 | saemix parent models [72.0s]
+✔ | 1 37 | saemix parent models [72.3s]
────────────────────────────────────────────────────────────────────────────────
Skip (test_saemix_parent.R:153:3): We can also use mkin solution methods for saem
Reason: This still takes almost 2.5 minutes although we do not solve ODEs
────────────────────────────────────────────────────────────────────────────────
✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.4s]
✔ | 11 | Processing of residue series
-✔ | 7 | Fitting the SFORB model [3.7s]
+✔ | 7 | Fitting the SFORB model [3.8s]
✔ | 1 | Summaries of old mkinfit objects
✔ | 5 | Summary [0.2s]
✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.2s]
✔ | 9 | Hypothesis tests [8.1s]
-✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.4s]
+✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.2s]
══ Results ═════════════════════════════════════════════════════════════════════
-Duration: 216.5 s
+Duration: 219.0 s
── Skipped tests ──────────────────────────────────────────────────────────────
• Fitting this ODE model with saemix takes about 15 minutes on my system (1)
diff --git a/man/endpoints.Rd b/man/endpoints.Rd
index 75fa9503..e3663aec 100644
--- a/man/endpoints.Rd
+++ b/man/endpoints.Rd
@@ -8,17 +8,16 @@ with mkinfit}
endpoints(fit)
}
\arguments{
-\item{fit}{An object of class \link{mkinfit}, \link{nlme.mmkin} or \link{saem.mmkin},
-or another object that has list components
-mkinmod containing an \link{mkinmod} degradation model, and two numeric vectors,
-bparms.optim and bparms.fixed, that contain parameter values
-for that model.}
+\item{fit}{An object of class \link{mkinfit}, \link{nlme.mmkin} or \link{saem.mmkin}, or
+another object that has list components mkinmod containing an \link{mkinmod}
+degradation model, and two numeric vectors, bparms.optim and bparms.fixed,
+that contain parameter values for that model.}
}
\value{
-A list with a matrix of dissipation times named distimes,
-and, if applicable, a vector of formation fractions named ff
-and, if the SFORB model was in use, a vector of eigenvalues
-of these SFORB models, equivalent to DFOP rate constants
+A list with a matrix of dissipation times named distimes, and, if
+applicable, a vector of formation fractions named ff and, if the SFORB model
+was in use, a vector of eigenvalues of these SFORB models, equivalent to
+DFOP rate constants
}
\description{
This function calculates DT50 and DT90 values as well as formation fractions

Contact - Imprint