From ea9b76c667620d75c5aeb4077117e722ed0bc3d6 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 8 May 2020 16:25:34 +0200 Subject: We do not need the n.outtimes argument for mkinfit As we set the tolerance for ode() appropriately --- R/mkinfit.R | 13 +++---------- test.log | 18 +++++++++--------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/R/mkinfit.R b/R/mkinfit.R index 61593ce5..f0738ffc 100644 --- a/R/mkinfit.R +++ b/R/mkinfit.R @@ -101,10 +101,6 @@ if(getRversion() >= '2.15.1') utils::globalVariables(c("name", "time", "value")) #' is 1e-8, lower than in \code{\link{lsoda}}. #' @param rtol Absolute error tolerance, passed to \code{\link{ode}}. Default #' is 1e-10, much lower than in \code{\link{lsoda}}. -#' @param n.outtimes The length of the dataseries that is produced by the model -#' prediction function \code{\link{mkinpredict}}. This impacts the accuracy -#' of the numerical solver if that is used (see \code{solution_type} -#' argument. #' @param error_model If the error model is "const", a constant standard #' deviation is assumed. #' @@ -248,7 +244,7 @@ mkinfit <- function(mkinmod, observed, transform_rates = TRUE, transform_fractions = TRUE, quiet = FALSE, - atol = 1e-8, rtol = 1e-10, n.outtimes = 10, + atol = 1e-8, rtol = 1e-10, error_model = c("const", "obs", "tc"), error_model_algorithm = c("auto", "d_3", "direct", "twostep", "threestep", "fourstep", "IRLS", "OLS"), reweight.tol = 1e-8, reweight.max.iter = 10, @@ -523,11 +519,8 @@ mkinfit <- function(mkinmod, observed, errparms_optim <- errparms } - # Define outtimes for model solution. - # Include time points at which observed data are available - outtimes = sort(unique(c(observed$time, seq(min(observed$time), - max(observed$time), - length.out = n.outtimes)))) + # Unique outtimes for model solution. + outtimes = sort(unique(observed$time)) # Define the objective function for optimisation, including (back)transformations cost_function <- function(P, trans = TRUE, OLS = FALSE, fixed_degparms = FALSE, fixed_errparms = FALSE, update_data = TRUE, ...) diff --git a/test.log b/test.log index 4f8bb36b..489550a2 100644 --- a/test.log +++ b/test.log @@ -4,12 +4,12 @@ Testing mkin ✔ | 2 | Export dataset for reading into CAKE ✔ | 13 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [3.1 s] ✔ | 4 | Calculation of FOCUS chi2 error levels [1.9 s] -✔ | 7 | Fitting the SFORB model [9.8 s] +✔ | 7 | Fitting the SFORB model [9.6 s] ✔ | 5 | Calculation of Akaike weights -✔ | 10 | Confidence intervals and p-values [8.4 s] -✔ | 14 | Error model fitting [22.0 s] +✔ | 10 | Confidence intervals and p-values [8.3 s] +✔ | 14 | Error model fitting [22.1 s] ✔ | 6 | Test fitting the decline of metabolites from their maximum [0.7 s] -✔ | 1 | Fitting the logistic model [0.8 s] +✔ | 1 | Fitting the logistic model [0.7 s] ✔ | 1 | Test dataset class mkinds used in gmkin ✔ | 12 | Special cases of mkinfit calls [2.1 s] ✔ | 8 | mkinmod model generation and printing [0.2 s] @@ -18,16 +18,16 @@ Testing mkin ✔ | 9 | Nonlinear mixed-effects models [11.9 s] ✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.4 s] ✔ | 3 | Summary -✔ | 14 | Plotting [4.1 s] +✔ | 14 | Plotting [4.0 s] ✔ | 4 | AIC calculation ✔ | 4 | Residuals extracted from mkinfit models -✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [3.9 s] +✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [3.8 s] ✔ | 1 | Summaries of old mkinfit objects -✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [6.1 s] -✔ | 9 | Hypothesis tests [21.6 s] +✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [6.0 s] +✔ | 9 | Hypothesis tests [21.3 s] ══ Results ═════════════════════════════════════════════════════════════════════ -Duration: 103.4 s +Duration: 102.5 s OK: 156 Failed: 0 -- cgit v1.2.1