From a5a73e8d76faff5983399386de571431e8824636 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sat, 13 Sep 2025 09:08:43 +0200 Subject: Refactor for code readability --- R/saem.R | 6 +++--- log/build.log | 2 +- log/check.log | 4 ++-- log/test.log | 18 +++++++++--------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/R/saem.R b/R/saem.R index 45a7f8e9..2a9c2fa5 100644 --- a/R/saem.R +++ b/R/saem.R @@ -871,12 +871,12 @@ parms.saem.mmkin <- function(object, ci = FALSE, covariates = NULL, ...) # estimates for the corresponding covariate values passed # in 'covariates'. covariate_centers <- object$covariate_centers - centered_covariates <- covariates + parm_covariates <- covariates if (!is.na(covariate_centers[1])) { # If covariates were centered by the saem function, we need to center # user specified covariates as well for (i in names(covariates)) { - centered_covariates[i] <- covariates[i] - object$covariate_centers[i] + parm_covariates[i] <- covariates[i] - object$covariate_centers[i] } } est_for_cov <- matrix(NA, @@ -890,7 +890,7 @@ parms.saem.mmkin <- function(object, ci = FALSE, covariates = NULL, ...) beta_degparm_name <- paste0("beta_", covariate, "(", deg_parm_name, ")") est_for_cov[deg_parm_name, ] <- estimate[deg_parm_name] + - centered_covariates[[covariate]] * estimate[beta_degparm_name] + parm_covariates[[covariate]] * estimate[beta_degparm_name] } else { est_for_cov[deg_parm_name, ] <- estimate[deg_parm_name] } diff --git a/log/build.log b/log/build.log index 37262b29..b2206986 100644 --- a/log/build.log +++ b/log/build.log @@ -6,5 +6,5 @@ * checking for LF line-endings in source and make files and shell scripts * checking for empty or unneeded directories Removed empty directory ‘mkin/vignettes/web_only’ -* building ‘mkin_1.2.11.tar.gz’ +* building ‘mkin_1.2.10.tar.gz’ diff --git a/log/check.log b/log/check.log index 94fd8095..7f212453 100644 --- a/log/check.log +++ b/log/check.log @@ -9,7 +9,7 @@ * using options ‘--no-tests --as-cran’ * checking for file ‘mkin/DESCRIPTION’ ... OK * checking extension type ... Package -* this is package ‘mkin’ version ‘1.2.11’ +* this is package ‘mkin’ version ‘1.2.10’ * package encoding: UTF-8 * checking CRAN incoming feasibility ... OK * checking package namespace information ... OK @@ -60,7 +60,7 @@ * checking sizes of PDF files under ‘inst/doc’ ... OK * checking installed files from ‘inst/doc’ ... OK * checking files in ‘vignettes’ ... OK -* checking examples ... [13s/13s] OK +* checking examples ... [12s/12s] OK * checking for unstated dependencies in ‘tests’ ... OK * checking tests ... SKIPPED * checking for unstated dependencies in vignettes ... OK diff --git a/log/test.log b/log/test.log index 1b7f5c00..e1726492 100644 --- a/log/test.log +++ b/log/test.log @@ -4,29 +4,29 @@ ✔ | 5 | Analytical solutions for coupled models [1.6s] ✔ | 5 | Calculation of Akaike weights ✔ | 3 | Export dataset for reading into CAKE -✔ | 6 | Use of precompiled symbols in mkinpredict [3.6s] +✔ | 6 | Use of precompiled symbols in mkinpredict [3.7s] ✔ | 12 | Confidence intervals and p-values ✔ | 1 | Solutions with deSolve -✔ | 1 12 | Dimethenamid data from 2018 [14.1s] -✔ | 14 | Error model fitting [2.8s] +✔ | 1 12 | Dimethenamid data from 2018 [14.0s] +✔ | 14 | Error model fitting [2.7s] ✔ | 5 | Time step normalisation ✔ | 4 | Calculation of FOCUS chi2 error levels ✔ | 14 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ✔ | 4 | Test fitting the decline of metabolites from their maximum ✔ | 1 | Fitting the logistic model ✔ | 10 | Batch fitting and diagnosing hierarchical kinetic models [20.5s] -✔ | 2 20 | Nonlinear mixed-effects models [144.7s] +✔ | 2 20 | Nonlinear mixed-effects models [142.6s] ✔ | 3 | Test dataset classes mkinds and mkindsg ✔ | 10 | Special cases of mkinfit calls ✔ | 3 | mkinfit features ✔ | 8 | mkinmod model generation and printing ✔ | 4 | Model predictions with mkinpredict -✔ | 12 | Multistart method for saem.mmkin models [23.7s] +✔ | 12 | Multistart method for saem.mmkin models [23.8s] ✔ | 16 | Evaluations according to 2015 NAFTA guidance [1.5s] -✔ | 9 | Nonlinear mixed-effects models with nlme [4.3s] -✔ | 15 | Plotting [4.8s] +✔ | 9 | Nonlinear mixed-effects models with nlme [4.0s] +✔ | 15 | Plotting [4.9s] ✔ | 4 | Residuals extracted from mkinfit models -✔ | 1 38 | saemix parent models [35.6s] +✔ | 1 38 | saemix parent models [36.1s] ✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper ✔ | 11 | Processing of residue series ✔ | 10 | Fitting the SFORB model [1.7s] @@ -38,7 +38,7 @@ ✔ | 2 | water-sediment ══ Results ═════════════════════════════════════════════════════════════════════ -Duration: 267.4 s +Duration: 265.7 s ── Skipped tests (4) ─────────────────────────────────────────────────────────── • Fitting this ODE model with saemix takes about 5 minutes on my new system -- cgit v1.2.1